Daniel's Blog
20 Nov/11 4

Tweet Neglector. A small PHP script to delete old tweets from Twitter

Automates the process of tweet Neglector deleting old tweets from your Twitter account. Basically it provides to "expire" functionality for your tweets. It is useful for people who want to use Twitter but do not want a history of their tweets to stay online for decades.

 HISTORY:
 November 20, 2011 | Version 0.1
 Initial release.  Deletes Tweets

 December 28, 2011 | Version 0.2
 Small bug fixes.  Now deletes retweets as well.

 KNOWN BUGS:
 - Will not work if you tweet more than 1000 tweets in the timeframe you plan to keep tweets.  Same for retweets (100 allowed).  These are shortcomings of the Twitter API GET I am using ATM.  Maybe I'll fix this with the next release

Tweet Neglector uses the Twitter API to delete all of your tweets that were posted before a given number of days from now. This way you could configure the script to delete all tweets that are older than a week or a month for example. The script should be automatically run from a cron job or another automation mechanism on a regular base.

This script can not protect you from external Tweet archives. So it is unknown if deleted tweets are archived by Twitter quietly (I bet they are). So (as always) think before tweeting.

Tweet Neglector uses PHP as scripting language and bundles the Twitter OAuth library from Matt Harris for API Access.

Installation

 - PHP5 required for tmhOAuth

 - Unzip the archive into a directory of your choice.

 - Register your Twitter API keys at https://dev.twitter.com/apps

 - Edit the configuration of the script to suit your needs:

 # Twitter API keys, tokens and secrets
 # Get these keys at -> https://dev.twitter.com/apps

 $ Consumer_key = "YOUR KEY HERE";
 $ Consumer_secret = "YOUR KEY HERE";
 $ Access_token = "YOUR KEY HERE";
 $ Access_token_secret = "YOUR KEY HERE";

 # Number of tweets per session to work on
 $ Tweets_per_session = 1000;

 # Twitter User Name
 $ Twitter_username = "YOUR USER NAME HERE";

 # Days to keep tweets
 $ Keep_days = 30;

 - Run the script manually from browser, console or automatically by cronjob
 / Usr / bin / php / var / www / tweetneglector / tweetneglector.php

Tweet Neglector 0.2 Download here

Comments (4) Trackbacks (0)
  1. Hi Martin,

    you probably do not have PHP5 with CURL support installed on your webhost.
    tmhOAuth needs:

    The library has been tested with PHP 5.3 + and Relies on CURL and hash_hmac. The vast Majority of web hosting providers include these libraries and run with PHP 5.1 +.

    The code makes use of hash_hmac, Which was Introduced in PHP 5.1.2. If you version of PHP is lower than this you should ask your hosting provider for an update.

    https://github.com/themattharris/tmhOAuth

  2. Hi, always get a error

    ********************

    DELETING TWEETS

    ********************

    Delete Thu, 01 Jan 1970 00:59:59 +0100 | ID: 87076355619041280
    I am looking for real estate around the Woerthersee, I look forward to hearing from you

    Parse error: syntax error, unexpected T_CONST, or expecting T_OLD_FUNCTION T_FUNCTION or T_VAR or '}' in / homepages/21/d40854583/htdocs/biz/tweetneglector/tmhOAuth.php on line 15

    is there a fix for that!

    This program seem to be outstanding!

    Martin

  3. ups ... the name is not registered, it's me, Andrew! ;-)

  4. Funzt reliably now? :-)
    Would take the time for Facebook too! ;-)


Leave a comment

* Copy this password:

* Type or paste password here:

450 Spam Comments Blocked so far by Spam Free Wordpress

Please copy the string to the field below cjUmL6:

No trackbacks.