Exporting Bookmarks to Clean HTML

Discussion of general topics about Mozilla Firefox
Lost User 133863
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Exporting Bookmarks to Clean HTML

Post by Lost User 133863 »

I'd like to export my Firefox bookmarks to HTML. The bookmarks.html file is currently at 2mb due to all the propriety code and I found no way of automatically removing that code.
Is there any extension or feature to export my bookmarks in that way, or rather to clean the bookmarks.html file?

Thank you
JaredM
Posts: 3826
Joined: November 14th, 2004, 4:41 am
Location: Alberta, Canada
Contact:

Post by JaredM »

It's not because of the proprietary code, it's more likely you simply have a lot of bookmarks with custom favicons. I don't know how to prevent the favicon from being stored, but I think the max size of each favicon is like 16kb.
I'm moving to Theory, everything works there.
Most issues are solved by going through the Standard Diagnostic
Lost User 133863
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Lost User 133863 »

Favicons or no - I can't really post my bookmarks online as HTML as long as it'll make the page load slower than the collapse of flan left in a cupboard.
JaredM
Posts: 3826
Joined: November 14th, 2004, 4:41 am
Location: Alberta, Canada
Contact:

Post by JaredM »

Remove all the attributes in the "a" element except the href attribute.

and change:

Code: Select all

<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
     It will be read and overwritten.
     DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>


to

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
   <title>Bookmarks</title>
</head>
<body>


and at the very end add:

Code: Select all

</body>
</html>
I'm moving to Theory, everything works there.
Most issues are solved by going through the Standard Diagnostic
Lost User 133863
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Lost User 133863 »

Thank you, Jinexile, but that much I know for myself. The tricky part is how to remove all attributes within the anchor tag _not manually_ (when you've got hundreds of bookmarks, manually means painstakingly).
User avatar
wong888
Posts: 1512
Joined: September 22nd, 2004, 5:10 pm

Post by wong888 »

cant afford a sig.
User avatar
scratch
Posts: 4942
Joined: November 6th, 2002, 1:27 am
Location: Massachusetts

Post by scratch »

use the "delete icons" extension.
JaredM
Posts: 3826
Joined: November 14th, 2004, 4:41 am
Location: Alberta, Canada
Contact:

Post by JaredM »

Use a RegEx find/replace, most modern text editors have this functionality.
I'm moving to Theory, everything works there.
Most issues are solved by going through the Standard Diagnostic
Lost User 133863
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Lost User 133863 »

I couldn't find the 'delete icons' extension on addons.mozilla.org - could you've written the wrong name?
Lost User 133863
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Lost User 133863 »

Jinexile - I don't know how to use RegEx, sorry. If you could write it down for me I'd appreciate it tho.

Wong888 - AM-DeadLink is useful, but I can't see how is it useful in this case.
User avatar
logan
Posts: 3453
Joined: May 22nd, 2003, 3:51 pm
Location: NGC 2403
Contact:

Post by logan »

Code: Select all

        <DT><A HREF="http://www.mozilla.com/products/firefox/central.html" ICON="data:image/png;base64,..." LAST_CHARSET="ISO-8859-1" ID="rdf:#$GvPhC3">Getting Started</A>

easily accomplished with perl:

Code: Select all

while(<>) {
    s/ICON="[^\"]*" //;
    print;
}

or with vi(m):

Code: Select all

:g/ICON="[^\"]*" /s///g

http://www.gozer.org/mozilla/extensions/ for deleteicons.

I disable favicons completely; about:config -> browser.chrome.{favicons,site_icons} -> false.
casey1992
Posts: 696
Joined: December 10th, 2003, 1:20 am

Post by casey1992 »

To turn bookmark files into valid code, I've had success following these steps.

Start by running the bookmarks through <a href="http://infohound.net/tidy/">HTML Tidy Online</a>. On the web page, above the settings, follow the ">> Advanced" link. Check the box that says "Drop proprietary attributes", then run Tidy.

That'll clean out all the junk except the IDs. (They're standard code.) To get rid of those, I open my tidied file in a text editor that handles regular expressions (in my case, mi), then do a find and replace. In the find box, type...

Code: Select all

id.*"

Make sure the 'replace with' box is empty. Then hit the 'replace all' button.

The addition of a decent doctype, head information, and ending body and html tags should finish up the job.
User avatar
scratch
Posts: 4942
Joined: November 6th, 2002, 1:27 am
Location: Massachusetts

Post by scratch »

the extension is here:
http://www.gozer.org/mozilla/extensions/

not that you need it anymore.
User avatar
Grist
Posts: 836
Joined: January 27th, 2006, 9:20 pm

Post by Grist »

Load bookmarks.html in Firefox then execute this bookmarklet:

Code: Select all

javascript:(function(){ var ls=document.getElementsByTagName('*'); for (var i=0; i<ls.length; i++) {l=ls[i]; l.removeAttribute('id'); l.removeAttribute('last_charset'); l.removeAttribute('icon'); l.removeAttribute('last_modified'); l.removeAttribute('last_visit'); l.removeAttribute('add_date'); l.removeAttribute('personal_toolbar_folder');} alert('Cleanup Complete - Save as Web Page, Complete')})();


When finished, save as "Web Page, Complete".
Lost User 133863
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by Lost User 133863 »

Casey, Grist and Jinexile - thank you oh so very much!
I'm totally bookmarking this page.

Also, some of this should really go on some FAQ.
Locked