I am trying to show rankings in fencing using cheerio and find that the rankings, points and T-P (not sure what T-P is in this case and am going to remove this) are all combined.
Example:
rank: 1
Points: 68
T-P: 0
Result after running code: 1680
This is all different td classes so im thinking that its combining all 3 since they have the "same name"
The code in question (yes it is from a tutorial website i started with this like an hour ago)
async function performScraping() {
// downloading the target web page
// by performing an HTTP GET request in Axios
const axiosResponse = await axios.request({
method: "GET",
url: "https://fencing.ophardt.online/en/show-ranking/html/60198",
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
},
});
// console.log (axiosResponse.data)
const $ = cheerio.load(axiosResponse.data);
var things = $(".rankingbody >tbody >tr").toArray();
for (var thing of things) {
var row = $(thing).find(".ranking:not(:has(div))");
var name = $(thing).find(".ranking > .btn-group > a");
console.log(name.text().replace(/\s\s+/g, " "));
console.log(row.text().replace(/\s\s+/g, " "));
}
}
performScraping();
I've tried searching for splitting the td's but it doesn't seem to give the results I'm looking for.