Last active
January 1, 2019 01:37
-
-
Save xpepper/5872399 to your computer and use it in GitHub Desktop.
Revisions
-
xpepper revised this gist
Jul 15, 2013 . 1 changed file with 8 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ # username = "my_username" # pwd = "my_password" # target_path = "my_target_path" # saving auth cookie system %Q{wget --save-cookies /tmp/cookie.txt --keep-session-cookies --post-data "username=#{username}&password=#{pwd}" -O - \ https://rubytapas.dpdcart.com/subscriber/login?__dpd_cart=d08391e6-5fe2-4400-8b27-2dc17b413027} (25..600).each do |i| %x[wget -q -S --spider --load-cookies /tmp/cookie.txt https://rubytapas.dpdcart.com/subscriber/download?file_id=#{i} > spider.log 2>&1] head_log = File.read("spider.log") @@ -18,12 +18,13 @@ puts "Downloading #{name}.#{extension}..." filename = "#{name}.#{extension}" if filename =~ /.*(\d{3}).*/ target_folder = $1 target_fullpath = "#{target_path}/#{target_folder}" Dir.mkdir(target_fullpath) unless File.exist?(target_fullpath) puts "*** wget --load-cookies /tmp/cookie.txt --output-document='#{target_path}/#{target_folder}/#{name}.#{extension}' https://rubytapas.dpdcart.com/subscriber/download?file_id=#{i}" system "wget --load-cookies /tmp/cookie.txt --output-document='#{target_path}/#{target_folder}/#{name}.#{extension}' https://rubytapas.dpdcart.com/subscriber/download?file_id=#{i}" end end end end end -
xpepper revised this gist
Jun 27, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ if Dir.glob("#{target_path}/**/#{name}.#{extension}").size == 0 puts "Downloading #{name}.#{extension}..." filename = "#{name}.#{extension}" if filename =~ /.*(\d{3}).*/ target_folder = $1 puts "*** wget --load-cookies /tmp/cookie.txt --output-document='#{target_path}/#{target_folder}/#{name}.#{extension}' https://rubytapas.dpdcart.com/subscriber/download?file_id=#{i}" system "wget --load-cookies /tmp/cookie.txt --output-document='#{target_path}/#{target_folder}/#{name}.#{extension}' https://rubytapas.dpdcart.com/subscriber/download?file_id=#{i}" -
xpepper revised this gist
Jun 27, 2013 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,8 @@ # username = "my_username" # pwd = "my_password" target_path = "/Users/pierodibello/Documents/Google Drive/screencasts/RubyTapas" # saving auth cookie system %Q{wget --save-cookies /tmp/cookie.txt --keep-session-cookies --post-data "username=#{username}&password=#{pwd}" -O - \ https://rubytapas.dpdcart.com/subscriber/login?__dpd_cart=d08391e6-5fe2-4400-8b27-2dc17b413027} @@ -11,6 +12,7 @@ head_log = File.read("spider.log") if head_log =~ /Content-Disposition.*filename="(.+)\.(.+)"/ name, extension = $1, $2 puts "Processing #{name}.#{extension}..." if name && extension && !name.empty? && !extension.empty? if Dir.glob("#{target_path}/**/#{name}.#{extension}").size == 0 puts "Downloading #{name}.#{extension}..." -
xpepper revised this gist
Jun 26, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ if head_log =~ /Content-Disposition.*filename="(.+)\.(.+)"/ name, extension = $1, $2 if name && extension && !name.empty? && !extension.empty? if Dir.glob("#{target_path}/**/#{name}.#{extension}").size == 0 puts "Downloading #{name}.#{extension}..." filename = "#{name}.#{extension}" if filename =~ /.*(\d\d\d).*/ -
xpepper revised this gist
Jun 26, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # username = ... # pwd = ... target_path = "/Users/pierodibello/Documents/Google Drive/screencasts/RubyTapas" system %Q{wget --save-cookies /tmp/cookie.txt --keep-session-cookies --post-data "username=#{username}&password=#{pwd}" -O - \ https://rubytapas.dpdcart.com/subscriber/login?__dpd_cart=d08391e6-5fe2-4400-8b27-2dc17b413027} -
xpepper revised this gist
Jun 26, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ if head_log =~ /Content-Disposition.*filename="(.+)\.(.+)"/ name, extension = $1, $2 if name && extension && !name.empty? && !extension.empty? if Dir.glob("#{target_path}/**/*.#{extension}").size == 0 puts "Downloading #{name}.#{extension}..." filename = "#{name}.#{extension}" if filename =~ /.*(\d\d\d).*/ -
xpepper revised this gist
Jun 26, 2013 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # username = ... # pwd = ... # target_path = "/Users/pierodibello/Documents/screencasts/RubyTapas" system %Q{wget --save-cookies /tmp/cookie.txt --keep-session-cookies --post-data "username=#{username}&password=#{pwd}" -O - \ https://rubytapas.dpdcart.com/subscriber/login?__dpd_cart=d08391e6-5fe2-4400-8b27-2dc17b413027} @@ -12,15 +12,16 @@ if head_log =~ /Content-Disposition.*filename="(.+)\.(.+)"/ name, extension = $1, $2 if name && extension && !name.empty? && !extension.empty? if Dir.glob("#{target_path}/**/#{name}.#{extension}").size == 0 puts "Downloading #{name}.#{extension}..." filename = "#{name}.#{extension}" if filename =~ /.*(\d\d\d).*/ target_folder = $1 puts "*** wget --load-cookies /tmp/cookie.txt --output-document='#{target_path}/#{target_folder}/#{name}.#{extension}' https://rubytapas.dpdcart.com/subscriber/download?file_id=#{i}" system "wget --load-cookies /tmp/cookie.txt --output-document='#{target_path}/#{target_folder}/#{name}.#{extension}' https://rubytapas.dpdcart.com/subscriber/download?file_id=#{i}" end end end end end
-
xpepper created this gist
Jun 26, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ # username = ... # pwd = ... # AUTHENTICATION system %Q{wget --save-cookies /tmp/cookie.txt --keep-session-cookies --post-data "username=#{username}&password=#{pwd}" -O - \ https://rubytapas.dpdcart.com/subscriber/login?__dpd_cart=d08391e6-5fe2-4400-8b27-2dc17b413027} (25..600).each do |i| %x[wget -q -S --spider --load-cookies /tmp/cookie.txt https://rubytapas.dpdcart.com/subscriber/download?file_id=#{i} > spider.log 2>&1] head_log = File.read("spider.log") if head_log =~ /Content-Disposition.*filename="(.+)\.(.+)"/ name, extension = $1, $2 if name && extension && !name.empty? && !extension.empty? if Dir.glob("/Users/pierodibello/Documents/Google Drive/screencasts/RubyTapas/**/#{name}.#{extension}").size == 0 puts "Downloading #{name}.#{extension}..." filename = "#{name}.#{extension}" if filename =~ /.*(\d\d\d).*/ target_folder = $1 puts "*** wget --load-cookies /tmp/cookie.txt --output-document='/Users/pierodibello/Documents/Google Drive/screencasts/RubyTapas/#{target_folder}/#{name}.#{extension}' https://rubytapas.dpdcart.com/subscriber/download?file_id=#{i}" system "wget --load-cookies /tmp/cookie.txt --output-document='/Users/pierodibello/Documents/Google Drive/screencasts/RubyTapas/#{target_folder}/#{name}.#{extension}' https://rubytapas.dpdcart.com/subscriber/download?file_id=#{i}" end end end end end