Files
StudioLift/skills/youtube-studio-csv-download/references/troubleshooting.md
Sidney Zhang 9020752eed feat(scripts): 添加 PEP 723 脚本元数据并修复 HTTP/2 伪头过滤问题
- 为 build_studio_urls.py 和 lookup_groups.py 添加 PEP 723 依赖声明
- 修复 HTTP/2 伪头导致 requests 抛 InvalidHeader 的问题
- 添加 CDP 端口连通性预检查及启动指引
2026-08-27 13:33:34 +08:00

29 lines
2.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 故障排查
## 登录态相关问题
- **运行后跳到 Google 登录页**URL 含 `accounts.google.com`):未复用登录态。改用 `--user-data-dir`(方式 A`--connect`(方式 B
- **报错 "user data directory ... is already in use" / "ProcessSingleton"**:该浏览器还没关。完全退出 Chrome/Edge 后再用方式 A。
- **`connect ECONNREFUSED 127.0.0.1:9222`**:调试端口没开。先 `chrome.exe --remote-debugging-port=9222`Edge 同理)再 `--connect`
- **连上了但仍未登录**`--channel``--user-data-dir` 品牌不匹配(例如 chrome 的目录配了 `--channel msedge`),或指向了没登录过的 profile。换正确的浏览器/目录。
## 环境与依赖
- **`playwright` / `sync_playwright` 找不到**:环境未同步。项目根执行 `uv sync`,或直接用 `uv run python <脚本>`;详见 `uv-env-setup` 技能。复用系统 Chrome/Edge 时无需 `playwright install chromium`
- **系统找不到浏览器**:确认本机装了 Chrome 或 Edge`--channel` 显式指定 `chrome``msedge`
## 运行过程
- **找不到「导出当前视图」按钮 / 点击超时**
- URL 不是 explore 页,或页面尚未加载完。务必用用户提供的 explore URL别用 overview URL。
- 当前界面该入口是右上角**下载图标按钮**(只有 `aria-label`、无可见文本),脚本已按 label 定位并以文本定位兜底若仍超时确认页面语言为中文或改在英文界面重试label 为 "Export current view")。
- 脚本未捕获到有效响应时会自动重试一次触发;连续失败时手动确认页面能正常导出。
- **没打印「已保存」(未捕获 csv_export 响应)**:导出未被触发,或登录态已失效。重试步骤 2必要时重新登录后重跑。
- **解出的 zip 报损坏 / `Incorrect padding`**`zippedData` 是 URL-safe 无填充 base64脚本已按此解码并做完整性校验后落盘仍报错说明响应内容异常检查是否被代理/网关改写。
- **文件名变成 `export.zip` 而非标准命名**:请求体解析失败触发兜底,内容仍完整;检查日期范围与账号名是否正常。
- **中文/特殊字符文件名**:已把 Windows 非法字符 `\/:*?"<>|` 自动替换为 `_`,不会因文件名失败。
## 产物与去重
- **下载目录不存在导致写盘失败**:脚本启动时会自动创建下载目录(`os.makedirs(..., exist_ok=True)`)。沙箱/受限环境看不到 `D:\Downloads` 时,用 `--download-dir` 指向工作区内目录即可。
- **重名文件**:自动按 `名称 (1).zip``名称 (2).zip` 递增;这是脚本自己的 dedup_path 逻辑,不依赖浏览器。