I found a way using purely Python to get the coordinates for tweets using a word filter. It doesn't seem like many people include location with their tweets.
This might not be what you're after either because this is live streaming data. You can test it by putting a unique filter word and then tweeting that word from your Twitter account. You will see your tweet show up in Python almost instantly. This would be pretty cool to use for some huge event.
You'll need to install Tweepy.
pip install tweepy
And get a Twitter API Key.
Then you can use this script as a template:
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
#Enter Twitter API Key information
consumer_key = ''
consumer_secret = ''
access_token = ''
access_secret = ''
file = open("C:\\Output.csv", "w")
data_list = 
count = 0
def on_data(self, data):
#How many tweets you want to find, could change to time based
if count <= 2000:
json_data = json.loads(data)
coords = json_data["coordinates"]
if coords is not None:
lon = coords["coordinates"]
lat = coords["coordinates"]
file.write(str(lon) + ",")
file.write(str(lat) + "\n")
count += 1
def on_error(self, status):
auth = OAuthHandler(consumer_key, consumer_secret)
twitterStream = Stream(auth, listener())
#What you want to search for here
Check out this documentation from Twitter too, it shows what you can put in the filter.
Here's the result of putting the filter as "Halloween" for a few minutes:
And for the hell of it, here's the first 2000 tweets that mentioned Halloween!