6

As the title says, I'm using the Twitter4J API and I cannot seem to find how to count the retweets of a "Tweet" instance.

ManAmongHippos
  • 511
  • 1
  • 5
  • 9

2 Answers2

2

The interface StatusMethodsAsync has a getRetweets() function (as described here) but that only shows the top 100 first retweets of a given tweet. If you know that there are less than 100 retweets this should work. If there are more you have in the interface TwitterStream a stream of all retweets (as described here), but that doesn't seem fully functioning, so I wouldn't know then...

But this could get you on the right track.

1

There is no specific count function, but getRetweetedByIDs will get you an array of up to 100 user ids who retweeted the tweet. This is a little more light-weight if all you want is the number of retweets. The IDs interface also has cursor support if you need to retrieve more than 100, but I have no experience with using those functions.