在Twitter API中有没有一种方法可以获得对特定tweet的回复?谢谢
发布于 2010-04-23 03:22:15
据我所知,没有办法直接做到这一点(至少现在不是这样)。看起来像是应该添加的东西。他们最近添加了一些“转发”功能,这似乎也是合乎逻辑的。
这里有一种可能的方法,首先是示例推文数据(来自status/show
):
<status>
<created_at>Tue Apr 07 22:52:51 +0000 2009</created_at>
<id>1472669360</id>
<text>At least I can get your humor through tweets. RT @abdur: I don't mean this in a bad way, but genetically speaking your a cul-de-sac.</text>
<source><a href="http://www.tweetdeck.com/">TweetDeck</a></source>
<truncated>false</truncated>
<in_reply_to_status_id></in_reply_to_status_id>
<in_reply_to_user_id></in_reply_to_user_id>
<favorited>false</favorited>
<in_reply_to_screen_name></in_reply_to_screen_name>
<user>
<id>1401881</id>
...
在status/show
中,你可以找到用户的id。然后,statuses/mentions_timeline
将返回用户的状态列表。只需解析返回,查找与原始tweet id
匹配的in_reply_to_status_id
。
发布于 2012-02-24 02:54:38
推特上有一个名为related_results的未公开的api。它会给你回复指定的tweet id。不确定它作为实验的可靠性有多高,但是这是在twitter web上调用的相同api调用。
使用风险自负。:)
https://api.twitter.com/1/related_results/show/172019363942117377.json?include_entities=1
有关更多信息,请查看dev.twitter上的讨论:https://dev.twitter.com/discussions/293
发布于 2017-04-25 21:11:20
在这里,我分享简单的R代码来获取特定推文的回复
userName = "SrBachchan"
##fetch tweets from @userName timeline
tweets = userTimeline(userName,n = 1)
## converting tweets list to DataFrame
tweets <- twListToDF(tweets)
## building queryString to fetch retweets
queryString = paste0("to:",userName)
## retrieving tweet ID for which reply is to be fetched
Id = tweets[1,"id"]
## fetching all the reply to userName
rply = searchTwitter(queryString, sinceID = Id)
rply = twListToDF(rply)
## eliminate all the reply other then reply to required tweet Id
rply = rply[!rply$replyToSID > Id,]
rply = rply[!rply$replyToSID < Id,]
rply = rply[complete.cases(rply[,"replyToSID"]),]
## now rply DataFrame contains all the required replies.
https://stackoverflow.com/questions/2693553
复制相似问题