Detect Tweet deletion with Twitter Streaming API

随声附和 提交于 2019-12-06 01:16:44

问题


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

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

Thanks in advance.


回答1:


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"}}}

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

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.



来源:https://stackoverflow.com/questions/5955021/detect-tweet-deletion-with-twitter-streaming-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!