Like I scrape 3 pages with the code below:
var Xray = require('x-ray');
var x = Xray();
x('https://blog.ycombinator.com/', '.post', [{
title: 'h1 a',
link: '.article-title@href'
}])
.paginate('.nav-previous a@href')
.limit(3)
.write('results.json')
How can I report the progression?
I tried the .then() but seems not work.
x('https://blog.ycombinator.com/', '.post', [{
title: 'h1 a',
link: '.article-title@href'
}])
.paginate('.nav-previous a@href')
.limit(3)
.write('results.json')
.then(
//something to report the progression
)
Or callback function which also wouldn't work
x('https://blog.ycombinator.com/', '.post', [{
title: 'h1 a',
link: '.article-title@href'
}])(()=>{
//something to report the progress
})
.paginate('.nav-previous a@href')
.limit(3)
.write('results.json')