Skip to content

Instantly share code, notes, and snippets.

@fredoliveira
Created February 12, 2011 17:28
Show Gist options
  • Save fredoliveira/823891 to your computer and use it in GitHub Desktop.
Save fredoliveira/823891 to your computer and use it in GitHub Desktop.
The script I use to backup my ffffound items. Far from perfect, and the system call is quite a hack, but I was in a hurry and this does it for me.
require 'rubygems'
require 'nokogiri'
require 'open-uri'
pages = 78
username = "fred"
def grab_url(offset)
Nokogiri::HTML(open("http://ffffound.com/home/#{username}/found/?offset=#{offset}"))
end
def parse_document(doc)
doc.css('.description').each do |l|
url = "http://" + l.children[0]
url = url.split("?")[0]
`cd img; wget #{url}`
end
end
for i in 0..pages
puts "Downloading page ##{i} of ##{pages}"
parse_document(grab_url(i * 25))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment