Last active
March 21, 2017 18:58
-
-
Save ivansabik/8ddb778321c3edfa928d to your computer and use it in GitHub Desktop.
Phantom with x-ray example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | |
| }); |
needs to init yes?
var x = Xray().driver(phantom);
x(URL)
...
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
Any idea why
TypeError: xray(...).use is not a functionwould happen?