I'm using a Python's Twitter API implementation, 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. (I know search-advanced is complete different from twitter streaming API)
Like follow the documentation I get the southwest coordinate first, and northeast after. 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':[-46.885064,-23.984524,-46.479943,-23.393466]}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.