Created
February 22, 2009 20:19
-
-
Save adam/68597 to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'uri' | |
require 'open-uri' | |
require 'hpricot' | |
require 'net/http' | |
require 'ftools' | |
## it's pretty disgusting that that I require this many things. Someone fork me and fix me. | |
URL = "http://www.socwall.com/php/rss_RecentWPs.php" # widescreen pictures | |
DIR = "/path/to/wherever/you/want/to/put/the/pictures" | |
doc = Hpricot(open(URL)) | |
(doc/"item/guid").each do |photo| | |
uri = URI.parse(photo.inner_html.strip.gsub(" ", "%20")) | |
filename = uri.path.split("/").last | |
`cd #{DIR} && curl -sO #{uri.to_s}` unless File.exists?(File.join(DIR, filename)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment