I am starting to make a python program to get user locations, I’ve never worked with the twitter API and I’ve looked at the documentation but I don’t understand much. I’m using tweepy, can anyone tell me how I can do this? I’ve got the basics down, I found a project on github on how to download a user’s tweets and I understand most of it.
Question posted in Twitter API
The official Twitter API documentation can be found here.
The official Twitter API documentation can be found here.
3
Answers
I don’t believe that Tweepy can get user location data; have you had a look the documentation?
You may be better off with Twython which can call the get statuses/user_timeline API call?
Also bear in mind that for privacy reasons twitter won’t give you a lat/long for users; the user has their location made less accurate, usually referencing their “neighborhood”.
Once you have the twitter (JSON) search results, you can extract the location information, if it’s available. Not all twitter users have included their location information.
After analyzing the twitter API responses for various queries, I think getting the tweet location is not possible since the API does not include it in the JSON response.
Once you have a tweet, the tweet includes a user, which belongs to the user model. To call the location just do the following