import re
import subprocess
from pathlib import Path
url = "https://online-moek.ru/page147411206.html"
out = Path(r"c:\Users\aferenok_a_s\Documents\Dev\ekp_menu\_live_header.html")
subprocess.run(
["curl", "-sL", "-A", "Mozilla/5.0", url, "-o", str(out)],
check=True,
)
h = out.read_text(encoding="utf-8", errors="replace")
print("EKPHeaderMega:", "__EKPHeaderMegaBound" in h or "EKPHeaderMega" in h)
print("ANX015:", "ANX015" in h)
print("rec1341410401:", "rec1341410401" in h)
print("rec1341410431:", "rec1341410431" in h)
# all rec ids
recs = re.findall(r'id="(rec\d+)"', h)
print("total recs:", len(recs))
# FL panel recs from original
for rid in [
"rec1341410441",
"rec1341410451",
"rec1341410461",
"rec1341410471",
"rec1341410481",
"rec1341410491",
"rec1341410501",
]:
print(rid, "present" if rid in h else "MISSING")
# find mega-like blocks
for m in re.finditer(r'id="(rec\d+)"', h):
rid = m.group(1)
start = m.start()
end = h.find('id="rec', start + 10)
if end < 0:
end = start + 80000
chunk = h[start:end]
if rid in ("rec1341410401", "rec1341410431"):
continue
art = re.search(r"position:fixed", chunk[:3000])
menu2 = re.findall(r"ux-menu2_[a-z0-9_-]+", chunk[:8000])
soob = "soob" in chunk.lower() or "сообщ" in chunk.lower()
bg = "menu_background" in chunk
if art or (menu2 and len(menu2) > 2):
print(
rid,
"fixed" if art else "no-fixed",
"bg" if bg else "no-bg",
"menu2:",
menu2[:4],
"soob?" if soob else "",
)
# header menu classes
bar_i = h.find('id="rec1341410401"')
if bar_i >= 0:
end = h.find('id="rec', bar_i + 30)
bar = h[bar_i:end]
print("\nheader ux-menu1:", sorted(set(re.findall(r"ux-menu1_[a-z0-9_]+", bar))))
# soobshit panel - find rec with ux-menu2 and soob
for pat in ["soobshit", "сообщ", "ux-menu2_soob", "Хочу сообщить"]:
if pat in h:
print("has pattern:", pat)