简体   繁体   中英

Twitter API - Python , searching for tweet by date

# Initiate the connection to Twitter
twitter = Twitter(auth=oauth)

# Search for latest tweets about "pakistan"
results = twitter.search.tweets(q='pakistan',until=2008 - 08 - 19, )

print results

I am trying to retrieve tweets that are earlier than this date by one week. It does not return anything. However, I have searched manually on twitter and found that tweets exist.

When you use the Twitter API to download tweets you will have access to tweets back to roughly one week old. This is despite the fact that you can see tweets older than one week on Twitter's website. This is a built-in limitation of the API.

To have access to a bigger time span you can do the following ways:

  • download everyday data and add up gradually.
  • you can search on the web to find a dataset
  • The best way is to ask Twitter to give you the data for a specific time span while you have an API developer account. You have asked for a quote using this address: https://www.trackmyhashtag.com/twitter-dataset#request-data-form

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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