Here's a script to extract and print/save the URLs exported by the Firefox Export Bookmarks to HTML function.
I know squat about HTML, but seem to have stumbled onto a good example.
A flakey laptop is the mother of invention.
#! /usr/bin/perl
# bookmarks.pl - Script to extract and print the URLs created by the F
+irefox
# Export Bookmarks to HTML feature.
#
# James M. Lynes Jr. - KE4MIQ
# Created: June 25, 2021
# Last Modified: 06/25/2021 - Initial version
# Environment: Ubuntu 16.04 LTS
#
# Note: The raw HTML is very messy as it seems to include long strings
# of encoded images.
# Working code shamelessly stolen from the perldoc HTML::Element
# example.
use HTML::TreeBuilder;
open(my $outfile, ">", 'bookmarks.txt') or die "Can't open bookmarks.t
+xt: $!";
print $outfile "Firefox Bookmark URLs\n";
print $outfile "=====================\n";
my $tree = HTML::TreeBuilder->new();
$tree->parse_file('bookmarks.html');
for (@{ $tree->extract_links('a') }) {
my($link, $element, $attr, $tag) = @$_;
print "$link\n";
print $outfile "$link\n";
}
$tree->delete;
James
There's never enough time to do it right, but always enough time to do it over...