├── radiergummi.py └── README.md /radiergummi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import tweepy 4 | import itertools 5 | 6 | # item limits to keep 7 | user_timeline_limit = 20 8 | favorites_limit = 3 9 | direct_messages_limit = 3 10 | blocks_limit = 3 11 | saved_searches_limit = 1 12 | 13 | # OAuth application 14 | consumer_key = "get this from https://apps.twitter.com/" 15 | consumer_secret = "get this from https://apps.twitter.com/" 16 | # OAuth account 17 | access_token = "get this from https://apps.twitter.com/" 18 | access_token_secret = "get this from https://apps.twitter.com/" 19 | 20 | # authentication 21 | auth = tweepy.OAuthHandler(consumer_key, consumer_secret) 22 | auth.set_access_token(access_token, access_token_secret) 23 | 24 | API = tweepy.API(auth) 25 | 26 | user_timeline = API.user_timeline() 27 | for status in itertools.islice(user_timeline, user_timeline_limit, None): 28 | API.destroy_status(status.id) 29 | print("deleted status:", status.id) 30 | 31 | favorites = API.get_favorites() 32 | for status in itertools.islice(favorites, favorites_limit, None): 33 | API.destroy_favorite(status.id) 34 | print("deleted favorite:", status.id) 35 | 36 | direct_messages = API.get_direct_messages() 37 | for direct_message in itertools.islice(direct_messages, direct_messages_limit, None): 38 | API.destroy_direct_message(direct_message.id) 39 | print("deleted direct message:", direct_message.id) 40 | 41 | blocks = API.get_blocks() 42 | for block in itertools.islice(blocks, blocks_limit, None): 43 | API.destroy_block(block.id) 44 | print("deleted block:", block.id) 45 | 46 | saved_searches = API.get_saved_searches() 47 | for saved_search in itertools.islice(saved_searches, saved_searches_limit, None): 48 | API.destroy_saved_search(saved_search.id) 49 | print("deleted saved search:", saved_search.id) 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Digital Eraser 2 | ============== 3 | 4 | Digital Eraser deletes Twitter account data. It is intended to be run via cron. 5 | 6 | Status 7 | ------ 8 | 9 | Since Twitter killed free and open API access, you should delete your entire account instead. 10 | 11 | Name 12 | ---- 13 | 14 | Radiergummi is German for "eraser". 15 | 16 | Reason 17 | ------ 18 | 19 | [Delete: The Virtue of Forgetting in the Digital Age](http://press.princeton.edu/titles/9436.html). 20 | 21 | Description 22 | ----------- 23 | 24 | Twitter is a (near) real time medium. It doesn't need to keep an archive of everything you have ever done. 25 | 26 | Digital Eraser can delete these things: 27 | 28 | - status messages, including retweets 29 | - favorites 30 | - direct messages: sent and received 31 | - blocks 32 | - saved searches 33 | 34 | It is designed to be run via cron automatically and regularly. 35 | 36 | Warning 37 | ------- 38 | 39 | This will permanently delete content of your Twitter-account. 40 | 41 | Inspiration 42 | ----------- 43 | 44 | Dave Jeffery: [delete_all_tweets.py](https://gist.github.com/davej/113241) 45 | 46 | Requirements 47 | ------------ 48 | 49 | [Tweepy](https://www.tweepy.org/) - Python library for accessing the Twitter API 50 | 51 | Configuration 52 | ------------- 53 | 54 | Get OAuth key and secret for application and account at: [dev.twitter.com/apps](https://dev.twitter.com/apps) 55 | 56 | Change the limits-variables to whatever value you want to keep. 57 | 58 | Notes 59 | ----- 60 | 61 | The Twitter API seems to have a hard time with old content. An initial deletion to the specified limits will take a while. 62 | 63 | On first run, you will probably see a few errors. These are Twitters fault: 64 | 65 | - Twitter error response: status code = 503 66 | - No status found with that ID. 67 | 68 | Twitters "Tweet Count" of a profile is not accurate. It seems to be about 20 Tweets over the actual count. Count them manually, and you will see Twitter Eraser is correct, Twitter not. 69 | 70 | License 71 | ------- 72 | 73 | [HESSLA](https://en.wikipedia.org/wiki/Hacktivismo_Enhanced-Source_Software_License_Agreement). But I also [like beer](https://en.wikipedia.org/wiki/Beerware). 74 | --------------------------------------------------------------------------------