Reputation: 37
I'm a beginner on Python and am having an issue that I can't resolve on my first project using the API Tweepy. Here's the code :
count = 0
for tweet in tweepy.Cursor(api.search, q = "#mykeyword follow -filter:retweets filter:verified", tweet_mode='extended').items(10):
count+=1
print(f" Tweet n°{count}, Utilisateur = {tweet.user.name}, Tweet = {tweet.full_text}")
I would like this script to return the 10 last tweets containing the hashtag "mykeyword" and "follow" from verified accounts, filtering out every retweets. It works well when I keep either "-filter:retweets" or "filter:verified" but returns no results if I keep both, even though there should be some results. I have already tested some answers I found on Stackoverflow but most of them are quite outdated and the Tweepy documentation doesn't seem to cover my problem.
Does anyone have an idea about this matter ?
Thanks !
Upvotes: 0
Views: 705
Reputation: 199
I just tried this convention
filter:media AND -filter:retweets
and it worked for my use case.
Upvotes: 1