Last active
December 17, 2015 08:39
-
-
Save JEEN/5581298 to your computer and use it in GitHub Desktop.
Percona MySQL Conference and Expo 2013 의 슬라이드를 모조리 다운로드 받는 스크립트 입니다.
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 strict; | |
use warnings; | |
use Web::Query; | |
use URI; | |
use AnyEvent::HTTP::LWP::UserAgent; | |
use Coro; | |
my $ua = AnyEvent::HTTP::LWP::UserAgent->new; | |
my $uri = URI->new('http://www.percona.com/live/mysql-conference-2013/slides'); | |
map { $_->join } | |
map { | |
my $url = $_; | |
async { | |
wq($ua->get($url)->content) | |
->find('div.views-field-field-session-slides') | |
->each(sub { | |
my ($idx, $elm) = @_; | |
my $slide_url = $elm->find('div.field-content>a')->attr('href'); | |
my ($file) = $slide_url =~ /([^\/]+.)$/; | |
$ua->mirror($slide_url, $file); | |
print "Download : $file\n"; | |
}); | |
}; | |
} | |
map { my $_uri = $uri->clone; $_uri->query_form( page => $_ ); $_uri } | |
('', 1, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment