Final adjustments to video download script.
This commit is contained in:
parent
634924e002
commit
8ab83b84e9
1 changed files with 16 additions and 10 deletions
|
@ -32,7 +32,7 @@ foreach my $dir ("html", "videos", "log") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
die "usage: $0 PASSWORD STAKES GAME_TYPE" unless @ARGV == 3;
|
die "usage: $0 PASSWORD [STAKES] [GAME_TYPE]" if @ARGV < 1 or @ARGV > 3;
|
||||||
|
|
||||||
my $passfile = $ARGV[0];
|
my $passfile = $ARGV[0];
|
||||||
|
|
||||||
|
@ -100,10 +100,17 @@ sub redo_login {
|
||||||
}
|
}
|
||||||
&redo_login();
|
&redo_login();
|
||||||
|
|
||||||
$mech->get("http://www.deucescracked.com/videos");
|
my $page = $mech->get("http://www.deucescracked.com/videos");
|
||||||
my $page= $mech->submit_form(form_number => 1,
|
if (defined $stakes and defined $gameType) {
|
||||||
fields => { stakes => $stakes, game_type => $gameType });
|
$page = $mech->submit_form(form_number => 1,
|
||||||
|
fields => { stakes => $stakes, game_type => $gameType });
|
||||||
|
} elsif (defined $stakes) {
|
||||||
|
$page = $mech->submit_form(form_number => 1,
|
||||||
|
fields => { stakes => $stakes });
|
||||||
|
} elsif (defined $gameType) {
|
||||||
|
$page = $mech->submit_form(form_number => 1,
|
||||||
|
fields => { stakes => $stakes, game_type => $gameType });
|
||||||
|
}
|
||||||
open(TITLE_LOG, ">>", "log/title.log") or die "unable to open title.log for writing: $!";
|
open(TITLE_LOG, ">>", "log/title.log") or die "unable to open title.log for writing: $!";
|
||||||
select(TITLE_LOG); $| = 1; select(STDERR); $| = 1; select(STDOUT);
|
select(TITLE_LOG); $| = 1; select(STDERR); $| = 1; select(STDOUT);
|
||||||
|
|
||||||
|
@ -127,16 +134,15 @@ foreach my $videoURL (@allVideoLinks) {
|
||||||
my $v = sprintf("%.4d", $count);
|
my $v = sprintf("%.4d", $count);
|
||||||
my $title = encode('UTF-8', $videoURL->text());
|
my $title = encode('UTF-8', $videoURL->text());
|
||||||
print STDERR "Downloading $v: ", $title, " .... ";
|
print STDERR "Downloading $v: ", $title, " .... ";
|
||||||
if (defined $haveTitle{$title}) {
|
|
||||||
print STDERR ".... already have.\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
if ( ($count % 10) == 0) {
|
if ( ($count % 10) == 0) {
|
||||||
print STDERR " ... redoing login ...";
|
print STDERR " ... redoing login ...";
|
||||||
&redo_login;
|
&redo_login;
|
||||||
}
|
}
|
||||||
|
if (defined $haveTitle{$title}) {
|
||||||
|
print STDERR ".... already have.\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
$mech->get($videoURL->url_abs());
|
$mech->get($videoURL->url_abs());
|
||||||
|
|
||||||
my $videoResponse = $mech->follow_link(text_regex => qr/Download full/i);
|
my $videoResponse = $mech->follow_link(text_regex => qr/Download full/i);
|
||||||
my $filename = $videoResponse->filename();
|
my $filename = $videoResponse->filename();
|
||||||
$filename =~ s/-/_/g;
|
$filename =~ s/-/_/g;
|
||||||
|
|
Loading…
Add table
Reference in a new issue