I’m trying to create a small Rails application that will parse the FedEx site for my tracking information. I tried to use Nokogiri to parse the site but it seems that the content on the site is loaded via Ajax and I’m not able to capture it.
Here is the code that I was testing with:
require 'rubygems'
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open('https://www.fedex.com/fedextrack/?cntry_code=us&tab=1&tracknums=543433298736'))
doc.xpath('//*[(@id = "destinationDateTime")]').each do |status|
puts status.content
end
Any help on this would be wonderful.
This code get’s the job done 🙂