How to get location of Tweets with Twitter search API

*爱你&永不变心* 提交于 2021-02-18 11:37:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!