Converting firefox bookmarks to a database

0

1

I have more than 100,000 bookmarks in firefox. I want to save them in a contacts database so that I do not lose them and also easier to manage.

The size of the html file is 55meg.

How would I do this?

user291606

Posted 2014-01-20T11:32:52.643

Reputation: 1

Question was closed 2014-01-22T16:18:06.780

Answers

3

By default, the bookmarks export is a JSON file.

So if you have some development skills, I'd suggest a NoSQL database that handles JSON structured data. Apache CouchDB is such a tool. It is pretty lightweight in terms of resource usage, I run it as a service on my Windows 7 laptop and can testify that it doesn't get in the way.

Node.js is a good way to write front-ends for it but there are many other options including the built-in web console - Futon (http://localhost:5984/_utils/). There is a getting started guide here.

UPDATE: To add your bookmarks to an empty database called "ff-bookmarks", if you have CURL installed, you can use the following command (I'm using Windows cmd prompt here):

curl -X POST http://localhost:5984/ff-bookmarks -d @bookmarks-2014-01-20.json -H "Content-Type:application/json"

The @ symbol tells curl that you want to load a file with the following name. The -H is required to tell curl the correct content type to pass to CouchDB. Using POST means that Couch will create an internal UID for the entries.

You should receive a response such as:

{"ok":true,"id":"349eb4f32fc6f0c85cbcc473160018dd","rev":"1-31384010a78f57165177d9bfb6cd1b53"}

You can now check the content using Futon.

UPDATE 2: Here is a map function that you can use that begins to unpack the structure and may give you an idea how to proceed:

function(doc) {
  for each (child in doc.children) {
    if (child.title == "Bookmarks Menu") {
      for each (child1 in child.children) {
        if (child1.title) {
          emit(child1.title, child1);
        }
      }
    }
  }
}

And just to note that CouchDB allows you to specify output not just as JSON! You can easily define a design document that will return the output as XML or HTML as you desire.

Julian Knight

Posted 2014-01-20T11:32:52.643

Reputation: 13 389