Last active
April 28, 2019 09:09
-
-
Save Konstantinusz/70361fdd430bf52eabcccc668867c8f1 to your computer and use it in GitHub Desktop.
Script to save your photos from imagebam (site will be closed soon). It uses the script imagebam_dl to download the galleries, just put it on the path. It also saves meta informations of galleries into JSON file. You must provide your login and password as arguments in this order.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require "json" | |
require "peach" rescue nil | |
felh=ARGV[0] | |
jelsz=ARGV[1] | |
%x{curl 'http://www.imagebam.com/login' -s -c ~/imagebam-cookie.txt -H 'User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36' -H 'Referer: http://www.imagebam.com/login' --data "action=true&nick=#{felh}&pw=#{jelsz}"} | |
ret=%x{curl 'http://www.imagebam.com/sys/gallerybrowser/getData/' -b ~/imagebam-cookie.txt -H 'Pragma: no-cache' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36 OPR/43.0.2442.806' -H 'Content-Type: text/plain; charset=utf-8' -H 'Accept: */*' -H 'Referer: http://www.imagebam.com/gwt/gallerybrowser/FC785CCD0E5C531F9C9EB53A9C0334E9.cache.html' -H 'Connection: keep-alive' -H 'Cache-Control: no-cache' --compressed -L} | |
data=JSON.load(ret) | |
data.each{|z| | |
puts z.inspect | |
if File.exists?(z["GID"]) && File.exists?("#{z["GID"]}/desc.json") then | |
STDERR.puts "skipping #{z["GID"]}" | |
next | |
end | |
%x{imagebam_dl http://www.imagebam.com/gallery/#{z["GID"]}} | |
File.write("#{z["GID"]}/desc.json",JSON.pretty_generate(z)) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment