Perl parse links from HTML Table -
i'm trying links table in html. using html::tableextract, i'm able parse table , text (i.e. ability, abnormal in below example) cannot link involves in table. example,
<table id="alphabettable"> <tr> <td> <a href="/cate/a/ability">ability</a> <span class="count">2650</span> </td> <td> <a href="/cate/a/abnormal">abnormal</a> <span class="count">26</span> </td> </table>
is there way link using html::tableextract ? or other module possibly use in situation. thanks
part of code:
$mech->get($link->url()); $te->parse($mech->content); foreach $ts ($te->tables){ foreach $row ($ts->rows){ print @$row[0]; #it prints text part #but want link } }
html::linkextor, passing extracted table text parse method.
my $le = html::linkextor->new(); foreach $ts ($te->tables){ foreach $row ($ts->rows){ $le->parse($row->[0]); $link_tag ( $le->links ) { ($tag, %links) = @$link_tag; # next if $tag ne 'a'; # exclude other kinds of links? print values %links; } } }
Comments
Post a Comment