[英]Twitter API Streaming by Locatons
I'm using a Python's Twitter API implementation, TwitterAPI. 我正在使用Python的Twitter API实现TwitterAPI。
I'm trying get tweets from a specific city (São Paulo), in the Twitter Advanced Search( https://twitter.com/search-advanced ) website is easy, but when I try to do it using streaming, never returns any tweet. 我正在尝试从特定城市(圣保罗)获取推文,在Twitter高级搜索( https://twitter.com/search-advanced )网站中很简单,但是当我尝试使用流媒体发送时,从不返回任何内容鸣叫。 (I know search-advanced is complete different from twitter streaming API)
(我知道高级搜索与Twitter流API完全不同)
Like follow the documentation I get the southwest coordinate first, and northeast after. 像按照文档所述,我首先获取西南坐标,然后获取东北坐标。 https://dev.twitter.com/streaming/overview/request-parameters#locations
https://dev.twitter.com/streaming/overview/request-parameters#locations
#!/usr/bin/python
import pprint from TwitterAPI import TwitterAPI
pp = pprint.PrettyPrinter(depth=6)
api = TwitterAPI(CONSUMER_KEY,
CONSUMER_SECRET,
ACCESS_TOKEN_KEY,
ACCESS_TOKEN_SECRET)
r = api.request('statuses/filter', {'locations':'-23.984524,-46.885064,-23.393466,-46.479943'})
for item in r:
pp.pprint(item)
But I never got any tweet, what I'am doing wrong ? 但是我从来没有收到任何推文,我做错了什么?
You have the latitudes and longitudes reversed. 您的经纬度反转了。 Try:
尝试:
r = api.request('statuses/filter', {'locations':'-46.885064,-23.984524,-46.479943,-23.393466'})
The locations
parameter takes longitude/latitude pairs. locations
参数采用经度/纬度对。
将位置用作浮点值列表是否有帮助?
{'locations':[-46.885064,-23.984524,-46.479943,-23.393466]}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.