Created
May 8, 2012 21:17
-
-
Save chrismealy/2639382 to your computer and use it in GitHub Desktop.
feedzirra_typhoeus_example
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 'feedzirra' | |
require 'typhoeus' | |
f = Feedzirra::Feed.fetch_and_parse('http://krugman.blogs.nytimes.com/feed/') | |
urls = f.entries.map &:url | |
h = Typhoeus::Hydra.new | |
urls.map do |url| | |
r = Typhoeus::Request.new(url) | |
r.on_complete {|rsp| puts rsp.body[400..500] } | |
h.queue(r) | |
end | |
h.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment