Skip to content

Instantly share code, notes, and snippets.

@JEEN
Last active December 17, 2015 08:39
Show Gist options
  • Save JEEN/5581298 to your computer and use it in GitHub Desktop.
Save JEEN/5581298 to your computer and use it in GitHub Desktop.
Percona MySQL Conference and Expo 2013 의 슬라이드를 모조리 다운로드 받는 스크립트 입니다.
#!/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