PDAScraper/NewYorker.pm untested

filter: Statementstmt 0.0% 0 / 5 Branchbran n/a Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 1 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 16 CC 1 SCAR 6.9
CC
1
Cov
0%
config
2.0
CRAP 2.0
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;