Retrieve deleted tweets in twitter4j


I need to retrieve all deleted tweets from specific user

I’m working on java by using Twitter4j

Is there any solution ?



No. Deleted Tweets are permanently deleted, and not available in the API.


So if I’m not on the streaming, how do I Know that the Tweet or DM was deleted? Imagine that I have more then one thousand tweets.


If you try to retrieve at Tweet by ID, and that Tweet was deleted, you’ll get a not found error.


But this is a unitary search and I have rate limited, so I won’t be able to do this with all my messages.


If you are searching, then you should not receive IDs of Tweets that have been deleted.


But the search returns only the 100 latest tweets and the statuses/user_timeline only the 200 latest.


I’m not sure what you are trying to do, or how your question relates to deleted Tweets. Can you explain?


Imagine that I keep the tweets and the DMs in a database and I use the streaming, but sometimes I close the streaming and reopen it and at this moment, I need to delete the deleted tweets and dms, but how to know which one was deleted if I have more than thousand messages?


Right, I understand. That’s definitely an issue, as we require deleted messages to be deleted in your apps per the Developer Policy. You should either be listening for deletion messages on the Streaming API and removing them from your data store as this occurs, or checking for the current status before displaying them in your app by making calls to request them and check for not found messages. That might be difficult given rate limits if you’re not listening on the Streaming API.

In general you should store the Tweet IDs rather than the whole Tweet content as then you won’t be at risk of displaying deleted Tweets - you can request the Tweets by ID (e.g. using statuses/lookup in batches of up to 100).


This topic was automatically closed after 4 days. New replies are no longer allowed.