Skip to content

Instantly share code, notes, and snippets.

@ivansabik
Last active March 21, 2017 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivansabik/8ddb778321c3edfa928d to your computer and use it in GitHub Desktop.
Save ivansabik/8ddb778321c3edfa928d to your computer and use it in GitHub Desktop.
Phantom with x-ray example
var xray = require('x-ray');
var phantom = require('x-ray-phantom');
var URL = 'http://www.yad2.co.il/Nadlan/rent.php?City=%D7%99%D7%A8%D7%95%D7%A9%D7%9C%D7%99%D7%9D&Neighborhood=&HomeTypeID=11&fromRooms=1&untilRooms=&fromPrice=200&untilPrice=&PriceType=1&FromFloor=&ToFloor=&EnterDate=&Info=';
xray(URL)
.use(phantom())
.select([{
$root: 'body',
tds: ['td']
}])
.run(function(error, scraped) {
console.log(scraped);
});
@Koleok
Copy link

Koleok commented May 21, 2016

Any idea why TypeError: xray(...).use is not a function would happen?

@rsoury
Copy link

rsoury commented Aug 23, 2016

needs to init yes?

var x = Xray().driver(phantom);

x(URL)
...

@ivansabik
Copy link
Author

Hey just catching up with this one, I used this in 2015 so maybe their API changed or something but back then it was working. I didn't use x-ray and phantom other than for a couple of tests but looked like a really nice project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment