python - How to get tweets of a particular hashtag in a location in a tweepy? -
i wish obtain tweets of particular hashtag a particular location chennai analysing data. i'm new twitter api , tweepy. found search url : https://api.twitter.com/1.1/search/tweets.json?q=%23cricket&geocode=-22.912214,-43.230182,1km&lang=pt&result_type=recent
how same in tweepy ? code far :
import tweepy ckey = "" csecret = "" atoken = "" asecret = "" oauth_keys = {'consumer_key':ckey, 'consumer_secret':csecret, 'access_token_key':atoken, 'access_token_secret':asecret} auth = tweepy.oauthhandler(oauth_keys['consumer_key'], oauth_keys['consumer_secret']) api = tweepy.api(auth) crictweet = tweepy.cursor(api.search, q='cricket').items(10) tweet in crictweet: print tweet.created_at, tweet.text, tweet.lang
you need use geocode
parameter in tweepy. using lat/long/radius search url, cursor should defined so:
tweepy.cursor(api.search, q='cricket', geocode="-22.9122,-43.2302,1km").items(10)
see tweepy api.search
documentation more information on parameters can include in search.
Comments
Post a Comment