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.


In reply to Re: How to pull author, title using ISBN (WWW::Scraper::ISBN)? by Perl300
in thread How to pull author, title using ISBN (WWW::Scraper::ISBN)? by Perl300

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.