How can I get tweets older than a week (using tweepy or other python libraries)

后端 未结 8 515
予麋鹿
予麋鹿 2020-11-27 02:55

I have been trying to figure this out but this is a really frustrating. I\'m trying to get tweets with a certain hashtag (a great amount of tweets) using Tweepy. But this do

相关标签:
8条回答
  • 2020-11-27 03:36

    use the args "since" and "until" to adjust your timeframe. You are presently using since_id which is meant to correspond to twitter id values (not dates):

    for tweet in tweepy.Cursor(api.search,
                               q="test",
                               since="2014-01-01",
                               until="2014-02-01",
                               lang="en").items():
    
    0 讨论(0)
  • 2020-11-27 03:40

    You cannot use the twitter search API to collect tweets from two years ago. Per the docs:

    Also note that the search results at twitter.com may return historical results while the Search API usually only serves tweets from the past week. - Twitter documentation.

    If you need a way to get old tweets, you can get them from individual users because collecting tweets from them is limited by number rather than time (so in many cases you can go back months or years). A third-party service that collects tweets like Topsy may be useful in your case as well (shut down as of July 2016, but other services exist).

    0 讨论(0)
提交回复
热议问题