matthewmueller / x-ray

The next web scraper. See through the <html> noise.
MIT License
5.88k stars 350 forks source link

How to get to data not in html elements, but in javascript for instance? #110

Closed 0xgeert closed 8 years ago

0xgeert commented 9 years ago

As an example I'm trying to get latitude/longitude which are available in a json-blob in the source-code.

How would I get to this?

mikemaccana commented 8 years ago

xray has a driver for phantomjs, which evaluates JavaScript, but the xray docs don't seem to show how this is exposed to xray users.

0xgeert commented 8 years ago

implemented this by simply having:

wantSomeHtmlSnippet: function(el, cb){
  var html  = el.html(); 
  var snippet = ... //now do some string manipulation 
  return cb(undefined, snippet)
}