Tweepy - exclude retweets from search results

tweepy

#1

Hi all,
I am using Tweepy to access the Twitter REST service and request tweets that include a certain search term. I can generate search results using tweepy.Cursor, specifying api.search (and the search term) in the parameters.

The problem is that I have been unable to exclude retweets from my search results. There is an api.retweets method in the Tweepy docs, but I’m not a developer and haven’t found the correct way to use this (or if in fact it’s the right method for me to use). My goal is to have something like the following:

for status in tweepy.Cursor(api.search, q='your_search', lang='en').items(100):
    if status.retweet='False':
    print (status.text)

which in theory would return only “original” tweets - which is my objective.
I’d really appreciate any guidance regarding how to use the Tweepy api to accomplish this…
Thanks so much


#2

Try this :

for status in tweepy.Cursor(api.search, q='your_search -filter:retweets', lang='en').items(100):
    if status.retweet='False':
    print (status.text)