0
down vote
favorite
I’m using R, specifically I’m using the filterStream package (Twitter streaming API library for R). I’d like to detect new tweets from a specified user.
The problem I’m having is that all replies to the user’s tweet are being detected as well. I just want the original tweet, when it happens.
Here’s the code for accessing the streaming api and getting tweets from a user (which includes replies to the user):
lastTweet <- filterStream(file.name="", follow=tuserID, timeout=3600, tweets=1, oauth=my_oauth)
I can program the script to detect if a tweet is a reply to the original tweet, by checking to see if there’s a user ID in the “reply to user” field, such as this:
tw <- parseTweets(lastTweet, verbose = FALSE)
tw$in_reply_to_user_id_str != tuserID #tweet is not a reply
…but that doesn’t help me “in real time,” as filterStream stores tweets until a maximum number or timeout has been reached, and I haven’t figured out how to evaluate the tweets as they’re being captured.
Any suggestions would be greatly appreciated. Thanks!