JustAnotherArchivist / snscrape

A social networking service scraper in Python
GNU General Public License v3.0
4.47k stars 708 forks source link

How to use bounding cooridinates as filter option in snscrape.modules.twitter #235

Closed devilzhoukan closed 3 years ago

devilzhoukan commented 3 years ago

Hi, I am doing my capstone project about Twitter tweets. Your tool really helps. Now I meet some issue. From blogs online I know I can use geocode as geocode: "'34.052235, -118.243683, 10km'"

But I'd like to search with bounding coordinates, as Alabama | -88.473227 | 30.223334 | -84.889080 | 35.008028. And I want to search for the tweets inside this rectangle scope with some keywords. Is there any existing APIs for this feature?

Thanks a lot.

devilzhoukan commented 3 years ago

I also meet issues on how to using multiple options together, for now, I need to use keywords, timestamps, and coordinates as filters. I really appreciate it if you can provide an example here.

JustAnotherArchivist commented 3 years ago

You'd have to translate that bounding box to a 'place object ID' first and then use the place:x filter. Twitter's API has a search endpoint for that translation, but snscrape doesn't use the API; maybe you can do it with tweepy, but I have no experience with that. Also note the general remarks about geofiltering in #145.