Dr T
Dr T

Reputation: 524

Get ALL tweets (Call Python tweepy.Cursor(api.search without a q parameter)

I have some Python code to get all tweets about a specific subject in a certain language:

tweepy.Cursor(api.search,  
              q="Giraffes",
              since="2015-10-10", 
              until="2015-10-11",
              count=100).items())

I want to remove the q= part so that I am saying get me ALL tweets from such and such date.

I know this will return tons of tweets etc, i know that, but we can just ignore that problem as I will be filtering on language and other things so I dont expect to get tons and tons of results.

If I remove the q= part I get an error.

Any advice much appreciated.

Upvotes: 3

Views: 24691

Answers (2)

Shashank Tiwari
Shashank Tiwari

Reputation: 31

can't help much about removing the query part.. try q="". But if you want tweets in a specific language, you can use tweets = tweepy.Cursor(api.search, q="Giraffe", since = "2020-06-05", until = "2020-06-21",lang="en") this will fetch you tweets posted in English. I hope it helps.

Upvotes: 0

Aziz Alto
Aziz Alto

Reputation: 20381

When you use api.search, it expects a search query. To get tweets without a keyword (that is without q=), you may try something like:

1) api.user_timeline with a screen_name= or

2) api.home_timeline returns the time_line tweets of the API account.

Example:

tweepy.Cursor(api.user_timeline, screen_name=USER).pages()

or

tweepy.Cursor(api.home_timeline).pages()

Upvotes: 3

Related Questions