The formula for extracting a timestamp from a tweet ID is a one-way process, and reversing the formula to extract a tweet ID from the timestamp results in an incorrect ID being generated, one that 99% of the time does not correlate to a valid tweet. Given the incredibly large number of tweets posted every second, are there any ways to find a few valid tweet IDs in a specific range of time through the tweepy API v2?
You can still use generated snowflake IDs as values in since_id and until_id so you can use those in the search endpoint to make sure you get some results within those. Or alternatively use the timestamps you extracted to search. GET /2/tweets/search/recent | Docs | Twitter Developer Platform
If you only need a few, you can manually search on web by date: https://twitter.com/search-advanced
That works for retrievals with a query, but how would I be able to pull random tweets with just timestamp alone? (I need to do it in code)
Why do you need that in the first place?
Just want to collect random data from twitter for a little personal project I’m working on. All I want is to get a few random tweets from each day via tweepy.
1 Like
Oh, you’re better off using sample stream for this: StreamingClient — tweepy 4.12.1 documentation you’ll get a lot of random tweets quickly