in reply to How to Run a FireFox Bookmark

Comment: Many users are saying you can't do that with WWW::Mechanize, but I don't know why not. I think you can.

Bookmarks are stored in an HTML file

I just wrote and tested the following example in Windows. The paths would be different for your environment. If you're trying to load JavaScript-generated pages, then the results may be undesirable.
#!C:\Perl\bin\ use strict; # add library path to wherever WWW::Mechanize might be use lib qw(C:\\userFoo\\myperl\\lib\\site_perl\\5.8.8); use WWW::Mechanize; my $mech = WWW::Mechanize->new(); # Create an instance of +mech my $url = 'file:///C:\Documents and Settings\userFoo\Application Data\Mozilla\Firefox\Profiles\profileBar.default\bookmarks.html'; $mech->get( $url ); # Get the bookmark file print %{$mech->follow_link( n => 11 )}; # Get and print a link's + contents



Demize

Replies are listed 'Best First'.
Re^2: How to Run a FireFox Bookmark
by Anonymous Monk on Jul 06, 2010 at 23:30 UTC
    Actually, now Firefox stores bookmarks in a SQLite database. The bookmark manager allows the user to export to or import from either HTML or JSON, but there is no HTML or JSON file that's automatically kept up to date.

    It would require gaining familiarity with the database structure, but I assume a SQLite module could handle it fine. It's just that it's not as trivial as parsing HTML any more.

      Changing browser.bookmarks.autoExportHTML from false to true in about:config should make Firefox write a classic bookmarks.html file in parallel to the SQLite database.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)