问题
The statuses/user_timeline
part of the Twitter API returns geolocation data as "place" along with each Tweet. The search API, on the other hand, does not return this location data (as far as I can tell). Is there a way to get location data with the search API?
回答1:
There is a geo
field in each result of the search
resource (see the example in the documentation), which is a form of geolocation, but is not the exact same thing as the place
field in the statuses/user_timeline
.
Alternatively you can make another request using the id
of the result through the statuses/show/:id
resource (see documentation) which returns both the geo
and place
fields, but that would mean making one more request per result.
回答2:
Matt asked this question directly to Twitter and got a response, and the dev who answered pointed out that the JSON format does include a 'geo' attribute.
来源:https://stackoverflow.com/questions/8189368/how-to-get-location-of-tweets-with-twitter-search-api