daily pastebin goal
33%
SHARE
TWEET

traking post

a guest Jun 21st, 2012 141 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #coding: utf-8
  2. require 'mechanize'
  3. BarCode = ["RA527000858CN","RA527000858CN"]
  4.  
  5. BarCode.each do |f|
  6. agent = Mechanize.new
  7. uri = 'http://russianpost.ru/resp_engine.aspx?Path=rp/servise/ru/home/postuslug/trackingpo'
  8. page = agent.post(uri, {'BarCode' => f,'searchsign' => 1})
  9. last=page.search('div.container7 table.pagetext tbody tr:last')
  10. data = [last.at_css("td[1]"), last.at_css("td[2]"),last.at_css("td[5]")]
  11. begin
  12.   puts "\nКод: #{f}"
  13.   puts "Операция: #{data[0].inner_text}"
  14.   puts "Дата:   #{data[1].inner_text}"
  15.   puts "Отрибуты: #{data[2].inner_text}"
  16. rescue
  17. puts "Ошибка"
  18. end
  19. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top