我正在尝试获取对推文的所有回复,即对这条推文的回复:
https://twitter.com/bbcworldservice/status/309345806123667456
我使用类似的东西来完成这项工作:
https://api.twitter.com/1.1/statuses/mentions_timeline.json?count=100&since_id=309345806123667456
但后来我发现这会返回所有最新的推文,而不是从该 ID 开始的所有推文。因此,假设该用户被提及的次数超过 100 次,则不再包括对该推文的回复。使其无用。
有人可以帮忙吗?提供任何替代建议?
谢谢, 海伦
最佳答案
几个月前我在工作中遇到了同样的问题,因为我之前在 REST V1 中使用他们的 related_tweets
端点。
所以我不得不创建一个解决方法,我已在此处记录。 http://adriancrepaz.com/twitter_conversations_api
这个类应该做你想做的。 它抓取移动站点的 HTML,并解析对话。我已经使用了一段时间,它看起来非常可靠。
获取对话...
请求
<?php
require_once 'acTwitterConversation.php';
$twitter = new acTwitterConversation;
$conversation = $twitter->fetchConversion(324215761998594048);
print_r($conversation);
?>
响应
Array
(
[error] => false
[tweets] => Array
(
[0] => Array
(
[id] => 324214451756728320
[state] => before
[username] => facebook
[name] => Facebook
[content] => Facebook for iOS v6.0 ? Now with chat heads and stickers in private messages, and a more beautiful News Feed on iPad itunes.apple.com/us/app/faceboo?
[date] => 16 Apr
[images] => Array
(
[thumbnail] => https://pbs.twimg.com/profile_images/3513354941/24aaffa670e634a7da9a087bfa83abe6_normal.png
[large] => https://pbs.twimg.com/profile_images/3513354941/24aaffa670e634a7da9a087bfa83abe6.png
)
)
[1] => Array
(
[id] => 324214861728989184
[state] => before
[username] => michaelschultz
[name] => Michael Schultz
[content] => @facebook good April Fools joke Facebook?.chat hasn?t changed. No new features.
[date] => 16 Apr
[images] => Array
(
[thumbnail] => https://pbs.twimg.com/profile_images/414193649073668096/dbIUerA8_normal.jpeg
[large] => https://pbs.twimg.com/profile_images/414193649073668096/dbIUerA8.jpeg
)
)
....
)
)
希望对你有帮助 阿德里安。
关于api - 检索推特对话,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15253528/