【发布时间】:2018-01-19 18:30:13
【问题描述】:
我正在尝试在 nodejs 应用程序中获取 https://www.example.com/ 的内部文本。我尝试使用request npm 模块来获取 URL 的正文,如下所示:
function getBodyText() {
request({
url:'https://www.example.com/'
}, (error, response, body) => {
console.log(body.innerText);
});
}
上面的代码显示了我所在的当前页面的正文(https:www.google.com)。我错过了什么吗?
【问题讨论】:
标签: javascript html node.js httprequest