Python Script to Delete Delicious Bookmarks

Python Script to Delete Delicious Bookmarks
Source: Meme Generator

Delicious has been one of my most frequently used services for several years, but using it has become painfully slow. I moved my bookmarks back to the browser, which can sync them across different computers, is fast, and offers a well working search feature.

Delicious stopped being useful for me, so I decided to delete all my bookmarks. There is no function for doing that, but the API still works, as does the export function to save your bookmarks in a browser compatible format. It's good they retained this feature.

The following Python script deletes all delicious bookmarks for the authenticated user. It receives user name and password in clear text as command line arguments. Thus, it may be worth putting it into background and deleting the command history after running it. I had to call it a few times, since API requests can obviously fail.


#!/usr/bin/env python
# coding: utf-8
# remove all your bookmarks from delicious
import sys, json, requests

if 3 != len(sys.argv):
    print "Usage\n%s user password" %sys.argv[0]

user = sys.argv[1]
pw = sys.argv[2]

r = requests.get('https://api.delicious.com/v1/json/posts/all', auth=(user, pw))
posts = json.loads(r.content)['posts']
for p in posts:
    requests.get('https://api.delicious.com/v1/posts/delete', params={'md5': p['post']['hash']}, auth=(user, pw))


blog comments powered by Disqus