Twitter API: How to exclude retweets when searching tweets using Twython
<p>I'm trying to exclude <code>retweets</code> and <code>replies</code> in my <code>Twython</code> search.</p>

<p>Here is my code:</p>

<pre><code>from twython import Twython, TwythonError

app_key = "xxxx"
app_secret = "xxxx"
oauth_token = "xxxx"
oauth_token_secret = "xxxx"   

naughty_words = [" -RT"]
good_words = ["search phrase", "another search phrase"]
filter = " OR ".join(good_words)
blacklist = " -".join(naughty_words)
keywords = filter + blacklist

twitter = Twython(app_key, app_secret, oauth_token, oauth_token_secret) 
search_results = twitter.search(q=keywords, count=100)
</code></pre>

<p>The problem is that the <code>-RT</code> function isn't really working.</p>

<p><strong>EDIT:</strong></p>

<p>I've tried @forge suggestion, and while it does print the if tweets are not retweets or replies, when I incorporate them into the code below, the bot still finds tweets, retweets, quotes and replies.</p>

<pre><code>twitter = Twython(app_key, app_secret, oauth_token, oauth_token_secret) query = 'beer OR wine AND -filter:retweets AND -filter:replies' 
response = twitter.search(q=query, count=100) 
statuses = response['statuses'] 
try: 
for tweet in statuses: 
try: 
twitter.retweet(id = tweet["id_str"]) 
except TwythonError as e: 
print e 
except TwythonError as e: 
print e
</code></pre>

<p>Any ideas? Is there a <code>filter:quotes</code>?</p>