question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting Tweets within a particular location?

See original GitHub issue

Is there any way to get tweets within a particular city, or latlon with a radius?

I’ve been using this, particularly the --geocode flag as used in the twarc docs.

twarc2 search --archive --max-results 100 --start-time "2019-01-01" --end-time "2019-01-30" "vegan OR plant-based OR plant based OR veganism -is:retweet --geocode 53.763208,-2.699540,3mi" dataPreston.jsonl

It seems to get data from all over the place, over 1.2 million tweets for that month.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
joseph-allencommented, Sep 29, 2021

I did both a place search, and a point search in the end

twarc2 search --archive --start-time "2019-01-01" --end-time "2019-01-30" '(vegan OR plant-based OR "plant based" OR veganism) point_radius:[-0.127758 51.507351 5mi]' londonGeoPointRadius.jsonl
twarc2 search --archive --start-time "2019-01-01" --end-time "2019-01-30" '(vegan OR plant-based OR "plant based" OR veganism) place:london' londonGeoPlace.jsonl

We could add a simpler

twarc2 search --archive 'vegan point_radius:[-0.127758 51.507351 5mi]' londonGeoPointRadius.jsonl
twarc2 search --archive 'vegan place:london' londonGeoPlace.jsonl
1reaction
igorbrigadircommented, Oct 13, 2021

@joseph-allen the query:

"vegan OR vegetarian OR plant-based point_radius:[-0.127758 51.507351 5mi] -is:retweet"

is ambiguous because of how OR clauses are interpreted - a space is an implicit AND, so you need to surround the OR clauses with () parentheses, see https://developer.twitter.com/en/docs/twitter-api/tweets/search/integrate/build-a-query#order-of-operations

Your query should be:

"(vegan OR vegetarian OR plant-based) point_radius:[-0.127758 51.507351 5mi] -is:retweet"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Filtering Tweets by location | Docs | Twitter Developer Platform
place : Filter for specific Places by their name or ID. To discover “Places” associated with a specific area, use Twitter's reverse_geocode endpoint...
Read more >
How to get tweets from a specific location like USA
Hi everyone, I'm using the tweepy package with Twitter v2 API. I'm trying to get tweets on a particular topic only originating from...
Read more >
How to get tweets from a specific location - YouTube
how to get tweets from a specific location Code: [[ geocode:latitude,longitude,radius ]]
Read more >
How To Track Tweets by Geographic Location - BMC Software
You track Tweet by location, language, and text by passing the three arrays shown below into the stream.filter() method of Tweepy, which is...
Read more >
Filtering Tweets by Location - Towards Data Science
Upon getting a Tweet, I get the Account Location attribute and use regular expressions to check if it's a US Location. Tweets that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found