in reply to Re: quite SOLVED Re^4: parsing html
in thread parsing html
if I understand correctly, I can do something like this, to parse without download the web page...
#!/usr/local/bin/perl use warnings; use strict; use LWP::Simple; my $url="http://microrna.sanger.ac.uk/cgi-bin/targets/v5/detail_view.p +l?transcript_id=ENST00000226253"; my $content=get ($url); use HTML::TreeBuilder; my $p = HTML::TreeBuilder->new; $p->parse_content($content); # parse_content if you have a string my @tds = $p->look_down(_tag => q{td}); # get a list of all the td tag +s for my $td (@tds){ my $bold = $td->look_down(_tag => q{b}); # look for a bold tag if ($bold){ print $bold->as_text, qq{\n}; # if there is one print the text } } $p->delete; # when you've finished with it
but I don't understand why it doesn't give back me nothing, it seems as the content of the page has no bold string...that impossible...I see them and If I download the page like before and then do the parsing...it works...could you explain me why :-(... thanks too much
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: quite SOLVED Re^4: parsing html
by wfsp (Abbot) on May 15, 2009 at 11:00 UTC | |
by paola82 (Sexton) on May 15, 2009 at 11:26 UTC |