Files
huishou/test-server-file.js
2026-07-27 14:07:26 +08:00

38 lines
1.1 KiB
JavaScript

const http = require('http');
const options = {
hostname: 'hs.yifenbao.cn',
port: 4001,
path: '/h5/assets/pages-index-index.Dfg3o6TQ.js',
method: 'GET'
};
const req = http.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log('文件大小:', data.length, 'bytes');
const hasNewMerchant = data.includes('新商户');
const hasNewIndividual = data.includes('新个人');
const hasCustomRegion = data.includes('custom-region');
console.log('包含"新商户":', hasNewMerchant);
console.log('包含"新个人":', hasNewIndividual);
console.log('包含"custom-region":', hasCustomRegion);
// 搜索相关代码
const newMerchantMatches = data.match(/"新商户"/g);
const newIndividualMatches = data.match(/"新个人"/g);
console.log('"新商户"出现次数:', newMerchantMatches ? newMerchantMatches.length : 0);
console.log('"新个人"出现次数:', newIndividualMatches ? newIndividualMatches.length : 0);
});
});
req.on('error', (e) => {
console.error('请求错误:', e.message);
});
req.end();