使用 Twitter Streaming API 检测推文删除 [英] Detect Tweet deletion with Twitter Streaming API

查看:33
本文介绍了使用 Twitter Streaming API 检测推文删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Twitter Streaming API 可用于通过以下查询检测短语:http://stream.twitter.com/1/statuses/filter.json?track=phrase

The Twitter Streaming API can be used to detect a phrase using the following query: http://stream.twitter.com/1/statuses/filter.json?track=phrase

但是,相同的查询似乎没有检测到推文何时被删除.有没有办法通过 API 做到这一点?

However, the same query doesn't seem to detect when the tweet is deleted. Is there a way to do that with the API?

提前致谢.

推荐答案

根据 文档,您应该在流中进行删除,它们应该如下所示:

According to the docs, you're supposed to get deletions in the stream, they should look like this:

{"delete":{"status":{"id":1234,"id_str":"1234","user_id":3,"user_id_str":"3"}}}

更新:我做了一些测试,看看发生了什么.首先,我尝试了带有 track 参数的过滤器 URL,就像您正在尝试一样,并确认了您所看到的相同行为.然后我尝试了一个带有跟随"设置的 URL,如下所示:

UPDATE: I did a few tests to see what was going on. First, I tried the filter URL with a track parameter, just like you are trying, and confirmed the same behavior that you are seeing. Then I tried a URL with a 'follow' setting instead, like so:

http://stream.twitter.com/1/statuses/filter.json\?follow\=1160471

当我尝试这样做时,我会收到推文及其删除消息.如果不询问 Twitter,显然很难确定,但我想知道您是否在使用轨道参数时根本没有得到删除,或者这是否是这些方面的另一个问题.

When I try that, I get both tweets and their deletion messages. It's hard to know for certain obviously without asking Twitter, but I wonder if you just don't get deletions at all when using a track parameter, or if it's another issue along those lines.

这篇关于使用 Twitter Streaming API 检测推文删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆