Initial commit
This commit is contained in:
commit
d32915b2da
|
@ -0,0 +1,14 @@
|
|||
vsco-dl
|
||||
=======
|
||||
|
||||
dependency-less ruby script that downloads - [in other words, steals](https://nakedsecurity.sophos.com/2017/09/12/why-are-redditors-ripping-images-from-instagram-because-they-can/) - all the images on a vsco user's account (including metadata)
|
||||
|
||||
usage
|
||||
-----
|
||||
ruby vsco-dl.rb username
|
||||
|
||||
y tho
|
||||
-----
|
||||
¯\\_(ツ)_/¯
|
||||
|
||||
s/o to the [instagram archiving project on /r/DataHoarder](https://www.reddit.com/r/DataHoarder/comments/5m36zr/distributed_archivingsnapshots_of_instagram/), which is what inspired me to write this in the first place
|
|
@ -0,0 +1,32 @@
|
|||
require 'json'
|
||||
require 'open-uri'
|
||||
|
||||
user = ARGV[0]
|
||||
Dir.mkdir user unless File.exist? user
|
||||
|
||||
# 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]
|
||||
siteId = JSON.parse(/window.VSCOVARS.SiteSettings = ({.*})/.match(initial.read).captures[0])['id']
|
||||
|
||||
images = JSON.load(open("https://vsco.co/ajxp/#{vs}/2.0/medias?site_id=#{siteId}&page=0&size=-1", 'Cookie' => "vs=#{vs};"))['media']
|
||||
|
||||
images.each_with_index do |r, i|
|
||||
print "Image #{i + 1} of #{images.length}\r"
|
||||
$stdout.flush
|
||||
|
||||
unless File.exist? "#{user}/#{r['upload_date']}.json" and File.exist? "#{user}/#{r['upload_date']}.jpg"
|
||||
File.open "#{user}/#{r['upload_date']}.json", 'w' do |file|
|
||||
file.write JSON.pretty_generate r
|
||||
end
|
||||
open "https://#{r['responsive_url']}" do |f|
|
||||
File.open "#{user}/#{r['upload_date']}.jpg", 'wb' do |file|
|
||||
file.write f.read
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (i + 1) == images.length
|
||||
puts "Image #{i + 1} of #{images.length} ...done!"
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue