Skip to content

Instantly share code, notes, and snippets.

Created December 27, 2010 12:20
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save xlson/756095 to your computer and use it in GitHub Desktop.
Script that transforms the Delicious backup-xml into json for import into the CouchDB application Scrumptious
#!/usr/bin/env groovy
@Grab(group='commons-lang', module='commons-lang', version='2.5')
@Grab(group='net.sf.ezmorph', module='ezmorph', version='1.0.6')
@Grab(group='commons-collections', module='commons-collections', version='3.2.1')
@Grab(group='commons-beanutils', module='commons-beanutils', version='1.8.3')
import net.sf.json.*
def cli = new CliBuilder(usage:'del2scrumptious.groovy') 1, argName: 'delicous xml-file', required: true, 'File containing the xml export from Delicious')
cli.out(args: 1, argName: 'output filename', required: true, 'File where the Scrumptious-style JSON will be saved')
def options = cli.parse(args)
if(!options) {
def posts = new XmlSlurper().parse(new File(
def data = { post ->
[type: 'bookmark',
title: post.@description.text(),
url: post.@href.text(),
description: post.@extended.text(),
date: post.@time.text(),
tags: post.@tag.text().split(" "),
imported: true]
def json = JSONSerializer.toJSON([docs: data])
new File(options.out).withWriter('UTF-8') {
it << json.toString()
Copy link

xlson commented Dec 27, 2010

Scrumptious is an application for handling bookmarks. It's not unlike the soon to be dead Delicious and is built completely within CouchDB. More about Scrumptious here:

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