# -*- coding: utf-8 -*- """Search served JS on .com/.cn for channel picker markers.""" from __future__ import annotations import re import sys import httpx sys.stdout.reconfigure(encoding="utf-8", errors="replace") NEEDLES = [ "AuthorizedChannelPicker", # may be stripped "选择已授权频道", "YtChannelProfileSnippet", "aria-haspopup", "listbox", ] def check(base: str): print(f"\n===== {base} =====") with httpx.Client(follow_redirects=True, timeout=40) as c: # unauthenticated /youtube may redirect login on .com; try with cookie bypass by fetching static chunk list from build r = c.get(f"{base}/youtube") print("html", r.status_code, len(r.content), "set-cookie", bool(r.headers.get("set-cookie"))) html = r.text # find all next static refs including RSC flight paths = sorted(set(re.findall(r"/_next/static/[^\"'\s)]+", html))) print("static refs", len(paths)) # also try known youtube page path from earlier extra = [ "/_next/static/chunks/app/youtube/page-7a6c91c3bf577da9.js", "/_next/static/chunks/933-63b960ae3cfdcfdb.js", "/_next/static/chunks/647-0fe1b0d631b25b8f.js", ] for p in paths + extra: if not p.endswith(".js"): continue try: body = c.get(base + p).text except Exception as e: print(" fail", p, e) continue hits = [n for n in NEEDLES if n in body] # also native select leftover pattern native = "选择已授权频道…" in body and "/dev/null | head -20 echo --- grep -R "AuthorizedChannelPicker\|aria-haspopup" /opt/douyinWEB/frontend/.next/static/chunks 2>/dev/null | head -10 echo --- # source file on disk grep -n AuthorizedChannelPicker /opt/douyinWEB/frontend/src/components/YtAssignPanel.tsx | head ls -la /opt/douyinWEB/frontend/.next/BUILD_ID 2>/dev/null; cat /opt/douyinWEB/frontend/.next/BUILD_ID 2>/dev/null ' """ _, o, e = g.exec_command(cmd, timeout=60) print("\n===== physical disk =====") print((o.read() + e.read()).decode("utf-8", "replace")[-4000:]) g.close() if __name__ == "__main__": main()