Created
January 14, 2010 15:22
-
-
Save halka/277259 to your computer and use it in GitHub Desktop.
クロネコヤマトの荷物追跡ページをパースして最新の状況を表示します
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mechanize' | |
require 'kconv' | |
#伝票番号 | |
num=xxxxxxxxx | |
agent = WWW::Mechanize.new | |
agent.user_agent_alias = 'Mac Safari' | |
page = agent.get('http://toi.kuronekoyamato.co.jp/cgi-bin/tneko') | |
search_form = page.forms.first | |
search_form.number01=num | |
res=agent.submit(search_form) | |
detail=res.root.search("table.meisai").search("td") | |
l=detail.length | |
puts ("荷物状況 : "+detail[l-5]).tosjis | |
puts ("更新日 : "+detail[l-4]+" "+detail[l-3]).tosjis | |
print ("担当店 : "+detail[l-2]).tosjis |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment