'How do I retrieve a user's tweets of last 7 days using twitter API?

I want to pull tweets from an authenticated user's home timeline (user + people the user follows) of past 7 days. How can I do this? The documentation of GET statuses/home_timeline only provides a count parameter and some other parameters like since_id and max_id which I don't really understand.

Documentation: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/timelines/api-reference/get-statuses-home_timeline

Is there any other endpoint which might help? Or is it just impossible to do so?



Solution 1:[1]

The recent search in the Twitter v2 API can do what you are asking.

Here is an example:

https://api.twitter.com/2/tweets/search/recent?query=from:username is:verified&max_results=100

The Research Search API can only search in the last 7 days by default. You can return a maximum of 100 tweets per request.

Docs: https://developer.twitter.com/en/docs/twitter-api/tweets/search/integrate/build-a-rule

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Trace