This piece of code gives a "Not found" on this article: http://www.sueddeutsche.de/politik/thailand-regierungschefin-yingluck-verliert-ihr-amt-1.1953299 although there is an article tag To test the code I changed it to grab a piece in the article tag itself:my $tree = HTML::TreeBuilder->new_from_content($webcrawler->content()) +; if (my $div = $tree->look_down(_tag => "article" )) { print $div->as_text(), "\n"; } else { print "Not found"; }
It worked as expected and printed me "Das höchste Gericht in Thailand hat entschieden: Regierungschefin Yingluck Shinawatra ist des Verfassungsbruchs schuldig. Sie wurde sofort ihres Amtes enthoben. " So I can't seem to grab the article tag itself. Since article is an html5 tag this might be the problem but how can I solve this another way?if (my $div = $tree->look_down(_tag => "p" , class=>"article entry-sum +mary")) { print $div->as_text(), "\n"; } else { print "Not found"; }
In reply to Re^2: HTML::Treebuilder look_down not working with <header>, <article> etc
by Anonymous Monk
in thread HTML::Treebuilder look_down not working with <header>, <article> etc
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |