Reputation: 1082
My code is here
require 'twitter'
search = Twitter::Search.new.containing("obama")
it returns us
#<Twitter::Search:0xb6881f9c @proxy=nil, @gateway=nil, @format=:json, @search_endpoint="https://search.twitter.com/", @consumer_key=nil, @adapter=:net_http, @endpoint="https://api.twitter.com/1/", @oauth_token_secret=nil, @query={:q=>["obama"], :tude=>[]}, @oauth_token=nil, @consumer_secret=nil, @user_agent="Twitter Ruby Gem 1.6.2", @cache=nil>
I want to search only public tweets that contain obama
How can i do this
Upvotes: 3
Views: 2581
Reputation: 1451
Did you try
Twitter.search('Obama')
or
Twitter.search('Obama', options = {})
Also I noticed you are missing Authentication atributes. Take a look into Twitter API Doc to make sure you have all the 'required' params.
PS: Do you want to search all the tweets that contains the string 'Obama' or all tweets with #Obama. The search result-set and the accuracy is different for both the searches.
Upvotes: 1