Update index.js
Browse files84 unmodified lines85868788899084 unmodified lines}});app.all('/imagetopdf', async (req, res) => {if (!['POST'].includes(req.method)) return res.status(405).json({ success: false, message: 'Method Not Allowed' })84 unmodified lines85868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613784 unmodified lines}});app.get('/pages', async (req, res) => {const targetUrl = req.query.url;if (!targetUrl) {return res.status(400).json({ error: 'Parameter "url" dibutuhkan' });}const browser = await playwright.chromium.launch({headless: true,executablePath: '/usr/bin/chromium', // pastikan path ini benar di server kamuargs: ['--no-sandbox']});const context = await browser.newContext({extraHTTPHeaders: {'accept': '*/*','accept-language': 'en-US,en;q=0.9,id;q=0.8','cache-control': 'no-cache','origin': 'https://doujindesu.tv','pragma': 'no-cache','referer': 'https://doujindesu.tv','sec-ch-ua': '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"','sec-ch-ua-mobile': '?0','sec-ch-ua-platform': '"Windows"','sec-fetch-dest': 'script','sec-fetch-mode': 'cors','sec-fetch-site': 'cross-site','user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'}});try {const page = await context.newPage();await page.goto(targetUrl, { waitUntil: 'domcontentloaded', timeout: 60000 });// Tunggu ekstra jika perlu ngelewatin challengeawait page.waitForTimeout(8000);const content = await page.content();res.send(content);} catch (err) {res.status(500).json({ error: 'Gagal fetch halaman', detail: err.message });} finally {await browser.close();}});app.all('/imagetopdf', async (req, res) => {if (!['POST'].includes(req.method)) return res.status(405).json({ success: false, message: 'Method Not Allowed' })
index.js+47