in reply to How to pull author, title using ISBN (WWW::Scraper::ISBN)?

Thank you for pointing that out hippo and NetWallah. I did make use of the synopsis and it gives new error now.

Code:

#!~/perl5/perlbrew/perls/perl-5.28.1/bin/perl use Modern::Perl; use WWW::Scraper::ISBN; my $scraper = WWW::Scraper::ISBN->new(); $scraper->drivers("LOC", "ISBNnu"); my $isbn = "9780134511184"; my $record = $scraper->search($isbn); if($record->found) { print "Book ".$record->isbn." found by driver ".$record->found_in. +"\n"; my $book = $record->book; print $book->{'title'}; print $book->{'author'}; } else { print $record->error; }

Error:

Cannot start LOC query session. isbn.nu website appears to be unavailable.

I checked and found that https://www.isbn.nu is working and I can search same ISBN there without any issue. I found the error is coming from ~/perlbrew/perls/perl-5.28.1/lib/site_perl/5.28.1/WWW/Scraper/ISBN/ISBNnu_Driver.pm So I am checking that code to see if I can change something there to make it working.

Here is the code that's generating this error:

sub search { my ($self,$isbn) = @_; my %data; $self->found(0); $self->book(undef); my $post_url = "https://isbn.nu/".$isbn; my $mech = WWW::Mechanize->new(); $mech->agent_alias( 'Linux Mozilla' ); $mech->add_header( 'Accept-Encoding' => undef ); eval { $mech->get( $post_url ) }; return $self->handler("isbn.nu website appears to be unavailable." +) if($@ || !$mech->success() || !$mech->content());

Seems one of the three conditions in if are returning true and so the error. I am testing by inserting some prints. Will share here what I find.