Trying to pull info from: https://www.tipranks.com/stocks/gild/stock-analysis
This is successful with =IMPORTXML("http://www.tipranks.com/stocks/GILD/stock-analysis ","//*[@text-anchor='middle']") but breaks down when run on multiple stocks (seemingly due to ImportXML restrictions).
I have this Apps Script working for another piece of data and am trying to modify it to pull the text-anchor='middle':
function TRTP(url) {
const html = UrlFetchApp.fetch(url).getContentText();
var res = html;
res = res.match(/(?<=flexccc mt3 displayflex colorpale shrink0 lineHeight2 fontSize2 ml2 ipad_fontSize3.*>).*/g)[0].substring(0,50);
res = res.match(/.*(?=<)/g)[0];
if (!res) throw new Error("Value cannot be retrieved.")
return res;
}
Any suggestions would be much appreciated.