Web::ScraperでDellオーダーステータスを取得して凹む
最近これを叩くのが日課になってます。
use strict; use warnings; use Web::Scraper; use WWW::Mechanize; use URI; my $type = 'ponum'; my $cnum = '******'; my $lnum = '******'; my $url = 'https://jpapp1.jp.dell.com/orderstatus/multiple.asp'; my %type_label = ( 'custnum' => '顧客番号', 'ponum' => '客様注文番号', 'irn' => 'ELLオンラインストアでご注文時のご注文No', 'yahooordernum' => 'Yahooショッピングでご注文時のご注文No', 'loancontractnum' => 'デルらくらく分割 ジャックス会員番号', 'leasecontractnum' => 'リース契約番号', ); my $scraper = scraper { process '//td[@width="108"][1]//a', 'order_num' => 'TEXT'; process '//td[@width="108"][1]//a', 'order_link' => ['@href', sub { URI->new_abs($_, $url)->as_string; }]; process '//td[@width="108"][2]', 'customer_num' => 'TEXT'; process '//td[@width="108"][3]', 'delivery_date' => 'TEXT'; process '//td[@width="108"][4]', 'status' => 'TEXT'; }; my $mech = WWW::Mechanize->new; $mech->post( $url, { stype => $type, customer_number => $cnum, link_number => $lnum, } ); my $content = $mech->content; my $res = $scraper->scrape(\$content); use YAML; warn Dump $res;
--- customer_num: ***** delivery_date: 2009/02/02 order_link: https://jpapp1.jp.dell.com/orderstatus/single.asp?flg=1 order_num: ***** status: 製造工程
毎日凹んでる。