比如我要获取网易新闻的内容,因为是动态的,用nightmare,,但不知道怎么模拟获取更多??
var Nightmare = require('nightmare');
var nightmare = Nightmare({show:false})
nightmare
.goto('http://news.163.com/')
.inject('js', 'jquery.min.js')
.type(这里应该怎么写) -------???
.click(怎么写?) --------????
.evaluate(function () {
var newsList=[];
$('.data_row').each(function () {
var $me=$(this);
var title=$me.find('.news_title').find('h3').find('a').text();
var url=$me.find('.news_title').find('h3').find('a').attr('href');
var item={
title:title,
url:url
}
newsList.push(item);
})
return newsList
})
.end()
.then(function (result) {
console.log(result);
})
.catch(function (err) {
console.log(err);
})