我想从彭博(Bloomberg)网址获取正文。
这是我正在使用的代码:
const options = {
url: 'https://www.bloomberg.com/quote/CCMP:IND',
headers: {
'User-Agent': 'request'
}
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
Run Code Online (Sandbox Code Playgroud)
但是当我控制台登录正文时,我收到此消息:
<!doctype html>
<html>
<head>
<title>Bloomberg - Are you a robot?</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
Run Code Online (Sandbox Code Playgroud)
我在Python中使用BeautifulSoup找到了类似的问题和解决方案...但是在NodeJs中找不到解决方案:如何从<p>元素“ id”中抓取文本