Skip to content

Instantly share code, notes, and snippets.

@gbelote
Created July 1, 2010 04:25
Show Gist options
  • Save gbelote/459575 to your computer and use it in GitHub Desktop.
Save gbelote/459575 to your computer and use it in GitHub Desktop.
Grab a random lolcat from cheezburger.com
## Grab random lolcat URL
url = URI.parse('http://api.cheezburger.com/xml/category/cats/lol/random')
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) do |http|
http.request(req)
end
r = /.*<LolImageUrl>([^<]*)<\/LolImageUrl>.*/m
m = r.match( res.body )
lolcat = m[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment