34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
from pathlib import Path
|
|
import re
|
|
|
|
ROOT = Path(r"c:\Users\admin\Desktop\douyinWEB")
|
|
|
|
# yt-long
|
|
p = ROOT / "frontend/src/app/yt-long/page.tsx"
|
|
t = p.read_text(encoding="utf-8")
|
|
t = t.replace(" const [busy, setBusy] = useState(false);\n", "")
|
|
t = t.replace("busy={busy}", "busy={false}")
|
|
t = re.sub(r"\{false \? <Loader2[^;]*? : (<[^>]+/>)\}", r"\1", t)
|
|
p.write_text(t, encoding="utf-8")
|
|
print("yt-long", "busy state", "[busy, setBusy]" in t)
|
|
|
|
# clips
|
|
p = ROOT / "frontend/src/app/x/ClipsPanel.tsx"
|
|
t = p.read_text(encoding="utf-8")
|
|
t = t.replace(" const [busy, setBusy] = useState(false);\n", "")
|
|
t = t.replace("busy={busy}", "busy={false}")
|
|
p.write_text(t, encoding="utf-8")
|
|
print("clips", "busy state", "[busy, setBusy]" in t)
|
|
|
|
for rel in ("frontend/src/app/youtube/page.tsx", "desktop/src/pages/YoutubePage.tsx"):
|
|
p = ROOT / rel
|
|
t = p.read_text(encoding="utf-8")
|
|
if "setBusy(" not in t:
|
|
t = t.replace(" const [busy, setBusy] = useState(false);\n", "")
|
|
t = re.sub(r"\{false \? <Loader2[\s\S]*? : (<[^>]+/>)\}", r"\1", t)
|
|
p.write_text(t, encoding="utf-8")
|
|
print(rel, "setBusy(", t.count("setBusy("), "state", "[busy, setBusy]" in t)
|
|
|
|
print("ok")
|