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.
31 lines
1.3 KiB
31 lines
1.3 KiB
# -*- coding: utf-8 -*-
|
|
"""检查 team-page.html 资源引用形态 + team-mapping.json 结构"""
|
|
import re, json, io, sys
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
|
|
html = open(r'e:\code\crm-backend-matt\.scratch\lanhu-latest\team-page.html',
|
|
encoding='utf-8', errors='replace').read()
|
|
print('=== script/link refs (first 15) ===')
|
|
for m in re.findall(r'<(?:script|link)[^>]*(?:src|href)="([^"]+)"', html)[:15]:
|
|
print(m)
|
|
print('=== img data-src (first 5) ===')
|
|
for m in re.findall(r'data-src="([^"]+)"', html)[:5]:
|
|
print(m)
|
|
print('=== total refs ===')
|
|
print('scripts/links:', len(re.findall(r'<(?:script|link)[^>]*(?:src|href)=', html)),
|
|
'imgs:', len(re.findall(r'data-src=', html)))
|
|
|
|
m = json.load(open(r'e:\code\crm-backend-matt\.scratch\lanhu-latest\team-mapping.json',
|
|
encoding='utf-8'))
|
|
print('=== mapping top keys ===', list(m.keys()))
|
|
for k in m:
|
|
v = m[k]
|
|
n = len(v) if hasattr(v, '__len__') else ''
|
|
print(k, type(v).__name__, n)
|
|
if isinstance(v, list) and v:
|
|
print(' sample:', json.dumps(v[0], ensure_ascii=False)[:300])
|
|
elif isinstance(v, dict):
|
|
ks = list(v.keys())[:5]
|
|
print(' keys:', ks)
|
|
if ks:
|
|
print(' sample:', json.dumps(v[ks[0]], ensure_ascii=False)[:300])
|
|
|