# Download images from ffffound and add to random desktop images. # Install: # Add to cron # Create "FFFFound" directory in ~/Pictures/ # Happiness ensues #!/usr/bin/env ruby require 'rubygems' require 'nokogiri' require 'open-uri' require 'fileutils' module FFFFound class << self def find dispatch! doc = Nokogiri::HTML(@response) doc.css("img[@id*='asset']").map do |img| img.attributes['src'] end end private def dispatch! @response = open('http://ffffound.com') end end end FFFFound.find.each do |img| path = "/Users/#{`whoami`.strip!}/Pictures/FFFFound/" save_path = path + File.basename(img) unless File.exists? save_path puts "Downloading #{img}" File.open(save_path, 'w') {|f| f.write(open(img).read) } end end