Class Index [+]


twitterscour gem

This gem is on Gemcutter, simply type “gem install twitterscour” to install it.

Code is available on github at

Class for retrieving lists of tweets. For user tweet searches, this gem uses the actual Twitter web pages rather than the API. The API that other twitter gems use returns only what Twitter considers the “most popular” tweets in many cases, this returns all tweets that you can see if you go to the web page directly. TwitterScour is the main class to use. There is no need to instantiate it, two class methods are provided to search for tweets. These will return an array of Tweet objects. Location info can be retrieved on tweets as well.

WARNING - the user tweet search capability should probably not be relied upon for a production system. Because it uses the structure of the Twitter web pages as they are now, it could break if Twitter changes the structure of their web page. Unlike the API, which the search term search uses, Twitter makes no guarantees of consistency for their web pages.

Note that this gem needs the gems HTTParty, Nokogiri, and json_pure. HTTParty should install without any trouble when you install this. For Nokogiri, follow the instructions here to install if you get an error:


Get the 40 most recent tweets from me (@sowersb), with location info on all tweets:

require 'twitterscour'
brent_tweets = TwitterScour.from_user('sowersb', 2, true)

Get the 45 most recent tweets with the term Ruby in the tweet.

require 'twitterscour'
ruby_tweets = TwitterScour.search_term('Ruby', 3)


Brent Sowers (


You’re free to do whatever you want with this

To post comments about this gem, visit my blog post at

See more gems by me, my blog posts, etc. at


Generated with the Darkfish Rdoc Generator 2.