use WWW::Mechanize;
my $mech = WWW::Mechanize->new;
$mech->get( $url );
say $mech->text;我如何才能获得与Mojo::UserAgent相同的结果
我试过了,但返回的结果不一样:
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
say $ua->get( $url )->res->dom->all_text;发布于 2012-01-30 22:50:23
只需重复method text所做的事情:参见as_text in HTML::Element。
发布于 2012-01-30 23:59:43
你可以试试
$ua->get( $url )->res->dom->all_text(0);用于未修剪的输出。或者,您可能需要在子节点上进行某种遍历。
https://stackoverflow.com/questions/9065440
复制相似问题