Reaperxxxx commited on
Commit
12a4742
·
verified ·
1 Parent(s): af30d27

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +4 -4
server.js CHANGED
@@ -41,10 +41,10 @@ app.get("/search", async (req, res) => {
41
  await page.goto("https://www.fzmovies.net/csearch.php", { waitUntil: "domcontentloaded", timeout: 60000 });
42
 
43
  await page.fill("#searchname", movieName);
44
- await Promise.all([
45
- page.click('input[type="submit"][name="Search"]'),
46
- page.waitForNavigation({ waitUntil: "domcontentloaded", timeout: 60000 })
47
- ]);
48
 
49
  // Step 1: Get first movie result (title & page link)
50
  const movieData = await page.evaluate(() => {
 
41
  await page.goto("https://www.fzmovies.net/csearch.php", { waitUntil: "domcontentloaded", timeout: 60000 });
42
 
43
  await page.fill("#searchname", movieName);
44
+ await page.click('input[type="submit"][name="Search"]');
45
+
46
+ // ✅ Fix: Wait for search results instead of waiting for full navigation
47
+ await page.waitForSelector(".mainbox a", { timeout: 10000 });
48
 
49
  // Step 1: Get first movie result (title & page link)
50
  const movieData = await page.evaluate(() => {