全项目扫描修复: Docker数据卷修复+安全requireAdmin+12页SEO+API白名单+脚本超时+常量提取+假数据删除
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import re
|
||||
import urllib.request
|
||||
|
||||
req = urllib.request.Request('https://www.zhuig.com/community', headers={'User-Agent': 'Mozilla/5.0', 'Cache-Control': 'no-cache', 'Pragma': 'no-cache'})
|
||||
html = urllib.request.urlopen(req, timeout=15).read().decode('utf-8')
|
||||
|
||||
# 找板块区域
|
||||
idx_q = html.find('全部板块')
|
||||
idx_z = html.find('最新话题')
|
||||
section = html[idx_q:idx_z] if idx_z > 0 else html[idx_q:idx_q+15000]
|
||||
|
||||
# 统计 <a> 链接
|
||||
a_count = len(re.findall(r'<a[^>]*href="/community/', section))
|
||||
h3_count = len(re.findall(r'<h3[^>]*>[^<]+</h3>', section))
|
||||
print(f'板块区域 <a> 链接数: {a_count}')
|
||||
print(f'板块区域 <h3> 标签数: {h3_count}')
|
||||
|
||||
# 提取前10个
|
||||
matches = list(re.finditer(r'<a[^>]*href="/community/([^"]+)"[^>]*>(.*?)</a>', section, re.DOTALL))[:15]
|
||||
print('\n=== 板块区域前15个链接 ===')
|
||||
for m in matches:
|
||||
slug = m.group(1)
|
||||
text = re.sub(r'<[^>]+>', ' ', m.group(2))
|
||||
text = re.sub(r'\s+', ' ', text).strip()
|
||||
print(f' /community/{slug:25s} | {text}')
|
||||
Reference in New Issue
Block a user