Update server.js
Browse files
server.js
CHANGED
|
@@ -3,7 +3,7 @@ const { chromium } = require('playwright-chromium');
|
|
| 3 |
const cors = require('cors');
|
| 4 |
|
| 5 |
const app = express();
|
| 6 |
-
const PORT =
|
| 7 |
|
| 8 |
app.use(cors());
|
| 9 |
|
|
@@ -34,17 +34,18 @@ async function getVideoLinks(downloadPageUrl) {
|
|
| 34 |
]
|
| 35 |
});
|
| 36 |
|
| 37 |
-
const
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
-
|
| 40 |
-
// Use stealth mode (prevents bot detection)
|
| 41 |
-
await page.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36");
|
| 42 |
-
await page.setViewportSize({ width: 1280, height: 720 });
|
| 43 |
|
| 44 |
-
|
|
|
|
| 45 |
await page.goto(downloadPageUrl, { waitUntil: 'domcontentloaded', timeout: 60000 });
|
| 46 |
|
| 47 |
-
// Wait for the download buttons
|
| 48 |
await page.waitForSelector('a[href*="ggredi.info/download.php"]', { timeout: 20000 });
|
| 49 |
|
| 50 |
// Extract links
|
|
|
|
| 3 |
const cors = require('cors');
|
| 4 |
|
| 5 |
const app = express();
|
| 6 |
+
const PORT = 3000;
|
| 7 |
|
| 8 |
app.use(cors());
|
| 9 |
|
|
|
|
| 34 |
]
|
| 35 |
});
|
| 36 |
|
| 37 |
+
const context = await browser.newContext({
|
| 38 |
+
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36",
|
| 39 |
+
viewport: { width: 1280, height: 720 }
|
| 40 |
+
});
|
| 41 |
|
| 42 |
+
const page = await context.newPage();
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
+
try {
|
| 45 |
+
// Navigate to the page
|
| 46 |
await page.goto(downloadPageUrl, { waitUntil: 'domcontentloaded', timeout: 60000 });
|
| 47 |
|
| 48 |
+
// Wait for the download buttons
|
| 49 |
await page.waitForSelector('a[href*="ggredi.info/download.php"]', { timeout: 20000 });
|
| 50 |
|
| 51 |
// Extract links
|