Firefox bookmarks.html convertor for Dillo

Nick Warne <nick-ucsffw2X/[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
Hi all,

Attached is a short perl script that converts FF bookmarks.html (which
can be exported within FF itself) to Dillo format bm.txt.

Simple to use, and the code has brief instructions.

The only thing I am not sure about is if different versions of FF use
the same bookmarks.html format.

Nick
-- 
Gosh that takes me back... or is it forward?  That's the trouble with
time travel, you never can tell."
		-- Doctor Who "Androids of Tara"

_______________________________________________
Dillo-dev mailing list
[email protected]
http://lists.dillo.org/cgi-bin/mailman/listinfo/dillo-dev
ff_to_bm.pl (application/x-perl, 1 KB)
#!/usr/bin/perl -w
# Copywrite Nick Warne 14/05/2016
# Licence: Public Domain 
# Firefox bookmarks.html converter for Dillo bm.txt
# 
# To use:  place this script in the same directory as your
# saved Firefox bookmarks.html file, and run 'perl ff_to_bm.pl'
# Output to stdout:  when happy, add the results to your bm.txt

my @urls;
my $line;
my $name;

# Assume Dillo user already has :s0: bookmark section
# This can be changed to suit (i.e. if you have :s0: and :s1:, set this to 1)
my $count = 0;

open (BM, "< bookmarks.html");
@urls= <BM>;
close (BM);

foreach $line (@urls) {
$line =~ tr/ //ds;

  if ($line =~ /\<\/H3\>/i) {
     $count = $count+1;
     $line =~ s/.*\<.*\"\>//gi;
     $line =~ s/\<\/H3\>//gi;
     $line = ":s".$count.": ".$line;;
     print $line;
  }
 
 if ($line =~ /HREF/) {
     $line =~ s/.*HREF\=\"//gi;
     $name = $line;
     $line =~ s/\"ADD.*//gi;
     chomp($line);
     $name =~ s/.*\"\>//gi;
     $name =~ s/\<\/A\>//gi;
     $line = "s".$count." ".$line." ".$name;
     print $line;
 }

}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.