stable script
This commit is contained in:
commit
65fde136f9
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
tracklist.txt
|
51
DDtracklist.pl
Normal file
51
DDtracklist.pl
Normal file
@ -0,0 +1,51 @@
|
||||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
use HTML::TableExtract;
|
||||
use LWP::Simple;
|
||||
use feature "unicode_strings";
|
||||
use open ':std', ':encoding(UTF-8)';
|
||||
|
||||
my $content;
|
||||
my $url;
|
||||
|
||||
binmode STDOUT, ":utf8";
|
||||
|
||||
print "Enter a webpage to extract:\n";
|
||||
$url = <STDIN>;
|
||||
$content = get( $url );
|
||||
die "Couldn't get URL" unless defined $content;
|
||||
|
||||
open( my $fh, ">:utf8", 'tracklist.txt');
|
||||
|
||||
my $te = HTML::TableExtract->new();
|
||||
$te->parse( $content );
|
||||
|
||||
foreach my $ts ( $te->tables() )
|
||||
{
|
||||
foreach my $row ( $ts->rows() )
|
||||
{
|
||||
my $count = 0;
|
||||
foreach my $element ( @$row )
|
||||
{
|
||||
$element =~ s/^\s+|\s+$//g; #remove all whitespace
|
||||
if ($count == 1)
|
||||
{
|
||||
print "$element/";
|
||||
print $fh "$element/";
|
||||
}
|
||||
if ($count == 2)
|
||||
{
|
||||
print "$element";
|
||||
print $fh "$element";
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
print "\n";
|
||||
print $fh "\n";
|
||||
}
|
||||
}
|
||||
|
||||
close $fh;
|
||||
|
||||
|
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
||||
A script for pulling the tracklist of albums I purchase from diverse.direct.
|
||||
|
||||
Run the script using the perl interpreter and enter the full url to the page of the CD you wish you dump the tracklist info.
|
||||
|
||||
The output is dumped into the tracklist file.
|
||||
|
||||
The file is overwritten on each run.
|
||||
|
||||
I added some text here to test something...
|
Loading…
Reference in New Issue
Block a user