#!/usr/bin/ruby
require 'rubygems'
require 'json'
require 'hpricot'
require 'open-uri'
domain = "http://ffffound.com/"
user = "blech"
type = "found"
offset = 750
img = Array.new
while
doc = Hpricot(open(domain+"/home/"+user+"/"+type+"/?offset="+offset.to_s+"&"))
images = (doc/"blockquote.asset")
puts "Got "+images.size.to_s+" images at offset "+offset.to_s
break if (images.size == 0)
images.each do |image|
info = Hash.new
# image title
title_elem = (image/"div.title")
info[:title] = title_elem.at("a").inner_html
# original source image
src_elem = (image/"div.title")
info[:src_url] = src_elem.at("a")["href"]
# from description, break out img url, date posted (relative!), count
desc_elem = (image/"div.description")
desc = desc_elem.inner_html
info[:orig_img] = desc.gsub(/
.*/, "")
date = desc.gsub(/.*
/, "")
date = date.gsub(/