I’m trying to pull a real time price from Yahoo Finance, based on an old post, and the latest price attribute (data-reactid=”47″) seen in Yahoo Finance. But the following code doesn’t extract the price data. What am I missing? I would appreciate any help. Thank you!
function test() {
const url = 'https://finance.yahoo.com/quote/AAPL?p=AAPL&.tsrc=fin-srch';
const res = UrlFetchApp.fetch(url, { muteHttpExceptions: true }).getContentText();
const $ = Cheerio.load(res);
var price = $("span[data-reactid='47']").text().toString();
console.log(price)
}