ScraperPOD 3.05 review
DownloadScraperPOD is a framework for scraping results from search engines. SYNOPSIS use WWW::Scraper; # Name your Scraper module /
|
|
ScraperPOD is a framework for scraping results from search engines.
SYNOPSIS
use WWW::Scraper;
# Name your Scraper module / search engine as the first parameter,
use WWW::Scraper('eBay');
# or in the new() method
$scraper = new WWW::Scraper('eBay');
Classic WWW::Search mode
# Use a Scraper engine just as you would a WWW::Search engine.
$scraper = new WWW::Scraper('carsforsale', 'Honda', { 'lbxModel' => 'Accord', 'lbxVehicleYearFrom' => 1998 });
while ( $response = $scraper->next_result() ) {
# harvest results via hash-table reference.
print $scraper->{'sellerPhoneNumber'};
}
Canonical Request/Response mode (not yet implemented)
$scraper = new WWW::Scraper('carsforsale', 'Request' => 'Autos', 'Response' => 'Autos');
# or, since 'carsforsale.pm' defaults to the Request and Response classes of 'Autos'
$scraper = new WWW::Scraper('carsforsale');
#
# Set field values via field-named canonical access methods.
$scraper->scraperRequest->make('Honda');
$scraper->scraperRequest->model('Accord');
$scraper->scraperRequest->minYear(1998);
#
# Note: this is *not* next_result().
while ( $response = $scraper->next_response() ) {
#
# harvest results via field-named access methods.
print $response->sellerPhoneNumber();
}
Variant Requests to a single search engine
$scraper = new WWW::Scraper('carsforsale');
$scraper->scraperRequest->make('Honda');
$scraper->scraperRequest->minYear(1998);
#
for ( $model = ('Accord' 'Civic') ) {
$scraper->scraperRequest->model($model);
$response = $scraper->next_response() ) {
# all response fields are returned as a reference to the value.
print ${$response->sellerPhoneNumber()};
}
Single Request to variant search engines
# Set the request parameters in a Request object (sub-class 'Autos').
$request = new WWW::Scraper::Request('Autos');
$request->make('Honda');
$request->model('Accord');
$request->minYear(1998);
#
for ( $searchEngine = ('carsforsale' '1001cars') ) {
$scraper = new WWW::Scraper($searchEngine, 'Request' => $request);
for ( $response = $scraper->next_response() ) {
# all response fields are returned as a reference to the value.
print ${$response->sellerPhoneNumber()};
Requirements:
Perl
ScraperPOD 3.05 keywords