Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Export delicious bookmarks into a scuttle site
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# code originally from Michael Klier
# -- licensed unded CC-NC-SA
# 1. change username and password in urls below
# 2. change SCUTTLEDOMAIN to the domain of your scuttle site
# to export from a scuttle server to use these URLs
scuttle_url = 'http://username:password@SCUTTLEDOMAIN/api/posts_all.php'
delicious_url = ''
# to export links from delicious into a scuttle site use these two URLs
scuttle_add = 'http://username:password@SCUTTLEDOMAIN/scuttle/api/posts_add.php'
delicious_get = ''
import sys
import time
import urllib
from xml.dom import minidom
def main():
delicious_raw = urllib.urlopen(url_export).read()
delicious_xml = minidom.parseString(delicious_raw);
bookmarks = delicious_xml.getElementsByTagName('post')
count = bookmarks.length
for bookmark in reversed(bookmarks):
post = {}
post['url'] = bookmark.getAttribute('href').encode('utf-8')
post['description'] = bookmark.getAttribute('description').encode('utf-8')
post['tags'] = bookmark.getAttribute('tag').encode('utf-8')
post['dt'] = bookmark.getAttribute('time').encode('utf-8')
post['shared'] = 'no'
post['extended'] = bookmark.getAttribute('extended').encode('utf-8')
result = urllib.urlopen(url_import, urllib.urlencode(post)).read()
print count
count = count - 1
return 0
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.