Alon Gutman
Alon Gutman

Reputation: 875

in twitter api I want to know the number of tweets that match specific query

the problem is they limit the result they return to 1,500.

but I only want to know how many results there are, not to get all of them

Upvotes: 1

Views: 1595

Answers (3)

eli
eli

Reputation: 5147

You can use the Twitter Count API:

http://urls.api.twitter.com/1/urls/count.json?url=www.apple.com&callback=twttr.receiveCount

Response:

twttr.receiveCount({"count":2596822,"url":"http://www.apple.com/"})

Note: this is not officially support by Twitter, so use at your own risk.

Upvotes: 1

abraham
abraham

Reputation: 47923

There is no way to know this without using the Streaming API to track the keywords you want an maintaining your own count. The Search API only contains data for about the last 7-14 days depending on tweet volume so even if you did paginate through all available tweets you would only have a recent count.

Upvotes: 2

acconrad
acconrad

Reputation: 3219

There's a pretty easy tutorial on grabbing Tweet counts why you can do using JSON and the TweetMeme API.

$.getJSON('http://api.tweetmeme.com/url_info.jsonc?url='+url+'&callback=?', function(data) { $('#twitter').append(beforecounter + data.story.url_count + aftercounter); });

where the url variable corresponds to the url in the query you are matching.

Upvotes: 0

Related Questions