Jump to content

(Archived) Import my firefox bookmarks to Evernote


etech0

Recommended Posts

Hi!

 

I'm switching over to use Evernote as my bookmark manager. I have loads of bookmarks saved in Firefox (and they sync to chrome via xmarks) - but how can I import them all to Evernote, without doing it one at a time with the web clipper?

 

Thanks!

Link to comment
  • Level 5*

I want each bookmark to become a separate note in Evernote. Will your idea do that?

No, it won't.

 

You should be able to export your bookmarks as HTML, for starters. Then you could possibly use some sort of text processing tool (Perl? I'd probably opt for Python)  to pull out each bookmark (and probably title), and then create a file that you can import using the ENScript program.

Link to comment
  • 1 month later...

This might also be helpful: http://lifehacker.com/5893193/booknote-importer-sends-all-your-bookmarks-to-evernote

 

Doesn't give you a separate note for each bookmark, but it will at least give a separate note for each folder.  (Or so it appears; I haven't tried it yet.)

 

Also, I'm considering editing that perl script (or maybe writing my own; I'm more familiar with php) to actually visit each page and grab text to create a full note, not just a title and url.  Haven't decided yet whether it's worth it though...  Anybody else feel like taking that on? ;)

Link to comment

That perl script worked fine for me. Some of my bookmarks made errors, though. I had to use the "divide and conquer" method on the enex file it made, to isolate the bookmarks that kept the whole script from importing. The other annoyance is that it does not clip the page - it just has the bookmark title and URL.

I would love a tool that clipped the whole page. I didn't know you could do that kind of thing with php - I just started learning it, and didn't realize that it was that powerful.

I'd love to try writing such a script - do you have a basic idea of how you'd do it?

Link to comment

That perl script worked fine for me. Some of my bookmarks made errors, though. I had to use the "divide and conquer" method on the enex file it made, to isolate the bookmarks that kept the whole script from importing. The other annoyance is that it does not clip the page - it just has the bookmark title and URL.

I would love a tool that clipped the whole page. I didn't know you could do that kind of thing with php - I just started learning it, and didn't realize that it was that powerful.

I'd love to try writing such a script - do you have a basic idea of how you'd do it?

Perhaps some of your bookmark URLs had quote characters in them? That would break that script (although quotes in URLs would normally be escaped).

 

Yep, I've got an idea how I'd do the script; just don't really have time to do it. :)  The basic structure would be similar to that perl script.  RIght now what it does is parses the .html export file created by Firefox or Chrome, grabs any <a href="">[title]</a> tags, and slams those into an import file for evernote, with the label 'bookmarks'.  I would add two improvements to that.

 

First, I would take into account the full structure of the bookmarks file to mirror the same folders as notebooks in evernote.  (I would be inlined to put them all under a root 'bookmarks' notebook; the user can then copy them elsewhere afterward if they want.)  Optionally tagging them all as 'bookmark' as the perl script does seems like a good idea too.

 

In Firefox, it looks like the bookmarks export has an unmatched <DT> tag followed by an <H3> for the heading of each folder, then the contents are surrounded in <DL></DL>.  That should allow you to extract the nested folder structure.  Within a folder, each bookmark link is an <A> tag preceded by an unmatched <DT>.  In Firefox you can also add tags and descriptions to bookmarks.  If you want to be really complete, you could extract that info too (make some test bookmarks with them to see the format in the export file), and mirror it in the notes too.  Personally I don't use those aspects though, and I doubt many people do, so you could skip that bit.

 

Now, there's essentially 3 steps to the script.  First is parsing the export file and saving it in php variables.  Second is getting the contents of the pages.  Third is creating the evernote import file.  For #1, as you parse the export file, you want to keep it in php in a meaningful format.  I'm thinking you would want to create two classes: folder and bookmark.  A folder would have fields 'title', 'subfolders', and 'bookmarks'.  Title is a string, subfolders is an array of folder instances, and bookmarks is an array of bookmark instances.  A bookmark would have fields for each of its properties: title, url, contents, description*, keyword*, tags*, which would all be strings except tags, which would be an array of strings.  *if you bother to extract those parts.

 

SO, now you've got a nice big php data object.  Step 2 is the tricky part.  You want to recursively loop through your object, and for each bookmark, you grab the contents of the page with cUrl and insert it into the 'contents' field.  Now, the easy way to do that is just to loop through and synchronously grab one page at a time.  The better way would be to fire off curl_multi_exec requests, passing in a callback function that would add the contents to the appropriate bookmark once they're retrieved.  That would allow you to grab multiple pages at once, which would be much faster for a large number of bookmarks.  Whichever way you do it, I would code something in to export your data object in json format to a file every 10 bookmarks or so, so that if the script dies for whatever reason you don't have to re-access all those pages.  (You can pass in the file with the object to start with, and if received have the script skip to the first bookmark that doesn't have a 'contents' field filled already.)

 

Fiiinally, you can create an enex file.  The basics of the format can be seen in that perl script.  It's possible the specifics of the file format are available somewhere.  If not, you can just create a few test web clipping notes in evernote with nested notebooks and tabs and such, then export them.  Take a look at the resulting file to see exactly what evernote expects, then write the code to create a file in that format out of your pile of data.

 

If you're new to php, this will likely take a while and there are a number of caveats, but it's definitely doable, and a fun project.  I bet you could even put it up on a page with a paypal donate button and make a bit of money off it over time.  If you have questions as you go, you can email me at nathan at searchtempest.com, but this post notwithstanding I am pretty busy working on my sites, so you might be better off posting to stackoverflow.  (Tag your questions php and libcurl as appropriate.)

 

Hope that helps!

Link to comment

Looks like this guy's already done the hard work of grabbing the page content for a url clipping: http://blog.nik.me/post/30458242305/evernote-bookmarking-tools

 

So if you wanted you could do a two-step process with the perl script above, followed by this script.  Would preserve folder structure though, so that would still be nice to implement.

 

Edit: On the other hand, that could just be my legacy bias speaking.  I haven't really gotten into EverNote yet; am really just experimenting with it still.  (But I really WANT to love it!)  The more I think about it, the more I feel like I really need to give up the idea of using a large number of nested stacks and notebooks.  Or a large number of tags for that matter.  Used judiciously they'll likely be handy, but for the most part I think I need to just embrace search and not worry about keeping everything finely sorted. 

 

Sooooo maybe importing all the bookmarks into one notebook with one tag is just fine.  If a person wanted to split their bookmarks into a few chunks, they could do so before performing the import.

Link to comment

Wow - that's pretty comprehensive!!!!

I don't think I'm quite far in enough with PHP to do something like this, but I'm definitely going to file what you've said above (in Evernote :) ) so that one day I can try it out. If I remember, I'll post over here if and when it happens.

 

PS: this is the article that actually got me to once and for all dive into Evernote. I don't do it exactly how he explains it, but more or less. And I'm loving it. Seriously.

http://www.thesecretweapon.org/the-secret-weapon-manifesto

 

And the only thing I couldn't do with EN is recurring tasks, so I use Google Calendar and IFTTT for that.

Link to comment

Wow - that's pretty comprehensive!!!!

I don't think I'm quite far in enough with PHP to do something like this, but I'm definitely going to file what you've said above (in Evernote :) ) so that one day I can try it out. If I remember, I'll post over here if and when it happens.

 

PS: this is the article that actually got me to once and for all dive into Evernote. I don't do it exactly how he explains it, but more or less. And I'm loving it. Seriously.

http://www.thesecretweapon.org/the-secret-weapon-manifesto

 

And the only thing I couldn't do with EN is recurring tasks, so I use Google Calendar and IFTTT for that.

 

Ha, me too re: TSW.  I came up with my own whole system, then came across that and it was already very close to what I was doing.  Ended up borrowing a bunch of their ideas.  What I've got now is essentially what they recommend except that I use notebooks for the .When instead of tags.  I figure things can only have one .When, so notebooks are appropriate, and this forces me to give everything a priority context.  Then I put all the priority folders under a Current stack, and I group their 'Cabinet' and 'Completed' (which I call Archive and Done) under their own stack.  I'm using google calendar for recurring and specific time tasks; it sends me an email update each day, so I just put that into EN along with whatever other emails as necessary - haven't felt the need for IFTTT there yet.  I am going to start using this for the mail -> EN transfers though: http://www.harryonline.net/evernote/send-google-mail-to-evernote/226.  (I checked out the powerbot addon, which is also cool, but this allows for more optimization and, critically, gives you a link back to the original email so you can easily reply.)

 

I've been putting off the bookmark import in hopes that I'd convince you to write that script... ;)  What I may end up doing is going through manually.  I expect it'd take a few hours, but I'll probably come across some stuff that I bookmarked with the intention of coming back to eventually...

 

BTW: No need to remember to come back here.  Just attach a reminder where you clipped this in EN! ;)

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...