Created
January 27, 2010 00:39
-
-
Save rixth/287419 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
#!/usr/bin/ruby | |
# Search a users previous 3200 for a keyword. | |
unless ARGV.size == 2 | |
puts "USAGE: look-for-tweet.rb username terms" | |
Process.exit | |
end | |
username = ARGV.first | |
terms = ARGV.last | |
require 'rexml/document' | |
for i in (1..1000) do | |
xml = `curl -s "http://twitter.com/statuses/user_timeline/#{username}.xml?count=200&page=#{i}"` | |
doc = REXML::Document.new(xml) | |
num_tweets = 0 | |
doc.elements.each('statuses/status') do |e| | |
puts e.elements["text"].text if e.elements["text"].text[term] | |
++num_tweets | |
end | |
Process.exit unless num_tweets | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment