我想学一下phantomjs,用node的phantom模块。
我用百度云分享来测试
原网页时有分享内容的
我用phantom来加载后显示到页面中,却看不到分享内容
(async function () {
const instance = await phantom.create()
const page = await instance.createPage()
await page.on('onResourceRequested', function (requestData) {
console.info('Requesting', requestData.url)
})
const status = await page.open('https://pan.baidu.com/share/home?uk=4197889247&suk=dnExnttUMb_71obP9h5jSg#category/type=0')
const content = await page.property('content')
const evaluate = await page.evaluate(function () {
return document.body.innerHTML
})
console.log(evaluate) //输出到浏览器
console.log(content) //或者这个输出到浏览器
await instance.exit()
})()
我是用koa做服务器,将解析的代码放到浏览器看的,输出没有分享的内容。
请问这是为什么?
你这个地址
https://pan.baidu.com/share/home?uk=4197889247&suk=dnExnttUMb_71obP9h5jSg#category/type=0
就是没有分享内容的
