Python Script to Delete Delicious Bookmarks

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))

This post was written by Ramiro Gómez (@yaph) and published on . Subscribe to the Geeksta RSS feed to be informed about new posts.

Tags: code delicious privacy python

Disclosure: External links on this website may contain affiliate IDs, which means that I earn a commission if you make a purchase using these links. This allows me to offer hopefully valuable content for free while keeping this website sustainable. For more information, please see the disclosure section on the about page.


Share post: Facebook LinkedIn Reddit Twitter

Merchandise