Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Del.icio.us Backup

DZone's Guide to

Del.icio.us Backup

·
Free Resource
This ruby script dumps all your del.icio.us bookmarks into a sqlite database. Requires sqlite3-ruby installed via rubygems. Don't forget to change the user and pass.
#!/usr/bin/env ruby
require 'rexml/document'
require 'net/http'
require 'net/https'
require 'rubygems'
require 'sqlite3'

# change credentials!
user = 'username'
pass = 'password'

# User-Agent: required for del.icio.us api
agent = 'del.icio.us backup v0.2'
schema = <
  
    agent})
    req.basic_auth(user, pass)
    http.request(req).body
}

db_name = ARGV[0] || Time.now.strftime("%Y-%m-%d.db")
SQLite3::Database.open(db_name).transaction { |db|
    db.execute_batch(schema)
    db.prepare(insert_url) { |url_stmt|
        db.prepare(insert_tag) { |tag_stmt|
            REXML::Document.new(xml).elements.each('posts/post') { |el|
                url_stmt.execute(el.attributes['hash'],
                    el.attributes['href'], el.attributes['description'],
                    el.attributes['extended'], el.attributes['time'])
                el.attributes['tag'].split(' ').each { |tag|
                    tag_stmt.execute(el.attributes['hash'], tag)
                }
            }
        }
    }
}
  
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}