I'm trying to use x-ray on Meteor but so far with no luck.
Here's the example I'm testing (it works fine on a basic node app)
import Xray from 'x-ray';
var xray = new Xray();
xray('http://reddit.com/r/meteor/', '.title',
[{
title: '',
href: '@href'
}]
)
.write('./result.json');
I hope you figured it out since it's 5 months ago, I had my head around this question and figured out that way.
Don't use the atmosphere package since it's not maintained anymore.
$meteor npm install --save x-ray
(https://github.com/lapwinglabs/x-ray)
Then just create a Meteor.method on the server side and call it on the client side.
(https://docs.meteor.com/api/methods.html)
// Server Side
import Xray from 'x-ray'
Meteor.methods({
scrap:function(){
var x = Xray();
console.log('Is scrapping');
x('http://google.com', 'title')(function(err, title) {
console.log(title) // Google
})
}
});
Then
// Client Side
Meteor.apply('scrap', function(error, result) {
console.log(error, result);
console.log('Scrap is bussy');
})
Cheers