如何使用Twitter搜索API获取推文的位置 [英] How to get location of Tweets with Twitter search API

查看:131
本文介绍了如何使用Twitter搜索API获取推文的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Twitter API的 statuses/user_timeline 部分将地理位置数据与每个Tweet一起返回为位置".另一方面,搜索API不会返回此位置数据(据我所知).有没有办法使用搜索API获取位置数据?

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?

推荐答案

search 资源的每个结果中都有一个 geo 字段(请参见文档),这是地理定位的一种形式,但并不完全相同在 statuses/user_timeline 中的 place 字段中.

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.

或者,您可以通过 statuses/show/:id 资源使用结果的 id 发出另一个请求(请参见

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.

这篇关于如何使用Twitter搜索API获取推文的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆