Created
August 31, 2013 05:42
-
-
Save xatier/6396411 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/env perl | |
use 5.014; | |
use WWW::Mechanize; | |
use List::MoreUtils qw(uniq); | |
# XXX: change me! | |
my $url = "625301/282f4c93aa/"; | |
my $secret = "心眼畫廊/s"; | |
my $secret2 = "心眼(短).org/g"; | |
my $mech = WWW::Mechanize->new(); | |
$mech->get($url); | |
my $ref = $mech->find_all_links( url_regex => | |
qr/($secret)\/([\d\w]{10})\/(\d+-\d+)/); | |
my @queue = ( uniq( reverse sort { urlcmp($a, $b) } | |
map { $_->url_abs() } @$ref ) ); | |
open PG, ">", "page.html"; | |
for (@queue) { | |
say "[+] getting $_"; | |
$mech->get($_); | |
my $img = ( | |
grep {!/$secret2/} | |
map { $_->url_abs() } | |
@{ $mech->find_all_images() } | |
)[0]; | |
say PG "<img src=\"$img\" /><br />"; | |
# sleep 0.01 sec, be a nice guy! | |
select undef, undef, undef, 0.01; | |
} | |
system("open page.html"); | |
close PG; | |
sub urlcmp { | |
my ($a, $b) = @_; | |
my $d1 = ($a =~ qr/($secret\/[\d\w]{10}\/\d+-)(\d+)/)[1]; | |
my $d2 = ($b =~ qr/($secret\/[\d\w]{10}\/\d+-)(\d+)/)[1]; | |
return $d1 < $d2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment