X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fwww-eztv.git;a=blobdiff_plain;f=lib%2FWWW%2FEZTV.pm;h=5953bbb681f9cca172ed37d1e20183d21e499068;hp=d2bde1fee7ff9a995546a7175c148887504b2b03;hb=0c136ed3095264fd92280b8ce840fcbc719be34a;hpb=e3142e3a240afca9f0ac4cf9d4a7c4eb45c701e2 diff --git a/lib/WWW/EZTV.pm b/lib/WWW/EZTV.pm index d2bde1f..5953bbb 100644 --- a/lib/WWW/EZTV.pm +++ b/lib/WWW/EZTV.pm @@ -5,10 +5,10 @@ use WWW::EZTV::Show; # ABSTRACT: EZTV scrapper -has url => ( is => 'ro', lazy => 1, default => sub { Mojo::URL->new('http://eztv.it/') } ); +has url => ( is => 'ro', lazy => 1, default => sub { Mojo::URL->new('https://eztv.ch/') } ); has url_shows => ( is => 'ro', lazy => 1, default => sub { shift->url->clone->path('/showlist/') } ); -has shows => +has shows => is => 'ro', lazy => 1, builder => '_build_shows', @@ -20,14 +20,14 @@ has shows => sub _build_shows { my $self = shift; - $self->get_response( $self->url_shows )->dom->find('table.forum_header_border tr[name="hover"]')->map(sub { + $self->get_response( $self->url_shows )->dom->find('table.header_brd tr[name="hover"]')->map(sub { my $tr = shift; - my $link = $tr->at('td:nth-child(1) a'); + my $link = $tr->at('td:nth-child(2) a'); WWW::EZTV::Show->new( title => $link->all_text, - url => $self->url->clone->path($link->attrs('href')), - status => lc($tr->at('td:nth-child(2)')->all_text), - rating => $tr->at('td:nth-child(3)')->all_text + url => $self->url->clone->path($link->attr('href')), + status => lc($tr->at('td:nth-child(3)')->all_text), + rating => $tr->at('td:nth-child(4)')->text + 0 ); }); } @@ -36,20 +36,24 @@ sub _build_shows { =head1 SYNOPSIS -First create a WWW::EZTV object to navigate. - use WWW::EZTV; + use v5.10; my $eztv = WWW::EZTV->new; + # Find one show my $show = $eztv->find_show(sub{ $_->name =~ /Walking dead/i }); + # Find one episode my $episode = $show->find_episode(sub{ $_->season == 3 && $_->number == 8 && $_->quality eq 'standard' }); + # Get first torrent url for this episode + say $episode->find_link(sub{ $_->type eq 'torrent' })->url; + =attr url EZTV URL.