rtc_prd/find_css.py
2026-02-04 15:33:02 +08:00

48 lines
1.2 KiB
Python

import re
css_path = r"d:\Airhub\styles.css"
try:
with open(css_path, "r", encoding="utf-8", errors="ignore") as f:
content = f.read()
# regex for .dc-header { ... } (simplified)
# Matches .classname { ... } roughly
def find_block(name, text):
print(f"--- Searching for {name} ---")
idx = text.find(name)
if idx == -1:
print("Not found.")
return
# Find opening brace
open_brace = text.find("{", idx)
if open_brace == -1:
print("No opening brace.")
return
# Find closing brace (count nesting)
close_brace = -1
balance = 0
for i in range(open_brace, len(text)):
if text[i] == '{':
balance += 1
elif text[i] == '}':
balance -= 1
if balance == 0:
close_brace = i
break
if close_brace != -1:
print(text[idx:close_brace+1])
else:
print("Block not closed properly.")
find_block(".dc-header", content)
find_block(".glass-modal", content)
find_block(".status-pill", content)
except Exception as e:
print(e)