我想使用 tweet id 向 twitter search API 发送查询,但似乎你不能通过拥有它的 id 来搜索推文(可能是因为你没有如果您已经有 id,则需要搜索它)。例如,假设我们有一条推文 https://twitter.com/great_watches/status/643389532105256961我们想将 643389532105256961 发送到搜索 API 以查看该推文是否在搜索 API 上可用。
我需要它,因为我只想比较 Twitter 搜索 API 和 Twitter 流媒体 API。 我有一个 python 脚本,它正在监听一些关键字的流,每当有推文出现时,我喜欢在 twitter search api 上搜索它,看看它是否也可用。没意义吧?
请您参考如下方法:
您无法按照自己的方式将 Search API 与 Streaming API 进行比较,因为它们都在检索不同类型的信息。
来自Search API docs :
The Twitter Search API is part of Twitter’s v1.1 REST API. It allows queries against the indices of recent or popular Tweets and behaves similarily to, but not exactly like the Search feature available in Twitter mobile or web clients, such as Twitter.com search.
Before getting involved, it’s important to know that the Search API is focused on relevance and not completeness. This means that some Tweets and users may be missing from search results. If you want to match for completeness you should consider using a Streaming API instead.
这里是根据您提供的信息来解释场景。
- 您正在流式传输单词
python并找到一个匹配项。 - 您立即获取该匹配项并在搜索 API 上查找
问题在于,当您从 Streaming API(实时)开始,您希望在搜索 API 上找到相同的 API 时,您会遇到更多 相关的推文和流行的推文将取代它。
您需要重新定义发送到搜索 API 的查询以包含完全相同的查询(即包含多个 python,就像您对 Streaming API 所做的那样)。
