Created
January 30, 2009 22:06
-
-
Save batchblue/55293 to your computer and use it in GitHub Desktop.
This file contains 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 'rubygems' | |
require 'open-uri' | |
require 'hpricot' | |
doc = open("http://rinexus.com/blog/2009/01/rhode-island-twitter-sound") { |f| Hpricot(f) } | |
twits = [] | |
(doc/'.content/p').each do |p| | |
p.inner_html.each do |line| | |
matches = line.scan(/@(\w+)/m) | |
twits.concat(matches) unless matches.empty? | |
end | |
end | |
twits.flatten! | |
twits.uniq! | |
twits.each do |twit| | |
puts twit | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment