Was tweet retweeted by me?

Oct 13, 2013 at 10:17 AM
Edited Oct 13, 2013 at 10:27 AM
Hi *,

I'm doing simple search of hashtag:
ctx.Search.Where(s => s.Type == SearchType.Search).Where(s => s.Query == "#hashtag +exclude:retweets")
And as I'm processing the results I'd like to know whether the tweet I'm processing was retweeted by "me" (currently logged in user). Is there a way (maybe without doing another call and hitting rate limits)?

I was looking at "Retweeted" property, but it's (in my case) always false.
Oct 13, 2013 at 10:33 AM
Ahh, looks like it's https://dev.twitter.com/issues/532 related. Any good workaround?
Coordinator
Oct 13, 2013 at 8:55 PM
Edited Oct 13, 2013 at 8:56 PM
Hi,

There are a couple options, which may or may not work, but I'll mention them with some pros/cons:
  1. Get the list of IDs of who retweeted a tweet. Then check to see if the user's ID is in the list. The issue here is that if you're processing a lot of search results then you'll quickly use up rate limits, which is what you're trying to avoid.
  2. Similar to #1, you can get the retweets of a tweet, but that will give you more info than you need and seems like a waste of bandwidth for the purpose you want it for.
  3. Another technique that isn't so obvious might be to query the user timeline. This is more complex, but sometimes you can study the API and do clever things. When considering rate limits, you have a window of X queries for every 15 minutes. The rate limit applies to that user, not your application. So, use that user's credentials, which are available in the Credentials property of the IAuthorizer after authorization is complete. You don't have to query the entire timeline, just keep track of the tweet of the last ID that you retrieved and get any new tweets after that. Use the techniques in my blog post, Working with Timelines with LINQ to Twitter, to see how to just get the newest tweets. Be sure to set your Count to the max allowable value (200 for Status/User queries) to minimize the number of queries. If you keep all of that user's tweets, you can go back to the date of the tweet you're looking for and do a query to see if one of that user's tweets is a retweet of this one. There are optimizations that you can probably take advantage of in your design, but this might help you reduce rate limit. I don't know if this will work for you, but maybe it will give you some ideas on how to achieve your goal.
@JoeMayo