Geolocation 提取Tweet的地理位置

Geolocation 提取Tweet的地理位置,geolocation,tweepy,sentiment-analysis,tweetstream,Geolocation,Tweepy,Sentiment Analysis,Tweetstream,有没有办法提取推特的地理位置,即使用户没有启用该位置? 我希望收集来自特定州的推文,以便对推文进行情绪分析。 请帮忙 类StdOutListener(StreamListener):#类允许我们打印推文 def on_数据(自身、数据): full_tweet=json.load(数据) ##这可以确保你不会被截获推文 如果完整推文中有“扩展推文”: tweet\u text=full\u tweet.get('full\u text') 其他: tweet\u text=full\u twee

有没有办法提取推特的地理位置,即使用户没有启用该位置? 我希望收集来自特定州的推文,以便对推文进行情绪分析。 请帮忙

类StdOutListener(StreamListener):#类允许我们打印推文 def on_数据(自身、数据): full_tweet=json.load(数据) ##这可以确保你不会被截获推文 如果完整推文中有“扩展推文”: tweet\u text=full\u tweet.get('full\u text') 其他: tweet\u text=full\u tweet.get('text')) tweet\u time=full\u tweet.get('created\u at') tweet\u lang=full\u tweet.get('lang') 如果tweet_lang!=无和tweet_lang=='en'和tweet_text!=无和“RT@”不在tweet_文本中: ##这只是获取文本和时间戳,这使得数据库非常节省空间 tweetObject={ “文本”:tweet_文本, “时间”:推特时间, } scPrimary.insert_one(tweetObject)
返回真值

否,除非用户已启用该功能(默认为关闭),否则不可能返回,更多信息

如果该功能已启用,则在检索tweet(使用任何可用方法)时,您可以在Status对象(Tweepy API方法返回的模型)中获取此信息:

status.coordinates # ie [-49.319543, -16.679431]
status.place.full_name # ie The Netherlands
status.user.location