Created
February 6, 2018 15:48
-
-
Save eralpkaraduman/fae5f11c1b0bb28dd7dd2f6562f43db7 to your computer and use it in GitHub Desktop.
converting list of urls to netscape bookmarks html export format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var netscape = require('netscape-bookmarks'); | |
var fs = require('fs'); | |
var bookmarksList = fs.readFileSync('readinglistlinksfromsafari.txt').toString().split("\n"); | |
var bookmarksObj = bookmarksList.reduce((acc, url) => { | |
var title = url; | |
acc[title] = url; | |
return acc; | |
}, {}); | |
var html = netscape(bookmarksObj); | |
fs.writeFile("bookmarks.html", html, function(err) { | |
if(err) { | |
return console.log(err); | |
} | |
console.log("The file was saved!"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "safariReadingListToBookmarkExport", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"netscape-bookmarks": "^0.1.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
example1.com | |
example2.com | |
example3.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment