Reaperxxxx commited on
Commit
ce5241a
·
verified ·
1 Parent(s): 534f172

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +5 -4
server.js CHANGED
@@ -32,8 +32,8 @@ 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
- // Wait an extra 3 seconds after loading
36
- await page.waitForTimeout(3000);
37
 
38
  // Get all league URLs
39
  const leagueLinks = await page.evaluate(() => {
@@ -47,8 +47,8 @@ let allMatches = [];
47
  for (let link of leagueLinks) {
48
  await page.goto(link, { waitUntil: "domcontentloaded", timeout: 60000 });
49
 
50
- // Wait an extra 3 seconds after loading
51
- await page.waitForTimeout(3000);
52
 
53
  const html = await page.content();
54
  const $ = cheerio.load(html);
@@ -74,6 +74,7 @@ for (let link of leagueLinks) {
74
 
75
  await browser.close();
76
  return allMatches;
 
77
 
78
  // Express API route
79
  app.get("/draw", async (req, res) => {
 
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
+ // Wait a bit after loading to ensure all elements are rendered
36
+ await page.waitForTimeout(3000); // Wait for 3 seconds
37
 
38
  // Get all league URLs
39
  const leagueLinks = await page.evaluate(() => {
 
47
  for (let link of leagueLinks) {
48
  await page.goto(link, { waitUntil: "domcontentloaded", timeout: 60000 });
49
 
50
+ // Wait a bit after navigation
51
+ await page.waitForTimeout(3000); // Wait for 3 seconds
52
 
53
  const html = await page.content();
54
  const $ = cheerio.load(html);
 
74
 
75
  await browser.close();
76
  return allMatches;
77
+ }
78
 
79
  // Express API route
80
  app.get("/draw", async (req, res) => {