Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 11:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found