File size: 946 Bytes
d5198ab
1f4735a
d5198ab
 
f9b4217
d5198ab
 
 
1f4735a
f458c0b
 
a918987
 
 
 
 
 
 
 
f458c0b
 
 
a918987
1f4735a
d5198ab
1f4735a
d5198ab
 
1f4735a
d5198ab
 
 
 
 
1f4735a
a918987
1f4735a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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}`);
});