开发者

Twitter API: accessing public replies and retweets

开发者 https://www.devze.com 2023-02-21 11:01 出处:网络
I\'m trying to sample the relative frequencies of regular tweets vs retweets vs replies in the public timeline; however, I can\'t seem access the latter two. Is there any way to pull down public repli

I'm trying to sample the relative frequencies of regular tweets vs retweets vs replies in the public timeline; however, I can't seem access the latter two. Is there any way to pull down public replies and retweets using the Twitter API? (for the record, I'm using PHP, but I think this is more of an API question) Or, alternatively, is there any way to empirically determine the relative fractions of retweets/replies/n开发者_如何学Ceither that exist on Twitter?

Edit: I should have made this explicit, and I apologize: the problem resides in the fact that the API seems to have eliminated replies and retweets from the statuses/public_timeline REST call, leaving only regular tweets. My question, then, is whether or not there is a way to access public replies and retweets in addition to regular tweets, given that this particular method call does not seem to work. I hope that clears things up.


If you would like to get those frequences for live status updates, you could consume Twitter's Streaming API. Since you want to use PHP, Phirehose allows you to consume the streams easily.

From there you would just examine each status update, looking for whatever markers you like to determine whether they are retweets, replies, etc.. Twitter Text (PHP) might be useful (even if you just borrow the regexes).

A quick run of the above against the "Sample" stream (~1% of public statuses) showed:

  • 2,986 replies
  • 1,481 retweets
  • 6,706 mentions
  • 10,000 tweets


You can extract that information parsing the tweets text looking for "RT @XXXX" or "@XXXX" patterns.

0

精彩评论

暂无评论...
验证码 换一张
取 消