Skip to content

Instantly share code, notes, and snippets.

@trvsdnn
Created January 11, 2012 04:25
Show Gist options
  • Save trvsdnn/1593002 to your computer and use it in GitHub Desktop.
Save trvsdnn/1593002 to your computer and use it in GitHub Desktop.
pr0n
#!/usr/bin/env ruby
require 'open-uri'
require 'nokogiri'
page_number = 1
print "Where you wanna put it? "
folder = gets.chomp
Dir.mkdir(folder)
puts "Getting them pr0n"
loop do
page = Nokogiri::HTML(open("http://thegirlnextdoor.tumblr.com/page/#{page_number}"))
images = page.css('.stat-media-wrapper img')
threads = []
break if images.size.zero?
images.each do |img|
threads << Thread.new(img) do |img|
url = img['src']
file = "#{folder}/#{url.split('/').last}"
File.open(file, 'w') { |f| f.write(open(url).read) }
end
end
threads.each { |thread| thread.join }
puts "Got all them on page #{page_number}"
page_number += 1
end
puts "\033[31mFinished. Your pr0n is in `#{Dir.pwd}/#{folder}'... you know what to do now.\033[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment