I want to get the body from a Bloomberg url.
This is the code I am using:
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);
But I am getting this message when I console log the body:
<!doctype html>
<html>
<head>
<title>Bloomberg - Are you a robot?</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
I have found a similar problem and the solution using BeautifulSoup in Python... but I cannot find the solution in NodeJs: How to scrape text from a <p> elements "id"