Skip to content

Instantly share code, notes, and snippets.

@ahmedelgabri
Last active February 17, 2017 07:49
Show Gist options
  • Save ahmedelgabri/cc1d8b2f530d0bd7bbd1 to your computer and use it in GitHub Desktop.
Save ahmedelgabri/cc1d8b2f530d0bd7bbd1 to your computer and use it in GitHub Desktop.
Node script to export all your delicious bookmarks
  1. Download or clone the gist.
  2. cd into the directory & do $ npm install
  3. I have used nodedelicious and it needs you to store delcious username & password as enviromnet varaibles so you will need to do the following.
$ export DELICIOUS_USER="<your username>" && export DELICIOUS_PASSWORD="<your password>"
  1. Run $ node index.js
  2. PROFIT! you have your delicious export in a file called bookmarks.html that you can save or import in Pocket.
var nodedelicious = require('nodedelicious');
var moment = require('moment');
var fs = require('fs');
var filename = 'bookmarks.html';
// https://gist.github.com/fakechris/1258590
var start = '<!DOCTYPE NETSCAPE-Bookmark-file-1>' +
'<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">' +
'<!-- This is an automatically generated file.' +
'It will be read and overwritten.' +
'Do Not Edit! -->' +
'<TITLE>Bookmarks</TITLE>' +
'<H1>Bookmarks</H1>' +
'<DL><p>';
var end = '</p></DL>';
fs.writeFile(filename, start, function(err){
if(err) console.log(err);
});
nodedelicious.getAll('', {
fromDate: '2000-01-01' // I just added a very old date so I can get all my bookmarks.
}, function (err, data) {
if(err) console.log(err);
var posts = data.posts.post;
posts.forEach(function(post, i){
var private = post.$.private ? 1 : 0;
var item = '<DT><A HREF="'+ post.$.href +'" ADD_DATE="' + moment(post.$.time).format('X') + '" PRIVATE="' + private + '" TAGS="' + post.$.tag.split(' ').join(',') + '">' + post.$.description + '</A></DT>';
fs.appendFile(filename, item + '\n', function(err) {
if(err) console.log(err);
console.log('Added ' + i);
});
});
fs.appendFile(filename, end, function(err){
console.log(err);
});
});
{
"name": "delicious-export",
"version": "1.0.0",
"description": "Export delicious links",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Ahmed El Gabri <ahmed@gabri.me> @ahmedelgabri",
"license": "MIT",
"devDependencies": {
"moment": "^2.8.4",
"nodedelicious": "0.0.1"
}
}
@leanda
Copy link

leanda commented Jan 11, 2015

Hey, this works brilliantly, many thanks. It seems to be limited to only exporting 999 bookmarks. I have 2700 stuck inside the service. Is there any way to expand it so it will export more? Thanks again.

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