Wednesday 15 January 2014

html - Why can't I reach this div? -


Text after "

I am using Nokogiri to parse this page:

When I have the element that I want to capture the inspection, I think about it in a & lt; Div & gt; with ID = "data_i84"

However, I'm getting this:.

  irb> Doc.css ("# data_i84") = & gt; []   

It does not appear when I search for "see page source" and " data_i84 "

What is something I am missing here ". I thought it would be straight ahead.

Scrap Ajax data to get the correct url, then find it correctly to parse the response:

  requires 'nokogiri' There is 'open uri' required 'json' # You can find ajax URL in your browser's network tab, or use a debugging proxy like Charles Or Fiddler ajax_url = 'http://financials.morningstar.com/ajax/ReportProcess4HtmlAjax.html?&t=GE&region=usa&culture=en-US&cur= in US Dollar & amp; reportType = & amp; , Duration = 12 & amp; datatype = & amp; command = asc & amp; columnYear = 5 & amp; rounding = 3 and visible = raw & amp; r = 356282 & amp; callback = jsonp1371870522408 & amp; _ = 1371870527498 Feedback = open (ajax_url) .read # Here's how you parse jsonp data JSON = JSON.parse feedback [/ {. *} / Html # is a field that is called doc = Nokog Iri: : HTML json ['Result'] doc.css ("# data_i84") # You should now see it .    

No comments:

Post a Comment