Skip to content

Instantly share code, notes, and snippets.

@lewisou
Created April 28, 2012 02:39
Show Gist options
  • Save lewisou/2515222 to your computer and use it in GitHub Desktop.
Save lewisou/2515222 to your computer and use it in GitHub Desktop.
An example to fetch feeds.
# Add this line into your Gemfile.
gem 'feedzirra', '~> 0.0.24'
# Fetch and Parse, we take javascript weekly as an example.
feed = Feedzirra::Feed.fetch_and_parse('http://javascriptweekly.com/rss')
# Basic information of the feed.
feed.title
feed.url
feed.feed_url
feed.etag
feed.last_modified
# Get the content
rs = []
feed.entries.each do |ent|
rs << ent.content
end
# Then we can store them all to database or scrape words or images we need.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment