Wait for account info to create the folder

This commit is contained in:
Nick/Nelson 2017-09-20 02:36:04 +00:00
parent 97cca39507
commit 233ebb78d8
No known key found for this signature in database
GPG Key ID: 01365471E7AAA465
1 changed files with 4 additions and 4 deletions

View File

@ -28,10 +28,6 @@ if user.nil?
exit 1
end
path = user
path = File.join options[:output], user unless options[:output].nil?
FileUtils.mkdir_p path unless File.exist? path
# this is v gross, but they probably do it like this on purpose
initial = open "https://vsco.co/#{user}/images/1"
vs = /vs=(\S*);/.match(initial.meta['set-cookie']).captures[0]
@ -39,6 +35,10 @@ siteId = JSON.parse(/window.VSCOVARS.SiteSettings = ({.*})/.match(initial.read)
images = JSON.load(open("https://vsco.co/ajxp/#{vs}/2.0/medias?site_id=#{siteId}&page=0&size=-1", 'Cookie' => "vs=#{vs};"))['media']
path = user
path = File.join options[:output], user unless options[:output].nil?
FileUtils.mkdir_p path unless File.exist? path
images.each_with_index do |r, i|
print "Image #{i + 1} of #{images.length}\r"
$stdout.flush