Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Using Web::Scraper to extract content from an HTML page

by tangent (Vicar)
on Apr 04, 2017 at 01:02 UTC ( #1186929=note: print w/replies, xml ) Need Help??

in reply to Using Web::Scraper to extract content from an HTML page

As beech points out the 'title' is in the 'img' tag not the 'a' tag so you need to account for that. Also, process_first would only work if there were multiple tags within the cell itself, not within the row. But you can skip the empty ones while looping through the results:
my $p1 = scraper { process 'table[class="dextable"] td[class="cen"]', "list[]" => scrap +er { process "a", uri => '@href'; process "img", name => '@title'; }; }; my $res = $p1->scrape( URI->new(" +") ); for my $p (@{$res->{list}}) { next unless ($p->{name} and $p->{uri}); print Encode::encode("utf8", "$p->{name}\t$p->{uri}\n"); }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-05-17 18:01 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (68 votes). Check out past polls.