You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

32 lines
1.7 KiB

// 下载团队成员页 HTML,检查表格文本载体
import fs from 'node:fs';
const data = JSON.parse(fs.readFileSync('e:/code/crm-backend-matt/.scratch/lanhu-latest/axure-v29.json', 'utf8'));
const key = Object.keys(data.pages).find(k => k.includes('a3-1-1-1-8'));
const entry = data.pages[key];
console.log('page:', key);
console.log('html.src:', entry.html.src);
console.log('html.sign_md5:', entry.html.sign_md5);
const url = `https://lanhu-axure-file.oss-cn-beijing.aliyuncs.com/${entry.html.sign_md5}`;
const res = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0' } });
console.log('status:', res.status, 'content-type:', res.headers.get('content-type'));
const txt = await res.text();
fs.writeFileSync('e:/code/crm-backend-matt/.scratch/lanhu-latest/team-page.html', txt, 'utf8');
console.log('saved, length:', txt.length);
// 统计 HTML 结构特征
const stats = {
'<table': (txt.match(/<table/g) || []).length,
'<td': (txt.match(/<td/g) || []).length,
'<div': (txt.match(/<div/g) || []).length,
'data.js 引用': (txt.match(/data\.js/g) || []).length,
'images/': (txt.match(/images\//g) || []).length,
};
console.log('HTML 结构统计:', stats);
// 提取 HTML 中的中文文本片段(去标签后)
const stripped = txt.replace(/<script[\s\S]*?<\/script>/g, '').replace(/<style[\s\S]*?<\/style>/g, '').replace(/<[^>]+>/g, ' ');
const zhMatches = stripped.match(/[\u4e00-\u9fa5][\u4e00-\u9fa5A-Za-z0-9()()::、,,。.\-\/\s]{1,40}/g) || [];
const uniq = [...new Set(zhMatches.map(s => s.trim()).filter(s => s.length >= 2))];
console.log('中文文本片段 unique:', uniq.length);
uniq.slice(0, 80).forEach((s, i) => console.log(String(i + 1).padStart(3), s.slice(0, 60)));