Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: HTML::TokeParser not giving any tokens.

by karlgoethebier (Abbot)
on Dec 01, 2014 at 13:06 UTC ( #1108826=note: print w/replies, xml ) Need Help??


in reply to HTML::TokeParser not giving any tokens.

Try this:

if ( $response->is_success ) { my $tp = HTML::TokeParser->new( \$response->decoded_content ) || die "Can't open: $!"; while ( my $token = $tp->get_tag('img') ) { print $token->[1]->{'src'}, qq{\n}; } } else { print $response->decoded_content; die $response->status_line; } __END__ Starting...<br /><br /><br />Success!http://www.projectwonderful.com/n +ojs.php?id=39770&type=5 http://www.questionablecontent.net/images/patreonad.png ../images/logo14.png http://www.questionablecontent.net/comics/2845.png http://www.questionablecontent.net/images/1s1k.gif http://www.questionablecontent.net/images/station.gif http://www.questionablecontent.net/images/qc-vol04.jpg http://www.questionablecontent.net/images/yelingboard.jpg http://www.questionablecontent.net/images/18x24.jpg http://www.questionablecontent.net/images/mlgshirt.jpg ../images/ag.gif http://api.flattr.com/button/flattr-badge-large.png http://www.questionablecontent.net/images/patreonad2.png http://www.projectwonderful.com/nojs.php?id=138&type=2

Update: Added output. NB.: Saw solution above too late :-(

Regards, Karl

«The Crux of the Biscuit is the Apostrophe»

Replies are listed 'Best First'.
Re^2: HTML::TokeParser not giving any tokens.
by rbhyland (Acolyte) on Dec 01, 2014 at 13:47 UTC

    Thanks! I'm using your solution. There's no substitute for understanding. I see now what I did wrong, which is the most important thing.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1108826]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (None)
    As of 2021-10-18 01:56 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My first memorable Perl project was:







      Results (72 votes). Check out past polls.

      Notices?