igorbrigadir/twitter-advanced-search

Getting tweets from the specific country

sufyanhamid opened this issue · 3 comments

Hi @igorbrigadir .
What would the query if I want to get the details of some hashtag and I want to just keep the tweets of USA OR some other country. It is possible to cover whole country in one query OR the only option to cover the country is with respect to different regions?

Thanks in Advance for your kind Guidance :)

Yes, you can use a place query like place:96683cc9126741d1 for USA for example, but you need to know the place ID for the country you're interested in.

Unfortunately the way to find the correct place ID for a country is to use the API https://developer.twitter.com/en/docs/twitter-api/v1/geo/places-near-location/api-reference/get-geo-search

Now twarc has this feature to search for places now:

twarc2 places --granularity country "us"
Uzbekistan [id=8f3fa3e2dedc1db5]
United States [id=96683cc9126741d1]
United States Minor Outlying Islands [id=08fbcf4cbc4bc5b9]
twarc2 places --granularity country "canada"
Canada [id=3376992a082d67c7]

So you can make the search:

(place:96683cc9126741d1 OR place:3376992a082d67c7) "maple syrup" filter:media

https://twitter.com/search?q=(place%3A96683cc9126741d1%20OR%20place%3A3376992a082d67c7)%20%22maple%20syrup%22%20filter%3Amedia&src=typed_query&f=live

Thanks @igorbrigadir for sharing!