krnl / index.js
fast72's picture
Update index.js
a918987 verified
raw
history blame contribute delete
946 Bytes
const express = require('express');
const { chromium } = require('playwright');
const app = express();
const PORT = 7860;
app.get('/get-key', async (req, res) => {
try {
const browser = await chromium.launch({ headless: true });
const context = await browser.newContext({
locale: 'en-US',
timezoneId: 'Asia/Jakarta',
permissions: ['geolocation'],
geolocation: { latitude: -6.2, longitude: 106.8 },
viewport: { width: 390, height: 844 },
deviceScaleFactor: 3,
isMobile: true,
hasTouch: true,
});
const page = await context.newPage();
await page.goto('https://krnl.cat/checkpointv2/vgetkey', { waitUntil: 'networkidle' });
const html = await page.content();
await browser.close();
res.send(html);
} catch (err) {
res.status(500).send('Gagal jir: ' + err.message);
}
});
app.listen(PORT, () => {
console.log(`Jalan di http://localhost:${PORT}`);
});