Web::Query - Yet another scraping library like jQuery
use Web::Query; wq('http://google.com/search?q=foobar') ->find('h2') ->each(sub { my $i = shift; printf("%d) %s\n", $i+1, $_->text });
Web::Query is a yet another scraping framework, have a jQuery like interaface.
Yes, I know ingy's pQuery. But it's just a alpha quality. It doesn't works. Web::Query built at top of the CPAN modules, HTML::TreeBuilder::XPath, LWP::UserAgent, and HTML::Selector::XPath.
So, this module uses HTML::Selector::XPath, then this module only supports CSS3 selector supported by HTML::Selector::XPath. Web::Query doesn't support jQuery's extended quries(yet?).
THIS LIBRARY IS UNDER DEVELOPMENT. ANY API MAY CHANGE WITHOUT NOTICE.
This is a shortcut for Web::Query->new($stuff). This function is exported by default.
Web::Query->new($stuff)
Create new instance of Web::Query. You can make the instance from URL(http, https, file scheme), HTML in string, URL in string, URI object, and instance of HTML::Element.
Create new instance of Web::Query from instance of HTML::Element.
Create new instance of Web::Query from html.
Create new instance of Web::Query from url.
Create new instance of Web::Query from file name.
Get/set the innerHTML.
Get/Set the inner text.
Get/Set the attribute value in element.
Visit each nodes. $i is a counter value, 0 origin. $elem is iteration item. $_ is localized by $elem.
$i
$elem
$_
Back to the before context like jQuery.
Tokuhiro Matsuno <tokuhirom AAJKLFJEF GMAIL COM>
pQuery
Copyright (C) Tokuhiro Matsuno
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Web::Query, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Web::Query
CPAN shell
perl -MCPAN -e shell install Web::Query
For more information on module installation, please visit the detailed CPAN module installation guide.