Max Frai
Max Frai

Reputation: 64276

Get page content

I want to parse some google service page data (adplanner). The problem is that google shows page content using JS and there isn't any api. For example, I have such request url: https://www.google.com/adplanner/planning/site_profile?hl=en#siteDetails?identifier=stackoverflow.com&lp=true

And in received code I can see:

document.write(unescape("%3Cscript src='" + AP_gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

I'm receiving page data using JQuery:

$.get(requestUrl, function(data) {console.log(data);} );

requestUrl is the url I wrote under this text.

So, any ways to receive text data from that page?

Upvotes: 1

Views: 831

Answers (1)

Peter Lyons
Peter Lyons

Reputation: 146064

Try PhantomJS. It can load the page, run all the javascript, and then you can grab whatever text you want (via the DOM or jQuery) once all the javascript rendering is done. There are many good examples in the github repo.

Upvotes: 1

Related Questions