buy clomid online

Nov 16

Twitter Search with Ruby

Category: Ruby,twitter

Ruby is one of the most powerful language with the number of GEM’s (Packages) that can be used to connect on every component of internet.
For twitter, GEM’s are available, one of them “twitter” can do for you what you want.
To install :

  1. $ sudo gem install twitter

Next, you can write your code to do what you want (Search for our example) .
To begin this sample, we must know some useful option for search :

  • from(“XXXX”) : to define the sender of our messages
  • to(“XXXX”) : to define the receiver of our messages
  • since_date(“YYYY-MM-DD”) : to get tweets after a given date

For more information : http://rdoc.info/github/jnunemaker/twitter/master/Twitter/Search
And our code will be :

  1. require ‘rubygems’
  2. require ‘twitter’
  3. #search for the word nihed since 01/11/2010
  4. Twitter::Search.new(‘nihed’).since_date("2010-11-01").each do |r|
  5.   puts r.from_user+": "+r.text+"\n\n"
  6. end

Like we can see, with ruby, we have a simple and beautiful code.
For more information :
http://twitter.rubyforge.org/
Twitter Search API Method

1 comment

1 Comment so far

  1. […] This post was mentioned on Twitter by Nihed MBAREK, Maghreblogs. Maghreblogs said: [Tunisie] Twitter Search with Ruby: Ruby is one of the most powerful language with the number of GEM’s (Packages… http://bit.ly/9guWFL […]

Leave a comment