api - 检索推特对话

标签 api twitter

我正在尝试获取对推文的所有回复,即对这条推文的回复:

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/

相关文章:

javascript - 如何使用谷歌通讯录服务读取日期(出生)

django - 为 iPhone/Android 实现注册 REST API 的最佳方式是什么?

html - 如何包含漂亮的 Facebook、Twitter、G+ 分享按钮?

json - JSON 数据中的转义字符

c - 无意中使用 ZwOpenFile

api - Magento API : Publish a new method in soap V2

javascript - 在 Node 和 Express 制作的 REST API 上管理分页和搜索/过滤器的正确方法

python - 在 Python 中使用 OAuth 的 Twitter 流在两台配置相同的机器上表现不同

google-chrome - Twitter按钮未在chrome中显示推文计数

php - Twitter API - 如何检查用户 A 是否关注用户 B