-
-
Save mcandre/5707929 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -ws | |
# | |
# just-the-tables.pl | |
# | |
# Summary | |
# | |
# Strips most HTML formatting, leaving tables. | |
# | |
# Example | |
# | |
# ./just-the-tables.pl <URL> | |
# | |
# The output can be saved to a file, | |
# or rendered with a command line browser. | |
# | |
# ./just-the-tables.pl <URL> > output.html | |
# links output.html | |
use HTML::Scrubber; | |
use HTML::Entities qw(decode_entities); | |
use Text::Unidecode qw(unidecode); | |
use LWP::Simple qw(get); | |
die `more $0` unless $#ARGV == 1; | |
my $HTML = get($ARGV[1]); | |
my $scrubber = HTML::Scrubber->new( allow => qw[table tr td] ); | |
my $scrubber = $scrubber->scrub($HTML); | |
print unidecode(decode_entities($scrubber)) . "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment