Change attrs() for attr() to work with mojo::ua 4.x
[cascardo/www-eztv.git] / lib / WWW / EZTV.pm
index d2bde1f..f45c083 100644 (file)
@@ -25,7 +25,7 @@ sub _build_shows {
         my $link = $tr->at('td:nth-child(1) a');
         WWW::EZTV::Show->new(
             title  => $link->all_text,
-            url    => $self->url->clone->path($link->attrs('href')),
+            url    => $self->url->clone->path($link->attr('href')),
             status => lc($tr->at('td:nth-child(2)')->all_text),
             rating => $tr->at('td:nth-child(3)')->all_text
         );
@@ -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.