这是目前推特上的热门话题
#PakistanReject_Israel
拥有超过47K条推文。但当我试图通过Tweepy获取推文时,它只收到948条推文。和Process finished with exit code 0
我的代码有什么问题吗?Tweepy有什么限制吗?使用相同的代码,我在一次运行中,通过另一次搜索查询,获得了超过6万条推文
这是密码
max_tweets = 200000
filname= createtime+"PakistanReject_Israel"
text_query = ('#PakistanReject_Israel')
date_since= "2020-11-20"
jsonFile = open(filname+'.json', "a",encoding='utf-8')
try:
for tweet in tweepy.Cursor(api.search,q=text_query,lang="en",since=date_since,tweet_mode='extended').items(max_tweets): #,lang="en"
json_str = json.dumps(tweet._json, ensure_ascii=False, indent=4)
jsonFile.write(json_str)
except ConnectionError as e:
print("Some Problem happened %s Tweets are fetched" % count)
print(e)
finally:
jsonFile.close()
目前没有回答
相关问题 更多 >
编程相关推荐