【发布时间】:2019-02-02 11:37:14
【问题描述】:
当我尝试爬取 vue js 前端网站时,它不会将内容加载到cheerio。我得到的是一个空白网页。我的代码如下
getSiteContentAsJs = (url) => {
return new Promise((resolve, reject) => {
let j = request.jar();
request.get({url: url, jar: j}, function(err, response, body) {
if(err)
return resolve({body: null, jar: j, error: err});
return resolve({body: body, jar: j, error: null});
});
})
}
我的内容如下
const { body, jar, error} = await getSiteContentAsJs(url);
//I passed body to cheerio to get the js object out of the web content
const $ = cheerio.load(body);
但没有渲染任何内容。但是一个空白的网页。里面没有内容。
【问题讨论】:
标签: node.js phantomjs web-crawler cheerio