Created
April 28, 2012 02:39
-
-
Save lewisou/2515222 to your computer and use it in GitHub Desktop.
An example to fetch feeds.
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
# 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