Skip to content

Instantly share code, notes, and snippets.

@halka
Created January 14, 2010 15:22
Show Gist options
  • Save halka/277259 to your computer and use it in GitHub Desktop.
Save halka/277259 to your computer and use it in GitHub Desktop.
クロネコヤマトの荷物追跡ページをパースして最新の状況を表示します
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