Reputation: 130
I am interested on retrieving the number of tweets with a certain hashtag or keyword in a specific time frame. Until now, I have only came across Twitter search API, Twitter Historic search and full archive search. While those could certainly be useful, I am wondering if there is a way to get just a number response from the server, since I won't be doing anything with the tweets themselves.
Thanks for your help.
Upvotes: 0
Views: 207
Reputation:
The paid premium search APIs (30-day and full archive) provide a counts endpoint. In this example, we ask the API to provide daily counts for April to May 2020:
curl --request POST --url https://api.twitter.com/1.1/tweets/search/fullarchive/[ENV]/counts.json --header 'authorization: Bearer [BEARERTOKEN]' --header 'content-type: application/json' --data '{"query": "#cheerlights","fromDate": "202004260000","toDate": "20200526000","bucket":"day"}'
At the moment, the standard v1.1 and the new v2 search APIs do not provide counts separate from the Tweet results.
Upvotes: 1