简体   繁体   English

如何使用tweepy获得一周的旧推文?

[英]How to get one week older tweets using tweepy?

I am getting tweets from the user using twitter search api ie tweepy. 我正在使用Twitter搜索API从用户那里获得推文,即tweepy。 I get tweets of one day but now i want to get one week older tweets. 我收到一天的推文,但现在我想获得一个星期的旧推文。 I have tried to get older tweets by this code but i am unable to get old tweets. 我试图通过此代码获取较旧的推文,但无法获取旧的推文。 Any help will be highly appreciated 任何帮助将不胜感激

for tweet in tweepy.Cursor(api.search,q="#afridi",count=100,\
                       lang="en",\
                       since_id=2016-05-25).items():
print tweet.created_at, tweet.text

No other way if you do not know the since_id of the tweet of just one week older tweet. 如果您不知道仅早于一周的推文的推文的since_id,就没有其他方法。 To get older tweets you can let the code run for a while and check the dates of the tweets you are getting. 要获取较旧的推文,您可以让代码运行一段时间,然后检查获取的推文的日期。 Process those tweets as you want which are 1 week older or so. 根据需要处理那些大约1周左右的推文。 Else if you know since_id then put the since_id. 否则,如果您知道since_id,则放入since_id。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM