Hi, I'm developing an application using the Twitter Ruby gem in Rails, and was wondering whether there was a way to return the number of tweets containing a certain hashtag?
I'm looking to display random tweets on a page which contain a particular hashtag (I know there are issues with hashtag abuse, but this is an internal application) when being pulled in from a Twitter Search API call. I can display a random tweet using the following code, but how would you go about modifying it so that the maximum random is the number of search results? So if there were 2500 results on one query but 30,000 on another, is there a way to change the random max dynamically based on the number available? >> search.hashtag("somehashtag").since_id("2011-01-01").until_date("2011-01-11").result_type("recent").per_page(1).page(rand(1500)) Setting the random as 1,000,000 and then looping through when you hit an HTTP error probably isn't the best approach ;) Thanks for any help! Steve -- Twitter developer documentation and resources: http://dev.twitter.com/doc API updates via Twitter: http://twitter.com/twitterapi Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list Change your membership to this group: http://groups.google.com/group/twitter-development-talk