File size: 727 Bytes
abed4cc
5f81227
 
abed4cc
5f81227
 
 
 
 
 
 
 
dba8c99
5f81227
 
7b1a25a
5f81227
 
17ee36d
43f02ea
 
17ee36d
43f02ea
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const express = require('express');
const puppeteer = require('puppeteer');

const app = express();
const targetUrl = 'https://chatgpt.com/';

app.get('/', async (req, res) => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto(targetUrl);
  const html = await page.content();
  await browser.close();

  // Здесь вы можете модифицировать HTML-код, например, заменить URL-адреса
  const newHtml = html.replace(new RegExp(targetUrl, 'g'), req.protocol + '://' + req.get('host'));

  res.send(newHtml);
});

const port = 7860;
app.listen(port, () => {
  console.log(`Сервер запущен на порту ${port}`);
});