Tweepy api.search, how to get the tweets older than 10 days?
You can't. The Twitter Search API searches against a sampling of recent Tweets published in the past 7 days.
Tweepy: get old tweets now possible with Twitter search api?
Unfortunately, you cannot access past data from Twitter. Is not a problem of what library you're using: Tweepy, Twitter4J, whatever, is just that Twitter won't provide any data that is older than more or less 2 weeks.
To get historical data you'll need access to firehose, directly through Twitter or third-party resellers like GNIP.
How to retrieve tweets from a week ago using Tweepy in API 3.9
The Twitter API itself does not support an even distribution of results on a per-day basis across a week, so you would have to implement this yourself. The count parameter only supports a maximum of 100 results per page. At the moment, your code is basically asking for 100 Tweets looking back from now.
You could try the following:
- break down your 1000 results by 7 days (to make this easier, let's make it 100 per day, so 700 Tweets total)
- create a 7 pass loop around your second block of code, and for each iteration, search for 100 results, each time making the
since
anduntil
values for the same day, so'2020-11-12'
to'2020-11-12'
,'2020-11-13'
to'2020-11-13'
, etc - in each loop iteration, append your data into the dataframe
term = 'Panamá'
is apparently unused in the code above.
Related Topics
Apt Command Line Interface-Like Yes/No Input
Most Efficient Way to Reverse a Numpy Array
Runtimeerror: This Event Loop Is Already Running in Python
When to Use Get, Get_Queryset, Get_Context_Data in Django
Python Pandas Dataframe, Is It Pass-By-Value or Pass-By-Reference
How to Handle Exceptions in a List Comprehensions
Getting Data from Ctypes Array into Numpy
What Do Backticks Mean to the Python Interpreter? Example: 'Num'
Why Do We Need to Call Zero_Grad() in Pytorch
Source Interface with Python and Urllib2
Row-Wise Average for a Subset of Columns with Missing Values
Strip/Trim All Strings of a Dataframe
Why Results of Map() and List Comprehension Are Different