Created
March 21, 2011 20:14
-
-
Save dsyph3r/880127 to your computer and use it in GitHub Desktop.
Blog: Ruby Ruby Ruby Ruby
This file contains hidden or 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
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(/<\/?[^>]*>/, "") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very good!