Update server.js
Browse files
server.js
CHANGED
@@ -32,21 +32,16 @@ async function scrapeMatches() {
|
|
32 |
const baseURL = "https://www.windrawwin.com/predictions/today/all-games/large-stakes/draws/";
|
33 |
await page.goto(baseURL, { waitUntil: "domcontentloaded", timeout: 60000 });
|
34 |
|
35 |
-
|
36 |
-
const
|
37 |
-
return Array.from(document.querySelectorAll("select#predregion option"))
|
38 |
-
.map(option => option.value)
|
39 |
-
.filter(link => link.includes("/predictions/today/"));
|
40 |
-
});
|
41 |
|
42 |
let allMatches = [];
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
const
|
47 |
-
const $ = cheerio.load(html);
|
48 |
|
49 |
-
$(".wttr").each((_, element) => {
|
50 |
const homeTeam = $(element).find(".wtteam .wtmoblnk").eq(0).text().trim();
|
51 |
const awayTeam = $(element).find(".wtteam .wtmoblnk").eq(1).text().trim();
|
52 |
const stake = $(element).find(".wttd.wtstk").text().trim();
|
@@ -54,10 +49,17 @@ async function scrapeMatches() {
|
|
54 |
const score = $(element).find(".predscore").text().trim();
|
55 |
|
56 |
if (homeTeam && awayTeam) {
|
57 |
-
allMatches.push({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
});
|
60 |
-
}
|
61 |
|
62 |
await browser.close();
|
63 |
return allMatches;
|
|
|
32 |
const baseURL = "https://www.windrawwin.com/predictions/today/all-games/large-stakes/draws/";
|
33 |
await page.goto(baseURL, { waitUntil: "domcontentloaded", timeout: 60000 });
|
34 |
|
35 |
+
const html = await page.content();
|
36 |
+
const $ = cheerio.load(html);
|
|
|
|
|
|
|
|
|
37 |
|
38 |
let allMatches = [];
|
39 |
|
40 |
+
// Extract matches, including competition names
|
41 |
+
$(".wtcont").each((_, competitionElement) => {
|
42 |
+
const competitionName = $(competitionElement).find(".ptleag").text().trim();
|
|
|
43 |
|
44 |
+
$(competitionElement).find(".wttr").each((_, element) => {
|
45 |
const homeTeam = $(element).find(".wtteam .wtmoblnk").eq(0).text().trim();
|
46 |
const awayTeam = $(element).find(".wtteam .wtmoblnk").eq(1).text().trim();
|
47 |
const stake = $(element).find(".wttd.wtstk").text().trim();
|
|
|
49 |
const score = $(element).find(".predscore").text().trim();
|
50 |
|
51 |
if (homeTeam && awayTeam) {
|
52 |
+
allMatches.push({
|
53 |
+
competition: competitionName,
|
54 |
+
homeTeam,
|
55 |
+
awayTeam,
|
56 |
+
stake,
|
57 |
+
prediction,
|
58 |
+
score
|
59 |
+
});
|
60 |
}
|
61 |
});
|
62 |
+
});
|
63 |
|
64 |
await browser.close();
|
65 |
return allMatches;
|