Created
May 15, 2012 07:10
-
-
Save lopnor/2699697 to your computer and use it in GitHub Desktop.
This file contains 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
#!perl | |
use 5.14.2; | |
use WWW::Mechanize; | |
use Getopt::Long; | |
use Term::Prompt; | |
use URI; | |
my $username; | |
my $baseurl; | |
GetOptions( | |
'username=s' => \$username, | |
'baseurl=s' => \$baseurl, | |
); | |
$username or die; | |
$baseurl or die; | |
my $password = prompt('p', 'password :', '',''); | |
print "\n"; | |
my $mech = WWW::Mechanize->new; | |
$mech->get('https://github.com/login'); | |
$mech->submit_form( | |
form_number => 1, | |
fields => { | |
login => $username, | |
password => $password, | |
} | |
); | |
$baseurl .= '/issues' unless $baseurl =~ m{/issues$}; | |
my $i = 0; | |
while (1) { | |
$i++; | |
my $uri = URI->new("$baseurl/$i"); | |
$mech->get($uri); | |
$mech->res->code == 404 and last; | |
my $filename = $uri->path; | |
$filename =~ s{/}{_}g; | |
open my $fh, '>:utf8', $filename.'.html'; | |
print $fh $mech->content; | |
close $fh; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issueバックアップの参考になりました。ありがとうございます。
1点、
じゃないと動きませんでした。ヘッダに検索窓ができちゃった影響かなーと。