Skip to content

Instantly share code, notes, and snippets.

@koduki
Created October 7, 2010 23:27
Show Gist options
  • Save koduki/616102 to your computer and use it in GitHub Desktop.
Save koduki/616102 to your computer and use it in GitHub Desktop.
http://book.akahoshitakuya.com/add.php?asin=4047153737&image=http%3A%2F%2Fecx.images-amazon.com%2Fimages%2FI%2F61SQSeJD7qL._SL75_.jpg&page=0&author=%E8%97%A4%E7%9C%9F%20%E6%8B%93%E5%93%89&title=%E9%AD%94%E6%B3%95%E5%B0%91%E5%A5%B3%E3%83%AA%E3%83%AA%E3%82%AB%E3%83%AB%E3%81%AA%E3%81%AE%E3%81%AFViVid%20%281%29%20%28%E8%A7%92%E5%B7%9D%E3%82%B3%E3%83%9F%E3%83%83%E3%82%AF%E3%82%B9%E3%83%BB%E3%82%A8%E3%83%BC%E3%82%B9%20169-2%29&type=tun
http://book.akahoshitakuya.com/add.php?asin=4048688367&title=%e3%83%86%e3%82%b9%e3%83%88
https://order.my.rakuten.co.jp/?page=myorder&act=window&page_num=1&display_span=2008&display_month=all&search_item=&search_shop=&page=myorder&page_num=1
agent = WWW::Mechanize.new
agent.user_agent_alias = 'Windows IE 7'
page = agent.get('https://order.my.rakuten.co.jp/?page=myorder&act=window&page_num=1&display_span=2008&display_month=all&search_item=&search_shop=&page=myorder&page_num=1')
page.forms[1].fields_with(:name => 'u').first.value = ''
page.forms[1].fields_with(:name => 'p').first.value = ''
page = page.forms[1].click_button
page.at('div.itemBlock').at('.itemName').text
page.at('div.itemBlock').at('.day').text
page.at('div.itemBlock').search('dd')[1].text
page.at('div.itemBlock').search('dd')[2].text
page.at('div.itemBlock').at('a @href').value
def date d
ds = d.split(/\D/).map{|x| x.to_i}
Date.new(*ds)
end
def money value
value.text.gsub(/\D/,'')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment