Skip to content

Instantly share code, notes, and snippets.

@vyuh
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vyuh/6024baf96e9131a67882 to your computer and use it in GitHub Desktop.
Save vyuh/6024baf96e9131a67882 to your computer and use it in GitHub Desktop.
Fetches all links as of now. eventually, i want it to remove duplicate bookmarks and then sort them
#!/usr/bin/perl
use HTML::TreeBuilder::XPath;
my $file = shift; # first argument is bookmarks HTML filepath
my $tree = new HTML::TreeBuilder::XPath;
$tree->parse_file($file);
use Data::Dumper;
my @links = $tree->findnodes('//a');
use List::Flatten;
print join ' ', flat @{$_}{ qw/href _content/ }, "\n" for (@links);
#woah http://www.perlmonks.org/?node=References%20quick%20reference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment