Last active
August 23, 2023 19:36
-
-
Save Konstantinusz/47d42a7cb9003e4c476d 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 | |
Any tutorial on how to use this?
Broken - errors out with 'remote filename has no length'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I used this script last in april. Now I wanted to use it again. But there is a 403 error now when the file is requested.
Do you know how to fix?