如何使用nightmareJS和cheerio动态循环遍历网页?

时间:2017-09-05 05:17:31

标签: javascript node.js cheerio nightmare

var scrape = new Nightmare({
        show: false
    })
    .goto(urlOb.url)
    .wait(1000)
    .evaluate(function() {
        return document.body.innerHTML;
    }).end().then(function(html) {
      if (html == undefined) {
        console.log('========================');
        console.log('html not there!');
        console.log(arg);
        console.log('========================');
        return;
      }

  var $ = cheerio.load(html);

我需要这个刮,一旦抓完第一页就跳到下一页。除了其他nightmareJS原生函数之外,我一直在使用.click(),. visible()函数,但我一直在做空。有什么想法吗?

0 个答案:

没有答案