Search code examples
twitter

In Twitter API How to check a tweet has been deleted on twitter if I check it via a Tweet id saved in my database


I have used Twitter API for fetching the tweets with a particular hash tag and all the data stored in my database.

I am currently working in core PHP.

API is working fine, thanks to Twitter

Now problem comes with the deleted tweets, Actually when a record of 100 latest tweets comes on my ajax file directly I store them in my database with a flag visible="y" . Now I want that if any of tweet stored in my database is being deleted from responsive twitter account automatically set visible = "N" into my database.

I searched a lot on internet but I could not find any respected answer. Please reply me and ask me if any further information is needed.

Thanks to Stack Overflow for a good community.


Solution

  • The only way to do what you're suggesting, is to run some process that reads the tweets from your database and checks to see if they are still there.

    You can call https://api.twitter.com/1.1/statuses/lookup.json and pass it a comma-delimited list of 100 tweets, and then compare the return value to your database to see if the tweets you asked for are still available or not.

    You will have to iterate through your database 100 tweets at a time. Depending on how many tweets you are storing, you may run into rate limit issues.