root/lang/perl/WWW-MobileCarrierJP/trunk/lib/WWW/MobileCarrierJP/ThirdForce/HTTPHeader.pm @ 29939

Revision 29939, 1.5 kB (checked in by tokuhirom, 5 years ago)

f*cking softbank changes some symbols. are you person of leisure?

Line 
1package WWW::MobileCarrierJP::ThirdForce::HTTPHeader;
2use strict;
3use warnings;
4use utf8;
5use WWW::MobileCarrierJP::Declare;
6
7my $url = 'http://creation.mb.softbank.jp/terminal/?lup=y&cat=http';
8
9parse_one(
10    urls  => [$url],
11    xpath => '//div/table/tr/td/table[@bordercolor="#999999"]/tr[not(@bgcolor="#ee9abb") and not(@bgcolor="#cccccc") and count(child::td) = 8]',
12    scraper => scraper {
13        process 'td:nth-child(1)', 'model', 'TEXT';
14
15        process 'td:nth-child(2)', 'x-jphone-name',    'TEXT';
16        process 'td:nth-child(3)', 'x-jphone-display', [ 'TEXT', \&_asterisk ];
17        process 'td:nth-child(4)', 'x-jphone-color',   'TEXT';
18        process 'td:nth-child(5)', 'x-jphone-sound', [ 'TEXT', \&_undefine ];
19        process 'td:nth-child(6)', 'x-jphone-smaf',  [ 'TEXT', \&_undefine ];
20
21        # maybe, no person needs x-s-* information.
22        # and, I don't want to maintenance this header related things :P
23        #   process 'td:nth-child(6)', 'x-s-display-info', [ 'TEXT', \&_undefine, ];
24        #   process 'td:nth-child(7)', 'x-s-unique-id',    [ 'TEXT', \&_undefine, ];
25    },
26);
27
28sub _asterisk { s/ x /*/ }
29
30sub _undefine {
31    my $x = shift;
32    $x =~ /^(?:−|-|\x{d7})$/ ? undef : $x;
33}
34
351;
36__END__
37
38=head1 NAME
39
40WWW::MobileCarrierJP::ThirdForce::HTTPHeader - get HTTPHeader informtation from ThirdForce site.
41
42=head1 SYNOPSIS
43
44    use WWW::MobileCarrierJP::ThirdForce::HTTPHeader;
45    WWW::MobileCarrierJP::ThirdForce::HTTPHeader->scrape();
46
47=head1 AUTHOR
48
49Tokuhiro Matsuno < tokuhirom gmail com >
50
51=head1 SEE ALSO
52
53L<WWW::MobileCarrierJP>
54
Note: See TracBrowser for help on using the browser.