mrtasln
mrtasln

Reputation: 614

How to get all tweets from certain country by using Twitter API?

I want to get all tweets from my country.I tried to get all tweet by using Standart api search method. But it has some rule and limit. I want to do it limitless. Which api method can i use?

Upvotes: 1

Views: 1630

Answers (2)

Yoana G
Yoana G

Reputation: 600

If you'd like to get all tweets for the past 7 days you could easily do it with standard API with a geocode cursor search for your country (if you specify language would be better). It will take some time as it will wait 15 minutes everytime it reaches the request limit for 15 min window. You could easily get a million tweets if you run it for 3 - 4 days.

If you need tweets more than 7 days ago you will need premium api but I wouldn't recommend it.

First of all, it is extremely expensive and second, it has a monthly limit of requests. (i am not sure how many but I reckon something about 500). Which means it will actually take you longer than waiting for the 15min rate limit every time.

Upvotes: 3

JeffProd
JeffProd

Reputation: 3148

Use the Premium search API :

https://developer.twitter.com/en/docs/tweets/search/api-reference/premium-search.html

You will be able to search for all tweets since 2006... it may be a lot.

The "query" parameters are listed here : https://developer.twitter.com/en/docs/tweets/search/overview/premium#AvailableOperators so you can filter by lang or with geospatial operators.

Upvotes: 1

Related Questions