Skip to content

Instantly share code, notes, and snippets.

@matanlurey
Created August 5, 2011 22:17
Show Gist options
  • Save matanlurey/1128663 to your computer and use it in GitHub Desktop.
Save matanlurey/1128663 to your computer and use it in GitHub Desktop.
Readability Bookmark Purge
'''
Readability Bookmark Purge
===
DELETES All of your *ARCHIVED* Bookmarks
Useful for Starting 'Fresh'
You need to install the Readabiliy Python Library
http://pypi.python.org/pypi/readability-api/#downloads
By Matan Lurey (matan [at] lurey [dot] org)
'''
import readability
# Authentication Variables
# EDIT for your OWN Readability API Token's
key = 'APIKeyName'
secret = 'APISecret'
# EDIT for your OWN Readability Account
username = 'matanlurey'
password = '**********'
# Authenticate
token = readability.xauth(key, secret, username, password)
rdd = readability.oauth(key, secret, token = token)
print 'Authenticated... Loading bookmarks'
print '(This make take a while if you have hundreds or thousands of articles)'
# Loop through archived bookmarks and delete
archived_bookmarks = rdd.get_bookmarks(archived=True)
amount = len(archived_bookmarks)
current = 1
print 'Loaded ' + str(amount) + ' archived articles'
print 'Deleting...\n'
#This doesn't exist in the Readability API, so define a helper here
def delete_bookmark(rdd, b):
return rdd._delete_resource('bookmarks/' + str(b.id))
for b in archived_bookmarks:
if delete_bookmark(rdd, b):
print str(current) + '/' + str(amount) + ' deleted.'
else:
print 'Failed to delete?'
current = current + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment