| 1 | package WWW::PDAScraper::NewYorker; | ||
| 2 | |||
| 3 | # PDAScraper.pm rules for scraping the | ||
| 4 | # NewYorker website | ||
| 5 | |||
| 6 | sub config { | ||
| 7 | return { | ||
| 8 | name => 'New Yorker', | ||
| 9 | # Name of the website. Arbitrary text. | ||
| 10 | |||
| 11 | start_from => 'http://www.newyorker.com/', | ||
| 12 | # URL where the scraper should find the links. | ||
| 13 | |||
| 14 | url_regex => [ | ||
| 15 | '^/([^/]+)/\D+(\d+\D+\d*)$', | ||
| 16 | sub { \ "/printables/$1/$2" } | ||
| 17 | ], | ||
| 18 | |||
| 19 | link_spec => [sub { $_[0]->as_text ne 'archive' | ||
| 20 | && $_[0]->as_text ne 'The Hard Drive' | ||
| 21 | && $_[0]->attr( 'href' ) !~ /captioncontest/ }], | ||
| 22 | |||
| 23 | chunk_regex => qr{<table width="100%" class="indexes" cellspacing="0" cellpadding="0" border="0">(.*?)<div class="cartoonunit">}s | ||
| 24 | |||
| 25 | }; | ||
| 26 | } | ||
| 27 | |||
| 28 | 1; |