Update index.js
Browse files
index.js
CHANGED
|
@@ -229,14 +229,17 @@ app.all('/stablediff/illusion', async (req, res) => {
|
|
| 229 |
})
|
| 230 |
|
| 231 |
app.get('/dongo', async (req, res) => {
|
| 232 |
-
const { url } = req.query
|
| 233 |
-
|
|
|
|
| 234 |
const browser = await playwright.chromium.launch({
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
|
|
|
| 239 |
const context = await browser.newContext({
|
|
|
|
| 240 |
extraHTTPHeaders: {
|
| 241 |
'accept': '*/*',
|
| 242 |
'accept-language': 'en-US,en;q=0.9,id;q=0.8',
|
|
@@ -255,13 +258,17 @@ app.get('/dongo', async (req, res) => {
|
|
| 255 |
});
|
| 256 |
|
| 257 |
const page = await context.newPage();
|
| 258 |
-
await page.goto(url);
|
| 259 |
|
| 260 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
|
| 262 |
await browser.close();
|
| 263 |
|
| 264 |
-
res.send(content);
|
| 265 |
});
|
| 266 |
|
| 267 |
app.get('/fetch-page', async (req, res) => {
|
|
|
|
| 229 |
})
|
| 230 |
|
| 231 |
app.get('/dongo', async (req, res) => {
|
| 232 |
+
const { url } = req.query;
|
| 233 |
+
if (!url) return res.json({ success: false, message: 'Required parameter url' });
|
| 234 |
+
|
| 235 |
const browser = await playwright.chromium.launch({
|
| 236 |
+
headless: true,
|
| 237 |
+
executablePath: '/usr/bin/chromium',
|
| 238 |
+
args: ['--no-sandbox']
|
| 239 |
+
});
|
| 240 |
+
|
| 241 |
const context = await browser.newContext({
|
| 242 |
+
viewport: null, // Use null to maximize viewport
|
| 243 |
extraHTTPHeaders: {
|
| 244 |
'accept': '*/*',
|
| 245 |
'accept-language': 'en-US,en;q=0.9,id;q=0.8',
|
|
|
|
| 258 |
});
|
| 259 |
|
| 260 |
const page = await context.newPage();
|
|
|
|
| 261 |
|
| 262 |
+
// Set to fullscreen by getting viewport dimensions
|
| 263 |
+
const dimensions = await page.evaluate(() => ({ width: window.screen.width, height: window.screen.height }));
|
| 264 |
+
await page.setViewportSize(dimensions);
|
| 265 |
+
|
| 266 |
+
await page.goto(url);
|
| 267 |
+
const content = await page.content();
|
| 268 |
|
| 269 |
await browser.close();
|
| 270 |
|
| 271 |
+
res.send(content);
|
| 272 |
});
|
| 273 |
|
| 274 |
app.get('/fetch-page', async (req, res) => {
|