I am trying to use a C++ scraper in my ui to cipher through WSJ stock information to get some balance sheet info back, I have it for where it searchers for specific text in the page source ie "Pe/Ratio" and then i manually counted how many chars are in between it and the actual number on the website.
Here is the picture of the code
// P/E Ratio
size_t indexpeRatio = html.find("P/E Ratio ") + 116;
string s_peRatio = html.substr(indexpeRatio, 5);
peRatio = stod(s_peRatio);
After manually doing that it simply stores the number and I output it to my UI. My Issue is that sometimes the number of characters in between change depending on which company i choose to evaluate. I am wondering if there is a way to use the .find() function to find the "Pe/Ratio" then output the next float/int,
here is what the html looks like on the site
As of right now sometimes my ui will output parts of the html due to having to use a fixed number of chars
this is an example of my ui output when giving a smaller company to evaluate
Do you all have any recommendations I can use to fix this issue? Thank you in advance!