From 233ebb78d8444625eef9d0ab9e76882cb92428ba Mon Sep 17 00:00:00 2001 From: Nick/Nelson Date: Wed, 20 Sep 2017 02:36:04 +0000 Subject: [PATCH] Wait for account info to create the folder --- vsco-dl.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vsco-dl.rb b/vsco-dl.rb index 43c28cb..263b310 100644 --- a/vsco-dl.rb +++ b/vsco-dl.rb @@ -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