Hi
I was parsing one web page, where data are loaded dynamically when a
search criterion are given, but no change has been seen in the browser
url, it is still then "https://www.kleyntrucks.com/trucks/tractorunit/".
Thus below code is not helpful to get the right data, as per the search
criterion. Suppose I set the the search field "Matriculation year" as
2003 to 2005, and then if you look at the url, you still would see that
url is "https://www.kleyntrucks.com/trucks/tractorunit/". Thus the
results are not coming as I am thinking to code.
How can I handle this situation ?
require 'open-uri'
doc =
Nokogiri::HTML(open("https://www.kleyntrucks.com/trucks/tractorunit/"))
On the other hand - the
website(http://www.flipkart.com/mobiles/samsung~brand/pr?sid=tyy,4io&otracker=hp_nmenu_sub_electronics_0_Samsung)
seems good. Now suppose I want to scrap the page, when **Price** has
been selected between **5001-10000**, then I would get also its
equivalent url from the browser -
(http://www.flipkart.com/mobiles/samsung~brand/pr?p[]=facets.price_range%5B%5D%3DRs.%2B5001%2B-%2BRs.%2B10000&p[]=sort%3Dfeatured&sid=tyy%2C4io&ref=3de01d19-4e68-4ba9-9b3f-9c43497931b0).
Accordingly I can use this url in below, then all my code will get
correct data :
require 'open-uri'
doc =
Nokogiri::HTML(open(http://www.flipkart.com/mobiles/samsung~brand/pr?p[]=facets.price_range%5B%5D%3DRs.%2B5001%2B-%2BRs.%2B10000&p[]=sort%3Dfeatured&sid=tyy%2C4io&ref=3de01d19-4e68-4ba9-9b3f-9c43497931b0))
How to then proceed with the first
case(https://www.kleyntrucks.com/trucks/tractorunit/) ? Is there anyway
?
···
--
Posted via http://www.ruby-forum.com/.