Skip to content

Instantly share code, notes, and snippets.

@dsyph3r
Created March 21, 2011 20:14
Show Gist options
  • Save dsyph3r/880127 to your computer and use it in GitHub Desktop.
Save dsyph3r/880127 to your computer and use it in GitHub Desktop.
Blog: Ruby Ruby Ruby Ruby
require 'rss/1.0'
require 'rss/2.0'
require 'open-uri'
require 'cgi'
source = "http://feeds.urbandictionary.com/UrbanWordOfTheDay"
content = ""
open(source) do |s| content = s.read end
rss = RSS::Parser.parse(content, false)
# Grab the title and description, striping out html tags
word = rss.items[0].title;
definition = CGI.unescapeHTML(rss.items[0].description).gsub(/<\/?[^>]*>/, "")
@MattCraftsCode
Copy link

Very good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment