Skip to content

Instantly share code, notes, and snippets.

@wosc
Created April 13, 2016 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wosc/0ea43e23d7efd4f4784540c174f0e80d to your computer and use it in GitHub Desktop.
Save wosc/0ea43e23d7efd4f4784540c174f0e80d to your computer and use it in GitHub Desktop.
Backup all your delicious.com bookmarks by scraping the UI-facing API
import json
import requests
import sys
BASE_URL = 'https://avosapi.delicious.com/api/v1/posts/you/time'
def get_bookmarks(entry, auth):
if not entry:
r = requests.get(BASE_URL, auth=auth)
else:
r = requests.get('%s?anchorx=%s%s' % (
BASE_URL, entry['time_created'], entry['md5']), auth=auth)
data = r.json()
return data['pkg']
if __name__ == '__main__':
if len(sys.argv) < 3:
sys.stderr.write('Usage: %s username password\n' % sys.argv[0])
sys.exit(1)
auth = (sys.argv[1], sys.argv[2])
bookmarks = []
page = get_bookmarks(None, auth)
while True:
if not page:
break
bookmarks.extend(page)
page = get_bookmarks(page[-1], auth)
json.dump(bookmarks, sys.stdout)
@schmatzp
Copy link

Hi,
FYI domain "delicious.com" is dead, now use "del.icio.us", but it seems the base API url has changed., any idea ?

thanks
P.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment