Renaming your del.icio.us account
It is rather difficult to change your del.icio.us user id.
Here are some steps to propage your links from one del.icio.us account to another. Tag groups and your inbox will not propogate.
- Download your links from the first account and save to a file called all.xml
- Modify the Python script below to have your user name and password. If you can not edit and run python scripts you will need help from someone who can. This was a hastily written script, not a nicely crafted peice of code.
rom xml.dom.minidom import parse, parseString
import urllib
from time import sleep
from urllib2 import Request,HTTPError,URLError,urlopen
import urllib2
dom=parse("all.xml")
posts=dom.getElementsByTagName("posts")[0].getElementsByTagName("post")
mapattributes = {"url":"href",
"description":"description",
"extended":"extended",
"tags":"tag",
"dt":"time" }
# this creates a password manager
username="your delcious username"
password="your delicius password"
authinfo = urllib2.HTTPBasicAuthHandler()
authinfo.add_password('del.icio.us API', 'http://del.icio.us', username, password)
opener = urllib2.build_opener(authinfo)
urllib2.install_opener(opener)
service_url="http://del.icio.us/api/posts/add"
service_url_without_protocol="del.icio.us/api/posts/add"
for post in posts:
gt=post.getAttribute
vals = [(x,gt(y)) for x,y in mapattributes.iteritems()]+[("replace","yes")]
vals2 = [(x,y) for x,y in vals if len(y)>0 or x != "extended"]
print (vals2)
params=urllib.urlencode(vals2,doseq=1)
print( params )
posturl = "http://del.icio.us/api/posts/add?"+params
try:
urllib2.urlopen(posturl).read()
except HTTPError, e:
print "http error " , e.code
except URLError, e:
print "failed to reach server", e.reason
sleep(5)
Technorati Tags: del.icio.us, python
