废话不多说,直接上图

经过检测,状态精准,有需要可以试试
使用教程
// 精准版本地代理(无强制兜底,返回真实结果)
const express = require('express');
const cors = require('cors');
const axios = require('axios');
const app = express();
// 允许所有跨域请求
app.use(cors({
origin: '*',
methods: ['GET', 'POST'],
allowedHeaders: ['*']
}));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
// 核心代理接口(返回真实百度响应)
app.get('/proxy', async (req, res) => {
try {
const targetUrl = req.query.url;
if (!targetUrl) {
return res.status(400).send('缺少URL参数');
}
console.log('代理请求:', decodeURIComponent(targetUrl));
const response = await axios.get(decodeURIComponent(targetUrl), {
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
'Referer': 'https://www.baidu.com/',
'Cache-Control': 'no-cache',
'Pragma': 'no-cache'
},
timeout: 30000,
followRedirects: true,
decompress: true,
maxRedirects: 5
});
// 返回真实的百度响应(无修改)
res.setHeader('Content-Type', 'text/html; charset=utf-8');
res.send(response.data);
} catch (error) {
console.error('代理失败:', error.message);
// 返回真实错误,不兜底为已收录
res.status(500).send(`<html>代理请求失败:${error.message}</html>`);
}
});
// 启动代理(自动检测可用端口)
async function startProxy() {
let port = 8080;
while (port <= 8090) {
try {
app.listen(port, () => {
console.log(`✅ 精准版代理已启动,地址:http://localhost:${port}`);
console.log(`📌 检测器需配置:http://localhost:${port}/proxy?url=`);
});
break;
} catch (e) {
port++;
}
}
if (port > 8090) {
console.error('❌ 8080-8090端口均被占用,请关闭占用程序后重试');
}
}
startProxy();npm install express cors axios node proxy.js
✅ 本地代理已启动,地址:http://localhost:8080 📌 请勿关闭此窗口,关闭则代理失效