90 lines
3.1 KiB
Python
90 lines
3.1 KiB
Python
"""Final audit: verify all reviewer fixes are live"""
|
|
import urllib.request
|
|
import re, sys, io
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
|
|
|
|
SITE = "https://blog.quant-view.xyz"
|
|
|
|
def fetch(path):
|
|
try:
|
|
url = f"{SITE}/{path}"
|
|
r = urllib.request.urlopen(url, timeout=15)
|
|
return r.read().decode()
|
|
except Exception as e:
|
|
return f"ERROR: {e}"
|
|
|
|
results = []
|
|
|
|
# 1. entity.html - zero github links, zero liudecai-one
|
|
html = fetch("tools/entity.html")
|
|
gh = len(re.findall(r'github\.com', html))
|
|
l1 = html.count('liudecai-one')
|
|
results.append(("entity.html: GitHub links = 0", gh == 0))
|
|
results.append(("entity.html: liudecai-one = 0", l1 == 0))
|
|
|
|
# 2. GitHub SEO article
|
|
html = fetch("github-seo-trading-tools.html")
|
|
has_npm = 'npmjs.com' in html
|
|
has_gitlab = 'gitlab.com/liudecai110' in html
|
|
has_degithub = 'de-GitHub' in html
|
|
# PyPI should appear in After block exactly once (not duplicated)
|
|
after_block = re.search(r'// After:.*?]', html, re.DOTALL)
|
|
if after_block:
|
|
after_text = after_block.group()
|
|
pypi_in_after = after_text.count('https://pypi.org/project/gfil-calculators/')
|
|
npm_in_after = 'npmjs.com' in after_text
|
|
gitlab_in_after = 'gitlab.com' in after_text
|
|
else:
|
|
pypi_in_after = -1
|
|
npm_in_after = False
|
|
gitlab_in_after = False
|
|
results.append(("article19: After block PyPI count = 1", pypi_in_after == 1))
|
|
results.append(("article19: After block has npm", npm_in_after))
|
|
results.append(("article19: After block has GitLab", gitlab_in_after))
|
|
results.append(("article19: Mistake#1 updated (de-GitHub)", has_degithub))
|
|
results.append(("article19: overall has npm link", has_npm))
|
|
results.append(("article19: overall has GitLab link", has_gitlab))
|
|
|
|
# 3. Footer - English pages use Telegram, not WeChat
|
|
html_en = fetch("")
|
|
html_zh = fetch("zh/")
|
|
en_no_wechat = 'LDP161109' not in html_en
|
|
en_has_telegram = '@GFIL_Trading' in html_en or 'Telegram' in html_en
|
|
zh_has_wechat = 'LDP161109' in html_zh
|
|
results.append(("EN index: NO WeChat/QQ", en_no_wechat))
|
|
results.append(("EN index: HAS Telegram", en_has_telegram))
|
|
results.append(("ZH index: HAS WeChat/QQ", zh_has_wechat))
|
|
|
|
# 4. research.html - "GitHub" label fixed to "PyPI"
|
|
html = fetch("tools/research.html")
|
|
# Check that PyPI link text is NOT "GitHub"
|
|
pypi_with_github_label = bool(re.search(r'pypi\.org[^>]*>GitHub</a>', html))
|
|
results.append(("research.html: no mislabeled GitHub->PyPI", not pypi_with_github_label))
|
|
|
|
# 5. gfil-faq.html - has GitLab, no "GitHub" label on PyPI
|
|
html = fetch("tools/gfil-faq.html")
|
|
has_gitlab_faq = 'gitlab.com/liudecai110' in html
|
|
results.append(("gfil-faq.html: has GitLab link", has_gitlab_faq))
|
|
|
|
# 6. media.html - zero github links
|
|
html = fetch("tools/media.html")
|
|
gh = len(re.findall(r'github\.com', html))
|
|
results.append(("media.html: GitHub links = 0", gh == 0))
|
|
|
|
# Print results
|
|
print("=" * 70)
|
|
print("FINAL AUDIT: Reviewer Fixes Verification")
|
|
print("=" * 70)
|
|
all_pass = True
|
|
for label, passed in results:
|
|
status = "PASS" if passed else "FAIL"
|
|
if not passed:
|
|
all_pass = False
|
|
print(f" [{status}] {label}")
|
|
|
|
print()
|
|
if all_pass:
|
|
print("ALL CHECKS PASSED")
|
|
else:
|
|
print("SOME CHECKS FAILED")
|