-
-
Save vaginessa/15a0a70b4fe064635fc644515102e144 to your computer and use it in GitHub Desktop.
1fichier.com premium download script
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 | |
#http://premium-leechers.blogspot.com | |
require "cgi" | |
require "clipboard" | |
if ARGV.size != 3 then | |
STDERR.puts "premium-leechers.blogspot.com" | |
STDERR.puts "1fichier premium downloader script." | |
STDERR.puts "Usage: ruby 1f <email> <password> <txt file with links|1fichier link|'clipboard'>" | |
exit | |
end | |
email=CGI.escape(ARGV[0]) | |
pass=CGI.escape(ARGV[1]) | |
infile=ARGV[2] | |
dl = (ARGV[3]=="wget" ? "wget" : "curl") | |
if infile =~ /1fichier/ then | |
links = infile.split | |
elsif infile == 'clipboard' then | |
links = Clipboard.paste.scan(/(https?\:\/\/[a-z0-9]+\.1fichier.com)/i).flatten.uniq | |
else | |
links = open(infile,"r") { |f| | |
f.readlines.map{|z| z.chomp.strip}.grep(/^[^#].*1fichier/) | |
} | |
end | |
STDERR.puts links | |
if dl=="wget" then | |
ret=%x{wget -q --save-cookies ~/.1fichier-cookie --post-data "mail=#{email}&pass=#{pass}<=on&Login=Login" -O - https://1fichier.com/login.pl 2>&1} | |
elsif dl=="curl" then | |
ret=%x{curl -c ~/.1fichier-cookie -d "mail=#{email}&pass=#{pass}<=on&Login=Login" https://1fichier.com/login.pl 2>&1} | |
end | |
logged_in=ret.scan(/\<br\/\>(You are logged in. This page will redirect you.)/i).flatten[0] | |
if logged_in == nil then | |
STDERR.puts "Email / password doesn't match!" | |
exit | |
else | |
STDERR.puts "Logged in." | |
end | |
links.each do |l| | |
if dl=="wget" then | |
fname_to_save=%x{wget -O - #{l} 2>&1}.scan(/Filename \:\<\/th\>\<td\>(.*?)\<\/td\>\<\/tr\>/).flatten[0] | |
elsif dl=="curl" then | |
fname_to_save=%x{curl #{l} 2>&1}.scan(/Filename \:\<\/th\>\<td\>(.*?)\<\/td\>\<\/tr\>/).flatten[0] | |
end | |
STDERR.puts "Downloading file #{l}/#{fname_to_save} ..." | |
if dl=="wget" then | |
%x{wget -c --progress=bar:force --no-check-certificate --load-cookies ~/.1fichier-cookie -O "#{fname_to_save}" #{l} } | |
elsif dl=="curl" then | |
%x{curl -b ~/.1fichier-cookie -"#" -L -k -o \"#{fname_to_save}\" #{l}} | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment