com um clique
spider
// Atomic reference for three spider flows: spider:extract:file, spider:extract:url, spider:zhihu — inputs, outputs, env vars only.
// Atomic reference for three spider flows: spider:extract:file, spider:extract:url, spider:zhihu — inputs, outputs, env vars only.
| name | spider |
| description | Atomic reference for three spider flows: spider:extract:file, spider:extract:url, spider:zhihu — inputs, outputs, env vars only. |
在 monorepo 根目录执行(cwd 影响相对路径;DeepSeek 相关见仓库根 .env)。packages/spider/README.md 仅为路牌链回本文。
{ title, content } JSON用法
SPIDER_SOURCE=<相对或绝对路径> \
[SPIDER_OUTPUT_FILENAME=<文件名>] \
pnpm spider:extract:file
自定义输出目录(此时 SPIDER_OUTPUT_DIR 必填):
SPIDER_SOURCE=<路径> \
SPIDER_OUTPUT_DIR=<目录> \
[SPIDER_OUTPUT_FILENAME=<文件名>] \
pnpm exec tsx packages/spider/cli-extract-text-file-json.ts
输入
| 项目 | 说明 |
|---|---|
SPIDER_SOURCE | 本地 UTF-8 文本/Markdown 等文件路径(相对 cwd) |
| 标题推导 | 首条非空行为 # 标题 → 该行为 title、余下为 content;否则 title = 文件名去扩展名,content = 全文 |
输出
| 路径 | 内容 |
|---|---|
<SPIDER_OUTPUT_DIR>/<SPIDER_OUTPUT_FILENAME> | JSON:{ "title": string, "content": string } |
pnpm spider:extract:file 通过脚本 固定 SPIDER_OUTPUT_DIR=output/spider。走 tsx …cli-extract-text-file-json.ts 时目录由你设定。
环境变量
| 变量 | 必填 | 默认值 / 说明 |
|---|---|---|
SPIDER_SOURCE | 是 | 文件路径 |
SPIDER_OUTPUT_DIR | 用 pnpm spider:extract:file 时不必设(脚本设为 output/spider);用 直接 tsx 时 是 | — |
SPIDER_OUTPUT_FILENAME | 否 | output.json |
{ title, content } JSON(Puppeteer)用法
SPIDER_SOURCE=<https://…> \
[SPIDER_OUTPUT_FILENAME=<文件名>] \
pnpm spider:extract:url
自定义输出目录:
SPIDER_SOURCE=<https://…> \
SPIDER_OUTPUT_DIR=<目录> \
[SPIDER_OUTPUT_FILENAME=<文件名>] \
pnpm exec tsx packages/spider/cli-extract-page-url-json.ts
输入
| 项目 | 说明 |
|---|---|
SPIDER_SOURCE | 完整 URL,须以 http:// 或 https:// 开头 |
输出
| 路径 | 内容 |
|---|---|
<SPIDER_OUTPUT_DIR>/<SPIDER_OUTPUT_FILENAME> | JSON:{ "title": string, "content": string }(多回答会合并进 content) |
pnpm spider:extract:url 固定 SPIDER_OUTPUT_DIR=output/spider。
环境变量
| 变量 | 必填 | 默认值 / 说明 |
|---|---|---|
SPIDER_SOURCE | 是 | 页面 URL |
SPIDER_OUTPUT_DIR | 同「用法 1」 | — |
SPIDER_OUTPUT_FILENAME | 否 | output.json |
PUPPETEER_EXECUTABLE_PATH | 否 | 自定义 Chromium |
SPIDER_SAVE_DEBUG | 否 | 设 1 时在 SPIDER_OUTPUT_DIR(未设则包内默认 output/spider)下写调试 PNG/HTML |
用法
pnpm spider:zhihu -- https://www.zhihu.com/question/<id>
或:
pnpm exec tsx packages/spider/zhihu/cli-zhihu-video-prep.ts https://www.zhihu.com/question/<id>
(pnpm spider:zhihu 会设 SPIDER_OUTPUT_DIR=output/spider。)
输入
| 项目 | 说明 |
|---|---|
| 第一个 CLI 参数 | 知乎问题 URL,须匹配 https://www.zhihu.com/question/... |
输出
| 路径 | 内容 |
|---|---|
<SPIDER_OUTPUT_DIR>/output.json | { "title", "content", "answers": [...] } |
<SPIDER_OUTPUT_DIR>/title.json | { "title": string } |
public/video/title.json | 与上同内容的副本(供 Remotion) |
getTtsInputFile() 解析路径(默认可为 <SPIDER_OUTPUT_DIR>/input.txt) | 口播正文;由 caption-generator 写入,TTS_INPUT_FILE 可覆盖 |
口播生成失败时:output.json 等抓取结果仍可保留(仅控制台告警)。
环境变量
| 变量 | 必填 | 默认值 / 说明 |
|---|---|---|
SPIDER_OUTPUT_DIR | 否 | pnpm spider:zhihu 设为 output/spider;直接 tsx 未设时包内默认 output/spider |
DEEPSEEK_API_KEY | 口播需要 | 环境变量或仓库根 .env |
TTS_INPUT_FILE | 否 | 覆盖默认 input.txt 路径(caption-generator / getTtsInputFile()) |
PUPPETEER_EXECUTABLE_PATH | 否 | 自定义 Chromium |
SPIDER_SAVE_DEBUG | 否 | 设 1 时写调试 PNG/HTML(目录规则同用法 2) |
Multi-platform browser login and video upload via Playwright Test only (headed Chromium). Parallel uploads are allowed and encouraged: run one Playwright process per platform (e.g. separate terminals). Use when the user mentions publishing, uploading video, or logging in to Bilibili, Douyin, Kuaishou, Weixin Channels, or YouTube; or STEP3 / 多平台发布 / login:* / upload:*.
Prefer the hosting AI Agent to write narration into input.txt from crawl JSON (no external LLM). Fallback only: pnpm caption:env / generateVideoScript* (DeepSeek or Kimi) + optional WebVTT estimate. Triggers: 口播, input.txt, captions.vtt, LLM_PROVIDER, DEEPSEEK, MOONSHOT, KIMI.
Run Remotion renders from monorepo root: pnpm render:video, render:all / pipeline:tts-render, render:composition; sync-to-public, composition IDs, output/video paths, VIDEO_PUBLIC_DIR. Use for 渲染成片, output/video/video.mp4, remotion render, Cover-Still.
Atomic reference for @panda-video-generator/tts-node: pnpm tts, cli.ts, processNarrationFile — Edge-TTS narration → audio.mp3 + audio.vtt; env vars TTS_*, EDGE_TTS_*, ffmpeg. Triggers: TTS, Edge-TTS, 口播音频, audio.mp3, public/tts.
Orchestrates repo pipeline from a single URL: branch Zhihu vs generic page → spider → DeepSeek caption when needed → Edge TTS → Remotion render to output/video/video.mp4. Use when the user gives a URL for 一条龙、网页转视频、爬取+口播+渲染、or automate spider→tts→render from link.