While this code does display tweets by the user, But even if the user is mentioned by someone, then the tweets display. In short, how to just display tweets by user and not Mentions and not retweets.
class listener(StreamListener):
def on_status(self, data):
try:
if (not data.retweeted) and ('RT @' not in data.text):
print(data.text)
print(data.user.name)
#print(data.user.location)
#print tweetf
saveThis=str(time.ctime())+'::'+data.text+'/n'
saveFile = open('twitDB3.txt','a')
saveFile.write(saveThis)
saveFile.write('\n')
saveFile.close()
return(True)
except BaseException, e:
print 'failed on data,',str(e)
time.sleep(5)
def on_error(self, status):
print status
auth = OAuthHandler(ckey, csecret)
auth.set_access_token(atoken, asecret)
twitterStream = Stream(auth, listener())
twitterStream.filter(follow=["87725838498"]);