download ikea-xpath.pl
Language: Perl
LOC: 29
Project Info
test-akihito-project - This is Test Project(test-akihito-project)
Server: Google
Type: svn
...ito‑project\trunk\perl\bot\
   author.pl
   flickr.pl
   ikea-xpath.pl
   ikea.pl
   japanese_kotowaza.pl
   nirayama.pl
   nitori.pl
   webscpaper_filter.pl

#!/usr/bin/perl

use Web::Scraper;
use URI;
use YAML;

my $domein = 'http://www.ikea.com';
my $url = 'http://www.ikea.com/jp/ja/catalog/news/range/';

my $scraper = scraper {
   process '//title','title' => 'TEXT'; 
   process '//div[@class="productNavigation"]//div[@class="productItem"]/span[@class="prodName"]','products[]' =>
       scraper {
            process '//a','category'   => 'TEXT';
            process '//a','list'       => sub{
                                            my $cat_url = $domein.$_->attr_get_i('href');
                                            scraper {
                                                process '//div[@class="productPadding"]','data[]' => 
                                                    scraper {
                                                        process '//a','link'                         => '@HREF';
                                                        process '//img','image'                      => '@SRC';
                                                        process '//span[@class="prodName"]','name'   => 'TEXT';
                                                        process '//span[@class="prodDesc"]','dec'    => 'TEXT';
                                                        process '//span[@class="prodPrice"]','price' => 'TEXT';
                                                    };
                                               result qw/data/
                                            }->scrape(URI->new($cat_url));
                                       };
      };
   result qw/title products/
}->scrape(URI->new($url));

print YAML::Dump($scraper);

__END__

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us