#!/usr/bin/env python # -*- coding: utf-8 -*- scuttle_url = 'http://username:password@domain.org/scuttle/api/posts_all.php' delicious_url = 'https://username:password@api.del.icio.us/v1/posts/add' import sys import time import urllib from xml.dom import minidom def main(): scuttle_raw = urllib.urlopen(scuttle_url).read() scuttle_xml = minidom.parseString(scuttle_raw); bookmarks = scuttle_xml.getElementsByTagName('post') count = bookmarks.length for bookmark in 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(delicious_url, urllib.urlencode(post)).read() print count count = count - 1 time.sleep(1.5) return 0 if __name__ == '__main__': sys.exit(main())