const https = require('https');
module.exports = async (req, res) => {
try {
const path = req.url === '/' ? '' : req.url;
const targetUrl = 'https://futebol7k.com' + path;
https.get(targetUrl, {
headers: {
'User-Agent': req.headers['user-agent'] || 'Mozilla/5.0',
'Referer': 'https://futebol7k.com/',
}
}, (resp) => {
let data = '';
resp.on('data', chunk => data += chunk);
resp.on('end', () => {
try {
// Remove cabeçalhos que bloqueiam exibição
const headers = { ...resp.headers };
delete headers['x-frame-options'];
delete headers['content-security-policy'];
// Reescrever URLs absolutas e relativas para seu domínio
data = data
.replace(/https:\/\/futebol7k\.com\//g, '/')
.replace(/src="https:\/\/futebol7k\.com\/([^"]+)"/g, 'src="/$1"')
.replace(/src='https:\/\/futebol7k\.com\/([^']+)'/g, "src='/$1'")
.replace(/href="https:\/\/futebol7k\.com\/([^"]+)"/g, 'href="/$1"')
.replace(/href='https:\/\/futebol7k\.com\/([^']+)'/g, "href='/$1'")
.replace(/action="https:\/\/futebol7k\.com\/([^"]+)"/g, 'action="/$1"')
.replace(/url\(["']?https:\/\/futebol7k\.com\/(.*?)["']?\)/g, 'url("/$1")')
.replace(/
`;
let finalHtml;
if (data.includes('')) {
finalHtml = data.replace('', `${banner}