Skip to content

Instantly share code, notes, and snippets.

@danburzo danburzo/

Last active Jun 10, 2018
What would you like to do?
Duplicate pinboard bookmarks

Finding duplicate Pinboard bookmarks.

Run this Node script against your exported JSON file, which you'll need to enter in the FILEPATH variable.

The keyfor method returns the relevant part of the URL. You can customize it based on the available properties.

var fs = require('fs'), url = require('url');
// path to your JSON file
var FILEPATH = 'format_json.json';
// See for available URL properties
function keyfor(url) {
return url.hostname.replace(/^www\./,'') + url.path +
var index = {};
fs.readFileSync(FILEPATH, 'utf8')
).forEach(function(item) {
var key = keyfor(url.parse(item.href));
if (!index[key]) index[key] = [];
var duplicates = Object.keys(index).map(function(k){
return this[k];
}, index).filter(function(list) {
return list.length > 1;
}).map(function(list) {
return {
return item.href;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.