{"id":"8e79a9b7-e006-4e9e-9843-14df4fc71a87","entityType":"agent","slug":"clawhub-afeicn-douyin-video-to-txt","name":"Douyin Video To Txt","canonicalUrl":"https://www.xpersona.co/agent/clawhub-afeicn-douyin-video-to-txt","canonicalPath":"/agent/clawhub-afeicn-douyin-video-to-txt","generatedAt":"2026-10-14T11:55:23.025Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-11T20:43:23.051Z","emptyReason":null},"description":"抖音视频转文本知识库 — Download Douyin videos, transcribe to text via faster-whisper, save to Obsidian knowledge base. Skill: Douyin Video To Txt Owner: afeicn Summary: 抖音视频转文本知识库 — Download Douyin videos, transcribe to text via faster-whisper, save to Obsidian knowledge base. Tags: latest:2.0.3 Version history: v1.0.1 | 2026-07-10T06:25:30.731Z | user 更新：完善段落整理规则、补充whisper常见误识别表、优化长视频处理说明 v2.0.3 | 2026-06-14T03:23:15.129Z | user 清理：移除 Docker 相关描述（已不再依赖 Docker） v2.0.2 | 2026-06-14T03:21:54.181Z | user 名称改为中文：抖音视频转文本知识库 v2.0.1 | 2026-","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 995 downloads reported by the source. Last updated 10/11/2026.","installCommand":"clawhub skill install s1764p5yr71a3nnatyxkt1pnhh86p8vm:douyin-video-to-txt","sourceUrl":"https://clawhub.ai/afeicn/douyin-video-to-txt","homepage":"https://clawhub.ai/afeicn/skills/douyin-video-to-txt","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/afeicn/douyin-video-to-txt","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/afeicn/skills/douyin-video-to-txt","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":60,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"抖音视频转文本知识库 — Download Douyin videos, transcribe to text via faster-whisper, save to Obsidian knowledge base. Skill: Douyin Video To Txt Owner: afeicn Summary: 抖"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-11T20:43:23.051Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T20:43:23.051Z","emptyReason":null},"stars":null,"forks":null,"downloads":995,"likes":null,"task":null,"library":null,"packageName":null,"latestVersion":"1.0.1","tractionLabel":"995 downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T20:43:22.979Z","emptyReason":null},"lastUpdatedAt":"2026-10-11T20:43:23.051Z","lastCrawledAt":"2026-10-11T20:43:22.979Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-12T20:43:22.979Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.1","createdAt":"2026-07-10T06:25:30.731Z","changelog":"更新：完善段落整理规则、补充whisper常见误识别表、优化长视频处理说明","fileCount":8,"zipByteSize":17101},{"version":"2.0.3","createdAt":"2026-06-14T03:23:15.129Z","changelog":"清理：移除 Docker 相关描述（已不再依赖 Docker）","fileCount":3,"zipByteSize":4313},{"version":"2.0.2","createdAt":"2026-06-14T03:21:54.181Z","changelog":"名称改为中文：抖音视频转文本知识库","fileCount":3,"zipByteSize":4393},{"version":"2.0.1","createdAt":"2026-06-14T03:21:08.891Z","changelog":"修复：移除个人文件夹名，改为通用 douyin_text 目录","fileCount":3,"zipByteSize":4476},{"version":"2.0.0","createdAt":"2026-06-14T03:17:40.532Z","changelog":"新增：纯文字稿输出(text_plain.txt)、自动写入Obsidian知识库、AI总结追加到笔记","fileCount":3,"zipByteSize":4359},{"version":"1.0.0","createdAt":"2026-06-14T03:15:43.253Z","changelog":"Initial release: Local Douyin video-to-text pipeline - Download any Douyin video by URL, extract its audio, and transcribe speech to text fully offline. - Uses yt-dlp for video download, ffmpeg for audio extraction, and faster-whisper for transcription—no API keys required. - Outputs complete timed subtitles (text.txt) along with source video and audio files. - Workflow, prerequisites, and troubleshooting details included in documentation. - Optimized for fast local use, especially on Apple Silicon Macs.","fileCount":3,"zipByteSize":3383}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s1764p5yr71a3nnatyxkt1pnhh86p8vm:douyin-video-to-txt","setupComplexity":"low","setupSteps":["Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-afeicn-douyin-video-to-txt/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-afeicn-douyin-video-to-txt/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-afeicn-douyin-video-to-txt/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-afeicn-douyin-video-to-txt/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-afeicn-douyin-video-to-txt/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-afeicn-douyin-video-to-txt/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-14T11:55:23.024Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-afeicn-douyin-video-to-txt/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-afeicn-douyin-video-to-txt/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-afeicn-douyin-video-to-txt/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-afeicn-douyin-video-to-txt/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-11T20:43:23.051Z","emptyReason":null},"readme":"Skill: Douyin Video To Txt\n\nOwner: afeicn\n\nSummary: 抖音视频转文本知识库 — Download Douyin videos, transcribe to text via faster-whisper, save to Obsidian knowledge base.\n\nTags: latest:2.0.3\n\nVersion history:\n\nv1.0.1 | 2026-07-10T06:25:30.731Z | user\n\n更新：完善段落整理规则、补充whisper常见误识别表、优化长视频处理说明\n\nv2.0.3 | 2026-06-14T03:23:15.129Z | user\n\n清理：移除 Docker 相关描述（已不再依赖 Docker）\n\nv2.0.2 | 2026-06-14T03:21:54.181Z | user\n\n名称改为中文：抖音视频转文本知识库\n\nv2.0.1 | 2026-06-14T03:21:08.891Z | user\n\n修复：移除个人文件夹名，改为通用 douyin_text 目录\n\nv2.0.0 | 2026-06-14T03:17:40.532Z | user\n\n新增：纯文字稿输出(text_plain.txt)、自动写入Obsidian知识库、AI总结追加到笔记\n\nv1.0.0 | 2026-06-14T03:15:43.253Z | auto\n\nInitial release: Local Douyin video-to-text pipeline\n\n- Download any Douyin video by URL, extract its audio, and transcribe speech to text fully offline.\n- Uses yt-dlp for video download, ffmpeg for audio extraction, and faster-whisper for transcription—no API keys required.\n- Outputs complete timed subtitles (text.txt) along with source video and audio files.\n- Workflow, prerequisites, and troubleshooting details included in documentation.\n- Optimized for fast local use, especially on Apple Silicon Macs.\n\nArchive index:\n\nArchive v1.0.1: 8 files, 17101 bytes\n\nFiles: references/clawhub-publish.md (1000b), references/completed-note-example.md (2974b), references/douyin-downloader-workarounds.md (3363b), references/whisper-common-mistakes.md (2463b), scripts/transcribe.py (7086b), skill-card.md (2551b), SKILL.md (11472b), _meta.json (138b)\n\nFile v1.0.1:SKILL.md\n\n---\nname: douyin-video-to-txt\ndescription: 抖音视频转文字 - 粘贴抖音链接，自动下载音频、Whisper转写、AI摘要，保存到 Obsidian Vault\ntags: [douyin, transcription, obsidian, video-to-text]\n---\n\n# 抖音视频转文字 (douyin-video-to-txt)\n\n**一句话**：把抖音链接丢过来，自动转成整理好的文字稿+AI总结，存到 Obsidian。\n\n## 工作流程（两阶段）\n\n### 关键规则（重要，容易踩坑）\n\n#### 段落整理（必须做，不是简单去时间戳）\n原始转写输出的是一句一行的碎片文本。**必须由 Agent 整理成自然段落**：\n1. 相邻短句按语义合并成段落\n2. 话题切换处分段（如\"第一层\"\"第二层\"等层级标记）\n3. 每段是完整通顺的中文段落，有逗号句号\n4. 专业术语保留原样\n5. 去掉 Whisper 产生的重复/断裂\n\n#### AI 总结（必须做，不是取前几句）\n- 基于全文理解，提炼核心论点\n- 结构化呈现（如分层级、分要点）\n- 用自然语言，不要\"本文介绍了\"\"作者认为\"这类废话\n- 长度 150-300 字，提炼精华不是复述细节\n\n#### 错误案例（之前踩过的坑）\n❌ 转写完成后只保存了带时间戳的原始文本\n❌ \"摘要\" = 取前 5 句拼接\n❌ 完整文案 = 一句一行，没有段落\n✅ 正确做法：AI 总结 + 段落式完整文案\n\n```\n[Phase 1 — transcribe.py]\n\n```\n[Phase 1 — transcribe.py]\n用户发抖音链接\n  │\n  ▼ yt-dlp 下载音频\n  │\n  ▼ faster-whisper 转写\n  │\n  ▼ 保存两样东西:\n     ├── 原始笔记 .md（纯文本、句句分行、无时间戳）\n     └── 数据文件 .data.json（带 segments 详情，供 Agent 处理）\n\n[Phase 2 — Hermes Agent]\n  │\n  ▼ 读取原始文本\n  │\n  ▼ 整理成自然段落\n     - 相近句子合并成一段\n     - 按话题切换分段（如\"第一层\"、\"第二层\"等）\n     - 中文语境下，短句合并为通顺的段落\n  │\n  ▼ 生成 AI 总结（基于全文理解，非简单截取）\n  │\n  ▼ 更新 Obsidian 笔记：\n     标题 + metadata\n     → AI 总结\n     → 完整文案（段落式）\n```\n\n## 前置依赖\n\n| 工具 | 状态 |\n|------|------|\n| ffmpeg | ✅ 已装 |\n| yt-dlp | ✅ 已装（⚠️ Douyin extractor 可能因反爬升级失效） |\n| faster-whisper (Python) | ✅ 已装 (model: base) |\n\n## 备用方案：第三方下载服务（当 yt-dlp Douyin extractor 失效时）\n\n当 yt-dlp 持续报 \"Fresh cookies are needed\" 且更新后仍无效时，使用第三方抖音下载器代替 yt-dlp 下载音频。\n\n### 推荐服务\n\n| 服务 | 网址 | 成功率 | 说明 |\n|------|------|--------|------|\n| SaveTik | https://en.savetik.co/ | ⭐⭐⭐ | 可直接下载 MP3，部分视频可能找不到 |\n| Seekin.ai | https://www.seekin.ai/douyin-downloader/ | ⭐⭐⭐⭐ | 支持多分辨率（540p~8K），下载链接需在浏览器中捕获 |\n\n### 浏览器工作流\n\n1. **导航到下载服务网站**：用 browser_navigate 打开上述服务\n2. **粘贴抖音链接**：将抖音短链接粘贴到输入框（browser_type）\n3. **提交获取结果**：点击 Download Now / Get 按钮\n4. **捕获下载链接**：\n   - 如果服务直接提供 MP3 下载（SaveTik），用终端 curl/wget 下载\n   - 如果服务提供多分辨率选项（Seekin），**点击 Download 按钮后浏览器可能直接导航到原始 MP4 文件 URL**（URL 以 `v13-default.365yg.com/...video...mp4?` 等格式出现）。直接在当前页用 `curl -L -o /tmp/video.mp4 \"<current_url>\"` 下载，然后 `browser_back()` 回下载页\n   - 尝试通过浏览器控制台拦截 API 响应或检查 DOM 中的下载链接\n5. **手动下载（兜底）**：如果浏览器无法捕获下载链接，告诉用户去哪个服务手动下载，获取文件路径后再进行 Whisper 转写\n\n> 详情见 `references/douyin-downloader-workarounds.md`\n\n### 浏览器工作流常见坑（browser_click 对 Vue/React 按钮无效）\n\n当使用 Seekin.ai 等 SPA 网站下载时，`browser_click()` 经常无法触发按钮事件。这是因为这类网站的按钮用框架事件绑定而不是原生 DOM 事件。如果点击后页面无变化：\n\n1. **不要重复点** — 按钮可能已触发但 `browser_snapshot()` 感知不到变化\n2. 改用 `browser_console()` 执行 JS：\n   ```js\n   document.querySelectorAll('.btn--download')[索引].dispatchEvent(new MouseEvent('click', {bubbles: true, cancelable: true}))\n   ```\n3. 触发后浏览器可能直接导航到视频 CDN 链接，立即用 `browser_console(expression='window.location.href')` 捕获 URL\n4. 然后用 `curl -L` 下载，再用 `browser_navigate()` 回到下载页\n\n详情见 `references/douyin-downloader-workarounds.md` 方案 B。\n\n### 手动转写已下载的音频文件\n\n如果通过第三方服务获得了 MP3/MP4 文件，可以直接用 faster-whisper 手动转写：\n\n```python\nfrom faster_whisper import WhisperModel\nmodel = WhisperModel('base', device='cpu', compute_type='float32')\nsegments, info = model.transcribe('/path/to/audio.mp3', language='zh', beam_size=5)\nfor seg in segments:\n    print(seg.text.strip())\n```\n\n然后将输出文本按 Phase 2 流程（段落整理 + AI 总结）生成最终笔记。\n\n## 使用方法\n\n### 在对话中\n直接发抖音链接，比如：\n```\n帮我转一下这个视频 https://v.douyin.com/xxxxxx/\n```\n或者直接丢链接。Agent 自动跑完整两阶段流程。\n\n### 手动运行脚本\n```bash\npython3 ~/.hermes/skills/douyin-video-to-txt/scripts/transcribe.py <抖音链接>\n```\n\n## 输出文件\n\n保存到 `$OBSIDIAN_VAULT_PATH/douyin_text/`。\n\n每次转写生成两个文件：\n\n| 文件 | 说明 |\n|------|------|\n| `2026-06-14_标题.md` | 最终笔记：AI总结 + 段落式完整文案 |\n| `2026-06-14_标题.data.json` | 中间数据（Agent 处理后不再需要） |\n\n### 笔记格式\n\n```markdown\n---\ntitle: \"视频标题\"\nsource: \"douyin\"\nurl: \"https://v.douyin.com/xxxxxx/\"\nauthor: \"作者名\"\ndate: \"2026-06-14 11:30\"\nduration: \"3:45\"\ntags: [douyin, transcription]\nstatus: \"raw\"\n\n> ⚠️ 作者名（author）可能为 yt-dlp 返回的数字用户 ID（如\"22739267108\"），需要从视频标题或描述中提取显示名填入最终笔记。标题中\"【作者名】\"或\"作者名作品\"格式可参考。\n---\n\n## AI 总结\n\n（Hermes Agent 生成的完整总结，基于全文理解）\n\n## 完整文案\n\n（段落式整理，不是一句一行的碎片）\n\n第一段内容，几个相关的句子合并成一个自然段落。\n\n下一段讲另一个话题，句子合并后逻辑通顺。\n\n**第一层：Data Connection。** 代码块里的专业术语保持原样，句子合并成通顺的中文段落。\n\n...\n---\n*由 douyin-video-to-txt 自动转录生成*\n```\n\n### 段落整理规则（Agent 执行）\n\nPhase 2 中，Agent 需要将原始句句分行的文本整理成段落：\n\n1. **相邻短句合并**：Whisper 经常把一句话切成多段，需要按语义合并\n2. **话题切换处分段**：如\"第一层\"\"第二层\"等层级标记处，自然分段\n3. **完整句子结构**：合并后确保每段是一个或几个完整的句子，有逗号句号\n4. **专业术语保留**：Palantir、Ontology、ETL、Pipeline 等专有名词保持原样\n5. **口语转书面但保留风格**：去掉\"嗯\"\"啊\"等填充词，但保留 speaker 的语气节奏\n6. **修正同音别字**：faster-whisper 对中文技术内容经常产生同音别字（如\"途普→图谱\"\"试识→事实\"\"文党→文档\"\"语一/语谊→语义\"\"股价→骨架\"\"要务→药物\"\"约数→约束\"\"课体→客体\"\"证物→政务\"\"康复→客服\"\"适应→实例\"\"肢神→之称\"\"Nalless→Knowledge\"等），整理段落时必须结合上下文逐处修正，不能照抄原始文本\n7. **中文+英文混说的特殊处理**：当视频内容包含英文界面名词（如 Library→自然库/资源库、Caches→没识别、Finder→没识别、.app→没识别）时，Whisper 会将英文词误转为音近中文甚至直接跳过。整理时必须：\n   - 根据视频主题推断缺失的英文术语。如 Mac 清理教程中出现\"自然库\"→资源库(Library)、\"文件牙\"→文件夹(Folder)\n   - 用行业常识补全：中文技术类视频的常见误转列表可参考 `references/whisper-common-mistakes.md`\n\n### AI 总结规则（Agent 执行）\n\n1. **基于全文理解**，不是简单取前几句\n2. **提炼核心论点**，不是复述全部细节\n3. **结构化呈现**：如分层级、分要点\n4. **用自然语言**，不需要\"本文介绍了\"\"作者认为\"这类废话\n\n> 完整参考示例见 `references/completed-note-example.md`\n\n## 注意事项\n\n- 默认使用 faster-whisper `base` 模型（CPU），约 1.5GB 内存\n- 可通过 `FW_MODEL_SIZE=small` 切换更大模型（更准但更慢）\n- 抖音链接需要是公开可访问的（非私密/限流视频）\n- yt-dlp 的 Douyin extractor 偶尔会失效，需更新：`pip3 install --upgrade yt-dlp`\n\n### 长视频处理（>15分钟）\n\n较长视频（如30-60分钟的播客对话）容易踩两个坑：\n\n1. **终端超时**：默认 foreground terminal 的 timeout 较短（~300s）。对于15分钟以上的视频，**必须使用 background 模式**运行：\n   ```\n   terminal(background=true, command=\"python3 ~/.hermes/skills/douyin-video-to-txt/scripts/transcribe.py <链接>\", timeout=7200)\n   ```\n   然后通过 `process(action=\"wait\")` 或 `process(action=\"poll\")` 检查进度。\n\n2. **日志显示为空**：transcribe.py 的进度信息输出到 stderr（`print(..., file=sys.stderr)`），background 模式默认只捕获 stdout，因此 `process(action=\"log\")` 可能显示 0 行输出。**这并不意味着进程卡住**——用 `ps aux | grep transcribe` 检查进程是否活跃，或用 CPU 使用率判断（faster-whisper 转录时会占满单核/多核）。也可以用 `lsof -p <PID>` 查看文件句柄确认工作阶段。\n\n3. **含Unicode特殊字符的文件名**：抖音标题中的中文引号（\"\"\"\"）、特殊符号等会导致 write_file / read_file 工具找不到文件。应改为：先用 terminal 中 glob 找到真正路径，再通过 Python 脚本读写，或直接写入不含特殊符号的文件名后用 shutil.copy2 覆盖。\n\n4. **AI 总结长度弹性**：长视频（>30分钟、>10000字）的 AI 总结不应拘泥于 150-300 字上限。如果视频包含多个独立话题（如嘉宾介绍→概念解析→案例分享→趋势展望），应提供结构化的多段式总结，每个话题一个段落，总长度可达 500-800 字。规则是：**总结要完整覆盖所有核心论点，不因字数限制而截断后半段内容**。\n\n## 故障排查\n\n| 问题 | 原因 | 解决 |\n|------|------|------|\n| yt-dlp 报错 | Douyin extractor 过期 | `pip3 install --upgrade yt-dlp` |\n| yt-dlp 持续报 \"Fresh cookies are needed\" | Douyin 反爬升级，cookies 验证失败 | 见下方 **备用方案：第三方下载服务** |\n| faster-whisper OOM | 模型太大 | 设置 `FW_MODEL_SIZE=tiny` |\n| 音频找不到 | 下载失败 | 检查链接是否公开；尝试第三方服务下载音频 |\n| 转写字数很少 | 视频无声或纯音乐 | 确认视频含人声 |\n| Python RuntimeWarning: divide by zero / overflow in matmul | macOS 上 Python 3.9/3.14 混合环境下的 numpy + faster-whisper 兼容问题 | 不影响转写结果，可忽略。若想消除，用 `pip3 install --upgrade numpy` 统一 numpy 版本 |\n\nFile v1.0.1:_meta.json\n\n{\n  \"ownerId\": \"kn77499qe4se2kf8tcm3a5nypx8194cw\",\n  \"slug\": \"douyin-video-to-txt\",\n  \"version\": \"1.0.1\",\n  \"publishedAt\": 1783664730731\n}\n\nFile v1.0.1:references/clawhub-publish.md\n\n# ClawHub 发布参考\n\n## 命令\n\n```bash\nclawhub skill publish <absolute_path> --version X.Y.Z --changelog \"更新说明\"\n```\n\n当需要指定显示名称时：\n```bash\nclawhub skill publish <path> --version X.Y.Z --name \"中文显示名\"\n```\n\n## 已知坑\n\n### `--version` 必须作为 CLI 参数\n版本号写在 SKILL.md frontmatter 里不够——`clawhub` 还会报 `Error: --version must be valid semver`。必须显式传 `--version X.Y.Z`。\n\n### 绝对路径比相对路径可靠\n第一次用 `cd <dir> && clawhub skill publish .` 报了 `Error: SKILL.md required`，即使文件确实在目录里。换成绝对路径（加 `DEBUG=1`）就通过了。建议直接用绝对路径。\n\n### DEBUG 环境变量\n遇到奇怪错误时加 `DEBUG=1` 可以看到更多信息，有时换了就过了（可能是竞态或缓存问题）。\n\n## 版本号建议\n\n- 修 bug / 改文案 → patch（2.0.0 → 2.0.1）\n- 加功能 → minor（2.0.0 → 2.1.0）\n- 大重构 → major（2.0.0 → 3.0.0）\n\nFile v1.0.1:references/completed-note-example.md\n\n# 完成笔记示例\n\n这是 douyin-video-to-txt Phase 2 完成后的最终笔记格式。Agent 在整理段落和生成总结时以此为参考标准。\n\n## 实际示例：Palantir Ontology 视频\n\n```markdown\n---\ntitle: \"Palantir Ontology 是怎么跑起来的\"\nsource: \"douyin\"\nurl: \"https://www.douyin.com/video/7650867554675641638\"\nauthor: \"Suncooler\"\ndate: \"2026-06-14 11:29\"\nduration: \"6:35\"\ntags: [douyin, transcription, palantir, ontology, AI]\nstatus: \"complete\"\n---\n\n## AI 总结\n\nPalantir Ontology 不是用来表示数据的，是用来表示决策的——数据是原料，决策是成品。视频用一个真实 demo 开场：AI agent 监测到供应链风险后，自动跑完五步——查供应商、锁原材料、顺价值链推下游影响、算 Revenue at Risk、提交结论给人类审核。整个过程不到两分钟。\n\n但作者说：这不是 AI 案例，这是 Pipeline 案例。AI 只是最后两脚油门，前面五层数据加工才是它能踩油门的前提。\n\nOntology = Palantir Foundry 的核心，拆成 7 层：\n\n1. **Data Connection**（线）— 把数据从原系统拉进来，Palantir 把传统 ETL 产品化了\n2. **Raw Storage**（表）— 保留原始数据血统，从根上解决数据口径对不上的问题\n3. **Cleaning & Parsing**（清洗）— Code Workbook + Pipeline Builder 混合\n4. **Standardize Tables**（半对象）— 跨系统整合成业务可用的视图\n5. **Object Backing**（对象化）— 标准表变成 Ontology 对象\n\n后三层（下期讲）：Final、AIP Logic、Action Type。\n\n## 完整文案\n\n今年4月，汉奴威工业展AWS的舞台上，Mirkega默克集团百年生命科学巨头的数字化采购负责人Mike Benzheim跟Palantir的FDE一起做了一场Live demo。屏幕上跑的是一个叫Foundry的平台，一个AI agent刚刚监测到一条新闻——某个区域出现了供应链风险。\n\n普通人的反应是什么？开会、找人、打电话。这个Agent的反应是他自己跑完了五步：第一步查供应商，第二步锁原材料，第三步顺价值链推下游影响，第四步算Revenue at Risk，第五步把结论和数据节点、推理过程提交给人类审核。整个过程不到两分钟。\n\n你听完这段可能会说，这是个很酷的AI案例。错，这不是AI案例，这是Pipeline案例。AI只是最后两脚油门……\n\n---\n*由 douyin-video-to-txt 自动转录生成*\n```\n\n## 关键原则\n\n| 方面 | 要求 |\n|------|------|\n| AI 总结 | 基于全文理解，提炼核心论点。不是取前几句也不是复述全部。用语自然，无\"本文介绍了\"类废话 |\n| 段落整理 | 相邻短句合并，按话题切换分段。保留专业术语原样。去掉填充词但保持语气节奏 |\n| 标题 | 用有意义的中文标题，去掉 yt-dlp 返回的杂乱描述后缀 |\n| author | 用视频创作者的真实名字（如 Suncooler），不是 user ID |\n| tags | 根据内容打标签，帮助 Obsidian 检索 |\n\nFile v1.0.1:references/douyin-downloader-workarounds.md\n\n# Douyin Downloader Workarounds\n\n当 yt-dlp Douyin extractor 因反爬升级失效时的备用方案。\n\n## 根因分析\n\nyt-dlp 的 Douyin extractor 报错 `Fresh cookies (not necessarily logged in) are needed` 的原因：\n- Douyin 的 API 返回空 JSON（API endpoint 返回 `{}` 或 200 HTTP 无 body）\n- extractor 内部检查 `s_v_web_id` cookie，但该 cookie 有有效期\n- macOS 沙箱限制无法读取 Chrome cookie 数据库（`--cookies-from-browser chrome` 失败）\n- 从浏览器 console 提取的 cookies 可能在短时间内过期\n- 本地存在代理（127.0.0.1:7897），可能干扰 SSL 握手\n\n## 已验证的工作流（2026-06-29）\n\n### 方案 A：SaveTik.io（推荐，可直接下载 MP3）\n\n1. 浏览器导航到 `https://en.savetik.co/`\n2. 粘贴抖音短链接到输入框\n3. 点击 Get/Download\n4. 服务返回 MP3 下载链接 → 用 curl/wget 下载到本地\n5. 直接用 faster-whisper 转写已下载的 MP3\n\n**已验证**：6.5MB MP3 下载成功，whisper 转写正常。\n\n### 方案 B：Seekin.ai（推荐，MP4 直链最稳定）\n\n1. 浏览器导航到 `https://www.seekin.ai/douyin-downloader/`\n2. 粘贴抖音短链接，点击 Download Now\n3. 等待服务处理完成（按钮从 \"Extracting\" 变回 \"Download Now\"）\n4. 结果会显示多分辨率选项（8K/1080p/720p/540p + MP3/JPG）\n5. **⚠️ 关键技巧：触发 Download 按钮下载**\n   - Seekin.ai 是 Nuxt.js 应用，Download 按钮用 Vue 事件绑定\n   - `browser_click()` 对这类按钮**无效**（DOM 事件未正确触发）\n   - 正确做法：用 `browser_console(expression=...)` 执行 JS 派发事件：\n     ```js\n     document.querySelectorAll('.btn--download')[0].dispatchEvent(new MouseEvent('click', {bubbles: true, cancelable: true}))\n     ```\n   - 推荐选 **540p 或 720p**（文件更小，音频足够转写，8K 的 69MB 纯属浪费）\n   - **分辨率索引**：第 0 个是 8K，第 1 个是 1080p，第 2 个是 720p，第 3 个是 540p\n     ```js\n     // 选 540p：\n     document.querySelectorAll('.btn--download')[3].dispatchEvent(new MouseEvent('click', {bubbles: true, cancelable: true}))\n     ```\n6. **捕获 MP4 直链**\n   - DispatchEvent 触发后，**浏览器直接导航到原始 MP4 文件 URL**（URL 以 `v26-default.365yg.com/...video...mp4?` 等格式出现）\n   - 立即用 `browser_console(expression='window.location.href')` 获取当前 URL\n   - 然后用 `curl -L -o /tmp/video.mp4 \"<url>\"` 下载（timeout 设 120-180s）\n   - 之后用 `browser_navigate(url=...)` 回到下载页面继续操作\n7. 下载完成后，用 ffmpeg 提取音频进行 Whisper 转写：\n   ```bash\n   ffmpeg -i /tmp/video.mp4 -vn -acodec pcm_s16le -ar 16000 -ac 1 /tmp/audio.wav -y\n   ```\n\n**已验证**：720p 约 16MB，1080p 约 20.92MB，下载速度约 1.8MB/s。\n\n### 方案 C：使用节点时代的反代 API\n\n如果浏览器方案都不通，可以搜索抖音解析 API（如 `douyin.wtf` 等），但这些 API 稳定性较差：\n\n```bash\ncurl -s \"https://api.douyin.wtf/api?url=https://v.douyin.com/xxx/\"\n```\n\n## 注意事项\n\n- 第三方服务可能限流或被墙，需配合代理\n- 下载的 MP3 文件可能包含水印音频（不影响转写）\n- 每次使用前先试 yt-dlp 主流程，不通再降级到第三方服务\n- 第三方服务返回的视频/音频链接有时效性，应及时下载\n\nFile v1.0.1:references/whisper-common-mistakes.md\n\n# Whisper 中文常见误识别汇总\n\nfaster-whisper base/small 模型在处理中文内容时，对技术术语和英文混说场景的误识别率较高。整理常见错误模式供快速参考。\n\n## Mac/Apple 相关\n\n| Whisper 输出 | 正确内容 | 原因分析 |\n|-------------|---------|---------|\n| 自然库 | 资源库 (Library) | 音近，\"自然\" vs \"资源\" |\n| 文件牙 | 文件夹 | 音近且方言口音 |\n| 看慢的 / 看门的 | 按住 Option / Command | 英文按键名称未被识别 |\n| 分子楼 | 废纸篓 (Trash) | 音近 |\n| 签到分子楼 | 清倒废纸篓 | 语义推断+音近 |\n| 站持织的时刻 | 再看这个时候 | 完全错误 |\n| 厨存空间 | 储存空间 | 音近 |\n| 会条料 | 缓存 (Cache) | 音近 |\n| 会的条件 | 缓存 / 缓存的地方 | 同上 |\n| 致毕的一盘 | 512GB 的盘 | 数字+单位混说 |\n| 字 / 个字 | GB | 口语中\"G\"被识别为\"字\" |\n\n## 常见模式总结\n\n### 1. 同音别字（最频繁）\n两个字的词，其中一个字被同音替换：\n- 资源→自然、文件夹→文件牙、废纸篓→分子楼\n- 修复方法：确认主题后按语义还原\n\n### 2. 英文术语丢失\nWhisper 遇到英文词（尤其是短词/缩写）时：\n- 直接跳过（Caches→无输出）\n- 按近似中文读音拼写（Library→\"来不来\"等）\n- 修复方法：结合视频主题补全英文术语\n\n### 3. 数字+单位混淆\n中文口语的\"512GB\"经常被拆分：\n- \"512\" 和 \"GB\" 被分开识别\n- \"GB\" 被识别为同音字如\"个字\"\"字\"\"级\"\n- 修复方法：看上下文数字判断容量单位\n\n### 4. 方言/口音影响\n博主的口音（如东北话、南方口音）会导致：\n- z/zh/c/ch/s/sh 不分（字/制/吃等）\n- n/l 不分\n- 修复方法：调整标准读音后重新理解\n\n### 5. 长音变词边界错误\n相邻词被合并或一个词被拆分：\n- \"你看这个\"→\"你看看这个\"（重叠）\n- \"300多GB\"→\"300多个字\"\n- 修复方法：按语义修复，不必逐字对应\n\n## macOS 相关术语速查\n\n| 中文界面 | 英文原名 | 常见误识别 |\n|---------|---------|-----------|\n| 资源库 | Library | 自然库、样本库 |\n| 废纸篓 | Trash | 分子楼 |\n| 访达 | Finder | 很少被识别 |\n| 前往 | Go | 各了、各、割了 |\n| 个人 | Home/个人 | 各了 |\n| 缓存 | Caches | 会条料、快取 |\n| 储存空间 | Storage | 厨存空间、存储空间 |\n| 系统数据 | System Data | 系统资料、系统的数据 |\n\nFile v1.0.1:skill-card.md\n\n## Description: <br>\n抖音视频转文字 - 粘贴抖音链接，自动下载音频、Whisper转写、AI摘要，保存到 Obsidian Vault <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[afeicn](https://clawhub.ai/user/afeicn) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nEmployees, external users, and developers use this skill to turn public Douyin video links into transcribed Chinese text, AI summaries, and Obsidian-ready notes. It supports a two-phase workflow: local download and transcription followed by agent-driven paragraph cleanup and summary generation. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Fallback downloader workflows can send Douyin links to third-party services. <br>\nMitigation: Prefer the normal yt-dlp path; use fallback downloader sites only for public, non-sensitive videos after manually reviewing the site. <br>\nRisk: Transcript text, metadata, and segment JSON are saved as local files in the user's Obsidian vault. <br>\nMitigation: Review the configured output directory and avoid syncing or sharing generated notes that contain private or sensitive content. <br>\nRisk: Browser-console and curl workarounds may download media from redirected third-party URLs. <br>\nMitigation: Inspect resolved URLs before downloading and avoid account-restricted or private videos. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/afeicn/skills/douyin-video-to-txt) <br>\n- [Completed note example](references/completed-note-example.md) <br>\n- [Douyin downloader workarounds](references/douyin-downloader-workarounds.md) <br>\n- [Whisper Chinese common mistakes](references/whisper-common-mistakes.md) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, JSON, Shell commands, Guidance] <br>\n**Output Format:** [Markdown notes, JSON segment data, plain transcribed text, and command-line status output] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Writes outputs under the configured Obsidian vault douyin_text directory and may use temporary local audio or video files during transcription.] <br>\n\n## Skill Version(s): <br>\n1.0.1 (source: server release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v2.0.3: 3 files, 4313 bytes\n\nFiles: skill-card.md (2029b), SKILL.md (6435b), _meta.json (138b)\n\nFile v2.0.3:SKILL.md\n\n---\nname: douyin-video-to-txt\ndescription: 抖音视频转文本知识库 — Download Douyin videos, transcribe to text via faster-whisper, save to Obsidian knowledge base.\nargs: <douyin_url> - 抖音视频链接\nversion: 2.0.1\n---\n\n# 抖音视频转文本知识库（douyin-video-to-txt）\n\n下载抖音视频 → 提取音频 → faster-whisper 转写文字 → 输出双版本字幕 → 写入 Obsidian 知识库\n\n纯本地运行，不需要任何外部 API Key。\n\n## Prerequisites\n\n| 工具 | 用途 | 安装 |\n| --- | --- | --- |\n| **yt-dlp** | 下载抖音视频 | `brew install yt-dlp` |\n| **FFmpeg** | 提取音频 | `brew install ffmpeg` |\n| **faster-whisper** | 语音转文字 | `pip3 install faster-whisper` |\n\n环境变量（可选，用于 Obsidian 知识库路径）：\n- `OBSIDIAN_VAULT_PATH` — Obsidian vault 根目录，默认 `~/Documents`\n\n## Workflow\n\n### Step 1: 获取视频信息并下载\n\n```bash\nmkdir -p /tmp/douyin_analysis/{VIDEO_ID}\ncd /tmp/douyin_analysis/{VIDEO_ID}\nyt-dlp --print-json \"{DOUYIN_URL}\" 2>/dev/null | python3 -c \"\nimport json, sys\nd = json.load(sys.stdin)\nprint(f'ID={d[\\\"id\\\"]}')\nprint(f'Title={d[\\\"title\\\"]}')\nprint(f'Duration={d[\\\"duration\\\"]}')\nprint(f'Uploader={d.get(\\\"uploader\\\",\\\"\\\")}')\nprint(f'UploadDate={d.get(\\\"upload_date\\\",\\\"\\\")}')\n\"\nyt-dlp -o \"video.mp4\" \"{DOUYIN_URL}\" 2>/dev/null\n```\n\n### Step 2: 提取音频\n\n```bash\nffmpeg -i video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -y 2>/dev/null\n```\n\n### Step 3: 语音转文字（双版本输出）\n\n```python\nfrom faster_whisper import WhisperModel\n\nmodel = WhisperModel('small', device='auto', compute_type='auto')\nsegments, info = model.transcribe('/tmp/douyin_analysis/{VIDEO_ID}/audio.wav', language='zh')\n\nall_segments = []\nfor seg in segments:\n    all_segments.append(seg)\n\n# 输出 1: 带时间戳版本\nwith open('/tmp/douyin_analysis/{VIDEO_ID}/text.txt', 'w', encoding='utf-8') as f:\n    for seg in all_segments:\n        line = f'[{seg.start:.1f}s -> {seg.end:.1f}s] {seg.text.strip()}'\n        f.write(line + '\\n')\n\n# 输出 2: 纯文字稿（无时间戳）\nplain_lines = []\nfor seg in all_segments:\n    plain_lines.append(seg.text.strip())\nplain_text = '\\n'.join(plain_lines)\n\nwith open('/tmp/douyin_analysis/{VIDEO_ID}/text_plain.txt', 'w', encoding='utf-8') as f:\n    f.write(plain_text)\n```\n\n### Step 4: 写入 Obsidian 知识库\n\n把纯文字稿保存到知识库中合适的目录下。每条视频保存为一个独立的 markdown 文件，格式如下：\n\n```markdown\n---\nsource: 抖音\nurl: {DOUYIN_URL}\nauthor: {UPLOADER}\ndate: {UPLOAD_DATE}\nduration: {DURATION}s\ntags: [抖音转录, {AUTHOR}]\n---\n\n# {TITLE}\n\n**来源：** 抖音 | **作者：** {UPLOADER} | **时长：** {DURATION}s\n\n---\n\n## 文字稿\n\n{PLAIN_TEXT}\n```\n\n知识库路径规则：\n- 优先写入 `$OBSIDIAN_VAULT_PATH/douyin_text/{TITLE_SLUG}.md`\n- 如果 `OBSIDIAN_VAULT_PATH` 未设置，默认 `~/Documents/douyin_text/`\n- 自动创建目录（如果不存在）\n\n```bash\nVAULT=\"${OBSIDIAN_VAULT_PATH:-$HOME/Documents}\"\nTARGET_DIR=\"$VAULT/douyin_text\"\nmkdir -p \"$TARGET_DIR\"\n\n# 用视频标题做文件名（清理特殊字符）\nSAFE_TITLE=$(echo \"$VIDEO_TITLE\" | sed 's/[\\/:*?\"<>|]/_/g' | cut -c1-60)\nNOTE_PATH=\"$TARGET_DIR/${SAFE_TITLE}.md\"\n\npython3 << 'PYEOF'\nimport os\nurl = \"{DOUYIN_URL}\"\ntitle = \"\"\"{TITLE}\"\"\"\nuploader = \"{UPLOADER}\"\ndate = \"{UPLOAD_DATE}\"\nduration = \"{DURATION}\"\n\nwith open('/tmp/douyin_analysis/{VIDEO_ID}/text_plain.txt', 'r', encoding='utf-8') as f:\n    plain_text = f.read()\n\nnote = f\"\"\"---\nsource: 抖音\nurl: {url}\nauthor: {uploader}\ndate: {date}\nduration: {duration}s\ntags: [抖音转录, {uploader}]\n---\n\n# {title}\n\n**来源：** [抖音]({url}) | **作者：** {uploader} | **时长：** {duration}s\n\n---\n\n## 文字稿\n\n{plain_text}\n\"\"\"\n\nwith open('{NOTE_PATH}', 'w', encoding='utf-8') as f:\n    f.write(note)\nPYEOF\n```\n\n### Step 5: 生成 AI 总结\n\n读取 text.txt 和 text_plain.txt，用 AI 生成：\n1. AI 标题（不超过 30 字）\n2. AI 摘要（200-300 字）\n3. 核心要点（3-5 条结构化要点）\n\n同时把 AI 总结追加写入 Obsidian 笔记文件（在文字稿下方追加 `## AI 总结` 和 `### 核心要点` 部分）。\n\n### 完整示例（一镜到底）\n\n```bash\n# 装依赖（首次）\nbrew install yt-dlp ffmpeg 2>/dev/null\npip3 install faster-whisper 2>&1 | tail -3\n\nURL=\"https://www.douyin.com/video/xxxxx\"\nVID=\"xxx\"\nmkdir -p /tmp/douyin_analysis/$VID\ncd /tmp/douyin_analysis/$VID\n\n# 下载\nyt-dlp -o \"video.mp4\" \"$URL\"\n\n# 提取音频\nffmpeg -i video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -y 2>/dev/null\n\n# 转写（双版本）\npython3 << 'PYEOF'\nfrom faster_whisper import WhisperModel\nmodel = WhisperModel('small', device='auto', compute_type='auto')\nsegments, info = model.transcribe('audio.wav', language='zh')\nsegs = [seg for seg in segments]\n\nwith open('text.txt', 'w', encoding='utf-8') as f:\n    for seg in segs:\n        f.write(f'[{seg.start:.1f}s -> {seg.end:.1f}s] {seg.text.strip()}\\n')\n\nplain = '\\n'.join(s.text.strip() for s in segs)\nwith open('text_plain.txt', 'w', encoding='utf-8') as f:\n    f.write(plain)\nPYEOF\n\n# 写入知识库\nVAULT=\"${OBSIDIAN_VAULT_PATH:-$HOME/Documents}\"\nTARGET=\"$VAULT/douyin_text\"\nmkdir -p \"$TARGET\"\ncp text_plain.txt \"$TARGET/video-title.txt\"\n```\n\n## Output\n\n### 临时文件（`/tmp/douyin_analysis/{VIDEO_ID}/`）\n\n| 文件 | 内容 |\n| --- | --- |\n| `video.mp4` | 下载的原视频 |\n| `audio.wav` | 提取的音频（16kHz 单声道） |\n| `text.txt` | **带时间戳**的完整字幕文本 |\n| `text_plain.txt` | **纯文字稿**（无时间戳，连续文本） |\n\n### 知识库文件\n\n| 路径 | 内容 |\n| --- | --- |\n| `$OBSIDIAN_VAULT/douyin_text/{标题}.md` | 含元数据 + 完整文字稿 + AI 总结的笔记 |\n\n## 注意事项\n\n- **首次运行** faster-whisper 会从 HuggingFace 下载模型（small 约 466MB），需要网络连接\n- **Apple Silicon** 上使用 `device='auto'` 会自动用 MPS（Metal）加速，速度很快\n- **Proxy 问题**：如果 yt-dlp 下载失败，检查是否有代理在跑\n- **标题清理**：文件名的特殊字符（`/ : * ? \" < > |`）会自动替换为 `_`\n- **AI 总结**：由 AI 在转写后生成，会追加到 Obsidian 笔记的文字稿下方\n\n## 已知问题\n\n- 长视频（>30分钟）转写时间较长，small 模型大约 1:1 实时\n- Obsidian vault 路径优先从环境变量 `OBSIDIAN_VAULT_PATH` 读取，默认 `~/Documents`\n\nFile v2.0.3:_meta.json\n\n{\n  \"ownerId\": \"kn77499qe4se2kf8tcm3a5nypx8194cw\",\n  \"slug\": \"douyin-video-to-txt\",\n  \"version\": \"2.0.3\",\n  \"publishedAt\": 1781407395129\n}\n\nFile v2.0.3:skill-card.md\n\n## Description:\n\nDownloads Douyin videos, transcribes them with faster-whisper, and saves transcript notes to an Obsidian knowledge base.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[afeicn](https://clawhub.ai/user/afeicn)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and knowledge workers use this skill to turn a Douyin video URL into local transcript files and an Obsidian note with metadata and an AI-generated summary.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The release security summary flags unsafe code templating.\n\nMitigation: Review generated commands before execution and pass video metadata through JSON or command arguments instead of interpolating it into Python code.\n\nRisk: The release security summary flags silent writes to an Obsidian vault.\n\nMitigation: Confirm the destination vault and note path before writing, and avoid overwriting existing notes.\n\nRisk: The release security guidance limits use to trusted videos and metadata.\n\nMitigation: Run the workflow only for Douyin URLs and metadata sources the user trusts.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/afeicn/skills/douyin-video-to-txt)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown guidance with shell and Python code blocks; produced artifacts include transcript text files and an Obsidian Markdown note.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Creates local temporary media and transcript files, then writes a note under the configured Obsidian vault path.]\n\n## Skill Version(s):\n\n2.0.3 (source: server release metadata; artifact frontmatter says 2.0.1)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v2.0.2: 3 files, 4393 bytes\n\nFiles: skill-card.md (2079b), SKILL.md (6541b), _meta.json (138b)\n\nFile v2.0.2:SKILL.md\n\n---\nname: douyin-video-to-txt\ndescription: 抖音视频转文本知识库 — Download Douyin videos, transcribe to text via faster-whisper, save to Obsidian knowledge base.\nargs: <douyin_url> - 抖音视频链接\nversion: 2.0.1\n---\n\n# 抖音视频转文本知识库（douyin-video-to-txt）\n\n下载抖音视频 → 提取音频 → faster-whisper 转写文字 → 输出双版本字幕 → 写入 Obsidian 知识库\n\n纯本地运行，不需要任何外部 API Key。\n\n## Prerequisites\n\n| 工具 | 用途 | 安装 |\n| --- | --- | --- |\n| **yt-dlp** | 下载抖音视频 | `brew install yt-dlp` |\n| **FFmpeg** | 提取音频 | `brew install ffmpeg` |\n| **faster-whisper** | 语音转文字 | `pip3 install faster-whisper` |\n\n环境变量（可选，用于 Obsidian 知识库路径）：\n- `OBSIDIAN_VAULT_PATH` — Obsidian vault 根目录，默认 `~/Documents`\n\n## Workflow\n\n### Step 1: 获取视频信息并下载\n\n```bash\nmkdir -p /tmp/douyin_analysis/{VIDEO_ID}\ncd /tmp/douyin_analysis/{VIDEO_ID}\nyt-dlp --print-json \"{DOUYIN_URL}\" 2>/dev/null | python3 -c \"\nimport json, sys\nd = json.load(sys.stdin)\nprint(f'ID={d[\\\"id\\\"]}')\nprint(f'Title={d[\\\"title\\\"]}')\nprint(f'Duration={d[\\\"duration\\\"]}')\nprint(f'Uploader={d.get(\\\"uploader\\\",\\\"\\\")}')\nprint(f'UploadDate={d.get(\\\"upload_date\\\",\\\"\\\")}')\n\"\nyt-dlp -o \"video.mp4\" \"{DOUYIN_URL}\" 2>/dev/null\n```\n\n### Step 2: 提取音频\n\n```bash\nffmpeg -i video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -y 2>/dev/null\n```\n\n### Step 3: 语音转文字（双版本输出）\n\n```python\nfrom faster_whisper import WhisperModel\n\nmodel = WhisperModel('small', device='auto', compute_type='auto')\nsegments, info = model.transcribe('/tmp/douyin_analysis/{VIDEO_ID}/audio.wav', language='zh')\n\nall_segments = []\nfor seg in segments:\n    all_segments.append(seg)\n\n# 输出 1: 带时间戳版本\nwith open('/tmp/douyin_analysis/{VIDEO_ID}/text.txt', 'w', encoding='utf-8') as f:\n    for seg in all_segments:\n        line = f'[{seg.start:.1f}s -> {seg.end:.1f}s] {seg.text.strip()}'\n        f.write(line + '\\n')\n\n# 输出 2: 纯文字稿（无时间戳）\nplain_lines = []\nfor seg in all_segments:\n    plain_lines.append(seg.text.strip())\nplain_text = '\\n'.join(plain_lines)\n\nwith open('/tmp/douyin_analysis/{VIDEO_ID}/text_plain.txt', 'w', encoding='utf-8') as f:\n    f.write(plain_text)\n```\n\n### Step 4: 写入 Obsidian 知识库\n\n把纯文字稿保存到知识库中合适的目录下。每条视频保存为一个独立的 markdown 文件，格式如下：\n\n```markdown\n---\nsource: 抖音\nurl: {DOUYIN_URL}\nauthor: {UPLOADER}\ndate: {UPLOAD_DATE}\nduration: {DURATION}s\ntags: [抖音转录, {AUTHOR}]\n---\n\n# {TITLE}\n\n**来源：** 抖音 | **作者：** {UPLOADER} | **时长：** {DURATION}s\n\n---\n\n## 文字稿\n\n{PLAIN_TEXT}\n```\n\n知识库路径规则：\n- 优先写入 `$OBSIDIAN_VAULT_PATH/douyin_text/{TITLE_SLUG}.md`\n- 如果 `OBSIDIAN_VAULT_PATH` 未设置，默认 `~/Documents/douyin_text/`\n- 自动创建目录（如果不存在）\n\n```bash\nVAULT=\"${OBSIDIAN_VAULT_PATH:-$HOME/Documents}\"\nTARGET_DIR=\"$VAULT/douyin_text\"\nmkdir -p \"$TARGET_DIR\"\n\n# 用视频标题做文件名（清理特殊字符）\nSAFE_TITLE=$(echo \"$VIDEO_TITLE\" | sed 's/[\\/:*?\"<>|]/_/g' | cut -c1-60)\nNOTE_PATH=\"$TARGET_DIR/${SAFE_TITLE}.md\"\n\npython3 << 'PYEOF'\nimport os\nurl = \"{DOUYIN_URL}\"\ntitle = \"\"\"{TITLE}\"\"\"\nuploader = \"{UPLOADER}\"\ndate = \"{UPLOAD_DATE}\"\nduration = \"{DURATION}\"\n\nwith open('/tmp/douyin_analysis/{VIDEO_ID}/text_plain.txt', 'r', encoding='utf-8') as f:\n    plain_text = f.read()\n\nnote = f\"\"\"---\nsource: 抖音\nurl: {url}\nauthor: {uploader}\ndate: {date}\nduration: {duration}s\ntags: [抖音转录, {uploader}]\n---\n\n# {title}\n\n**来源：** [抖音]({url}) | **作者：** {uploader} | **时长：** {duration}s\n\n---\n\n## 文字稿\n\n{plain_text}\n\"\"\"\n\nwith open('{NOTE_PATH}', 'w', encoding='utf-8') as f:\n    f.write(note)\nPYEOF\n```\n\n### Step 5: 生成 AI 总结\n\n读取 text.txt 和 text_plain.txt，用 AI 生成：\n1. AI 标题（不超过 30 字）\n2. AI 摘要（200-300 字）\n3. 核心要点（3-5 条结构化要点）\n\n同时把 AI 总结追加写入 Obsidian 笔记文件（在文字稿下方追加 `## AI 总结` 和 `### 核心要点` 部分）。\n\n### 完整示例（一镜到底）\n\n```bash\n# 装依赖（首次）\nbrew install yt-dlp ffmpeg 2>/dev/null\npip3 install faster-whisper 2>&1 | tail -3\n\nURL=\"https://www.douyin.com/video/xxxxx\"\nVID=\"xxx\"\nmkdir -p /tmp/douyin_analysis/$VID\ncd /tmp/douyin_analysis/$VID\n\n# 下载\nyt-dlp -o \"video.mp4\" \"$URL\"\n\n# 提取音频\nffmpeg -i video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -y 2>/dev/null\n\n# 转写（双版本）\npython3 << 'PYEOF'\nfrom faster_whisper import WhisperModel\nmodel = WhisperModel('small', device='auto', compute_type='auto')\nsegments, info = model.transcribe('audio.wav', language='zh')\nsegs = [seg for seg in segments]\n\nwith open('text.txt', 'w', encoding='utf-8') as f:\n    for seg in segs:\n        f.write(f'[{seg.start:.1f}s -> {seg.end:.1f}s] {seg.text.strip()}\\n')\n\nplain = '\\n'.join(s.text.strip() for s in segs)\nwith open('text_plain.txt', 'w', encoding='utf-8') as f:\n    f.write(plain)\nPYEOF\n\n# 写入知识库\nVAULT=\"${OBSIDIAN_VAULT_PATH:-$HOME/Documents}\"\nTARGET=\"$VAULT/douyin_text\"\nmkdir -p \"$TARGET\"\ncp text_plain.txt \"$TARGET/video-title.txt\"\n```\n\n## Output\n\n### 临时文件（`/tmp/douyin_analysis/{VIDEO_ID}/`）\n\n| 文件 | 内容 |\n| --- | --- |\n| `video.mp4` | 下载的原视频 |\n| `audio.wav` | 提取的音频（16kHz 单声道） |\n| `text.txt` | **带时间戳**的完整字幕文本 |\n| `text_plain.txt` | **纯文字稿**（无时间戳，连续文本） |\n\n### 知识库文件\n\n| 路径 | 内容 |\n| --- | --- |\n| `$OBSIDIAN_VAULT/douyin_text/{标题}.md` | 含元数据 + 完整文字稿 + AI 总结的笔记 |\n\n## 注意事项\n\n- **首次运行** faster-whisper 会从 HuggingFace 下载模型（small 约 466MB），需要网络连接\n- **Apple Silicon** 上使用 `device='auto'` 会自动用 MPS（Metal）加速，速度很快\n- **Proxy 问题**：如果 yt-dlp 下载失败，检查是否有代理在跑\n- **标题清理**：文件名的特殊字符（`/ : * ? \" < > |`）会自动替换为 `_`\n- **AI 总结**：由 AI 在转写后生成，会追加到 Obsidian 笔记的文字稿下方\n\n## 已知问题\n\n- Docker 网络不通时不要试图用 Docker Whisper ASR 容器，直接本地 faster-whisper 更可靠\n- 长视频（>30分钟）转写时间较长，small 模型大约 1:1 实时\n- Obsidian vault 路径优先从环境变量 `OBSIDIAN_VAULT_PATH` 读取，默认 `~/Documents`\n\nFile v2.0.2:_meta.json\n\n{\n  \"ownerId\": \"kn77499qe4se2kf8tcm3a5nypx8194cw\",\n  \"slug\": \"douyin-video-to-txt\",\n  \"version\": \"2.0.2\",\n  \"publishedAt\": 1781407314181\n}\n\nFile v2.0.2:skill-card.md\n\n## Description: <br>\nDownload Douyin videos, transcribe them locally with faster-whisper, and save transcript notes to an Obsidian knowledge base. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[afeicn](https://clawhub.ai/user/afeicn) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers, researchers, and knowledge-base users use this skill to convert a Douyin video URL into local transcript files and an Obsidian Markdown note with metadata, transcript text, and an AI summary. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill can create or overwrite files in an Obsidian vault or ~/Documents/douyin_text. <br>\nMitigation: Set OBSIDIAN_VAULT_PATH deliberately, review the target note path before writing, and check for existing notes with the same title. <br>\nRisk: Generated transcripts and AI summaries may contain transcription or summarization errors. <br>\nMitigation: Review generated transcripts and summaries before using them as authoritative notes or downstream knowledge-base content. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/afeicn/douyin-video-to-txt) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, Code, Shell commands, Configuration, Guidance] <br>\n**Output Format:** [Markdown guidance with bash and Python code blocks; generated transcript text files and an Obsidian Markdown note.] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Creates temporary video, audio, timestamped transcript, plain transcript, and optional Obsidian note files on the local filesystem.] <br>\n\n## Skill Version(s): <br>\n2.0.2 (source: server release metadata; artifact frontmatter reports 2.0.1) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v2.0.1: 3 files, 4476 bytes\n\nFiles: skill-card.md (2207b), SKILL.md (6543b), _meta.json (138b)\n\nFile v2.0.1:SKILL.md\n\n---\nname: douyin-video-to-txt\ndescription: Download a Douyin video and transcribe its speech to text using local faster-whisper. Outputs timestamped subtitle + plain text, then saves to Obsidian knowledge base.\nargs: <douyin_url> - 抖音视频链接\nversion: 2.0.0\n---\n\n# Douyin Video to Text\n\n下载抖音视频 → 提取音频 → faster-whisper 转写文字 → 输出双版本字幕 → 写入 Obsidian 知识库\n\n纯本地运行，不需要任何外部 API Key。\n\n## Prerequisites\n\n| 工具 | 用途 | 安装 |\n| --- | --- | --- |\n| **yt-dlp** | 下载抖音视频 | `brew install yt-dlp` |\n| **FFmpeg** | 提取音频 | `brew install ffmpeg` |\n| **faster-whisper** | 语音转文字 | `pip3 install faster-whisper` |\n\n环境变量（可选，用于 Obsidian 知识库路径）：\n- `OBSIDIAN_VAULT_PATH` — Obsidian vault 根目录，默认 `~/Documents`\n\n## Workflow\n\n### Step 1: 获取视频信息并下载\n\n```bash\nmkdir -p /tmp/douyin_analysis/{VIDEO_ID}\ncd /tmp/douyin_analysis/{VIDEO_ID}\nyt-dlp --print-json \"{DOUYIN_URL}\" 2>/dev/null | python3 -c \"\nimport json, sys\nd = json.load(sys.stdin)\nprint(f'ID={d[\\\"id\\\"]}')\nprint(f'Title={d[\\\"title\\\"]}')\nprint(f'Duration={d[\\\"duration\\\"]}')\nprint(f'Uploader={d.get(\\\"uploader\\\",\\\"\\\")}')\nprint(f'UploadDate={d.get(\\\"upload_date\\\",\\\"\\\")}')\n\"\nyt-dlp -o \"video.mp4\" \"{DOUYIN_URL}\" 2>/dev/null\n```\n\n### Step 2: 提取音频\n\n```bash\nffmpeg -i video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -y 2>/dev/null\n```\n\n### Step 3: 语音转文字（双版本输出）\n\n```python\nfrom faster_whisper import WhisperModel\n\nmodel = WhisperModel('small', device='auto', compute_type='auto')\nsegments, info = model.transcribe('/tmp/douyin_analysis/{VIDEO_ID}/audio.wav', language='zh')\n\nall_segments = []\nfor seg in segments:\n    all_segments.append(seg)\n\n# 输出 1: 带时间戳版本\nwith open('/tmp/douyin_analysis/{VIDEO_ID}/text.txt', 'w', encoding='utf-8') as f:\n    for seg in all_segments:\n        line = f'[{seg.start:.1f}s -> {seg.end:.1f}s] {seg.text.strip()}'\n        f.write(line + '\\n')\n\n# 输出 2: 纯文字稿（无时间戳）\nplain_lines = []\nfor seg in all_segments:\n    plain_lines.append(seg.text.strip())\nplain_text = '\\n'.join(plain_lines)\n\nwith open('/tmp/douyin_analysis/{VIDEO_ID}/text_plain.txt', 'w', encoding='utf-8') as f:\n    f.write(plain_text)\n```\n\n### Step 4: 写入 Obsidian 知识库\n\n把纯文字稿保存到知识库中合适的目录下。每条视频保存为一个独立的 markdown 文件，格式如下：\n\n```markdown\n---\nsource: 抖音\nurl: {DOUYIN_URL}\nauthor: {UPLOADER}\ndate: {UPLOAD_DATE}\nduration: {DURATION}s\ntags: [抖音转录, {AUTHOR}]\n---\n\n# {TITLE}\n\n**来源：** 抖音 | **作者：** {UPLOADER} | **时长：** {DURATION}s\n\n---\n\n## 文字稿\n\n{PLAIN_TEXT}\n```\n\n知识库路径规则：\n- 优先写入 `$OBSIDIAN_VAULT_PATH/douyin_text/{TITLE_SLUG}.md`\n- 如果 `OBSIDIAN_VAULT_PATH` 未设置，默认 `~/Documents/douyin_text/`\n- 自动创建目录（如果不存在）\n\n```bash\nVAULT=\"${OBSIDIAN_VAULT_PATH:-$HOME/Documents}\"\nTARGET_DIR=\"$VAULT/douyin_text\"\nmkdir -p \"$TARGET_DIR\"\n\n# 用视频标题做文件名（清理特殊字符）\nSAFE_TITLE=$(echo \"$VIDEO_TITLE\" | sed 's/[\\/:*?\"<>|]/_/g' | cut -c1-60)\nNOTE_PATH=\"$TARGET_DIR/${SAFE_TITLE}.md\"\n\npython3 << 'PYEOF'\nimport os\nurl = \"{DOUYIN_URL}\"\ntitle = \"\"\"{TITLE}\"\"\"\nuploader = \"{UPLOADER}\"\ndate = \"{UPLOAD_DATE}\"\nduration = \"{DURATION}\"\n\nwith open('/tmp/douyin_analysis/{VIDEO_ID}/text_plain.txt', 'r', encoding='utf-8') as f:\n    plain_text = f.read()\n\nnote = f\"\"\"---\nsource: 抖音\nurl: {url}\nauthor: {uploader}\ndate: {date}\nduration: {duration}s\ntags: [抖音转录, {uploader}]\n---\n\n# {title}\n\n**来源：** [抖音]({url}) | **作者：** {uploader} | **时长：** {duration}s\n\n---\n\n## 文字稿\n\n{plain_text}\n\"\"\"\n\nwith open('{NOTE_PATH}', 'w', encoding='utf-8') as f:\n    f.write(note)\nPYEOF\n```\n\n### Step 5: 生成 AI 总结\n\n读取 text.txt 和 text_plain.txt，用 AI 生成：\n1. AI 标题（不超过 30 字）\n2. AI 摘要（200-300 字）\n3. 核心要点（3-5 条结构化要点）\n\n同时把 AI 总结追加写入 Obsidian 笔记文件（在文字稿下方追加 `## AI 总结` 和 `### 核心要点` 部分）。\n\n### 完整示例（一镜到底）\n\n```bash\n# 装依赖（首次）\nbrew install yt-dlp ffmpeg 2>/dev/null\npip3 install faster-whisper 2>&1 | tail -3\n\nURL=\"https://www.douyin.com/video/xxxxx\"\nVID=\"xxx\"\nmkdir -p /tmp/douyin_analysis/$VID\ncd /tmp/douyin_analysis/$VID\n\n# 下载\nyt-dlp -o \"video.mp4\" \"$URL\"\n\n# 提取音频\nffmpeg -i video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -y 2>/dev/null\n\n# 转写（双版本）\npython3 << 'PYEOF'\nfrom faster_whisper import WhisperModel\nmodel = WhisperModel('small', device='auto', compute_type='auto')\nsegments, info = model.transcribe('audio.wav', language='zh')\nsegs = [seg for seg in segments]\n\nwith open('text.txt', 'w', encoding='utf-8') as f:\n    for seg in segs:\n        f.write(f'[{seg.start:.1f}s -> {seg.end:.1f}s] {seg.text.strip()}\\n')\n\nplain = '\\n'.join(s.text.strip() for s in segs)\nwith open('text_plain.txt', 'w', encoding='utf-8') as f:\n    f.write(plain)\nPYEOF\n\n# 写入知识库\nVAULT=\"${OBSIDIAN_VAULT_PATH:-$HOME/Documents}\"\nTARGET=\"$VAULT/douyin_text\"\nmkdir -p \"$TARGET\"\ncp text_plain.txt \"$TARGET/video-title.txt\"\n```\n\n## Output\n\n### 临时文件（`/tmp/douyin_analysis/{VIDEO_ID}/`）\n\n| 文件 | 内容 |\n| --- | --- |\n| `video.mp4` | 下载的原视频 |\n| `audio.wav` | 提取的音频（16kHz 单声道） |\n| `text.txt` | **带时间戳**的完整字幕文本 |\n| `text_plain.txt` | **纯文字稿**（无时间戳，连续文本） |\n\n### 知识库文件\n\n| 路径 | 内容 |\n| --- | --- |\n| `$OBSIDIAN_VAULT/douyin_text/{标题}.md` | 含元数据 + 完整文字稿 + AI 总结的笔记 |\n\n## 注意事项\n\n- **首次运行** faster-whisper 会从 HuggingFace 下载模型（small 约 466MB），需要网络连接\n- **Apple Silicon** 上使用 `device='auto'` 会自动用 MPS（Metal）加速，速度很快\n- **Proxy 问题**：如果 yt-dlp 下载失败，检查是否有代理在跑\n- **标题清理**：文件名的特殊字符（`/ : * ? \" < > |`）会自动替换为 `_`\n- **AI 总结**：由 AI 在转写后生成，会追加到 Obsidian 笔记的文字稿下方\n\n## 已知问题\n\n- Docker 网络不通时不要试图用 Docker Whisper ASR 容器，直接本地 faster-whisper 更可靠\n- 长视频（>30分钟）转写时间较长，small 模型大约 1:1 实时\n- Obsidian vault 路径优先从环境变量 `OBSIDIAN_VAULT_PATH` 读取，默认 `~/Documents`\n\nFile v2.0.1:_meta.json\n\n{\n  \"ownerId\": \"kn77499qe4se2kf8tcm3a5nypx8194cw\",\n  \"slug\": \"douyin-video-to-txt\",\n  \"version\": \"2.0.1\",\n  \"publishedAt\": 1781407268891\n}\n\nFile v2.0.1:skill-card.md\n\n## Description: <br>\nDownload a Douyin video and transcribe its speech to text using local faster-whisper, producing timestamped subtitles, plain text, and an Obsidian knowledge-base note. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[afeicn](https://clawhub.ai/user/afeicn) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and knowledge workers use this skill to turn Douyin video speech into local transcript files and Obsidian notes. It is useful when a user wants timestamped subtitles, a plain transcript, and an AI summary workflow without using an external transcription API. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Downloaded media and generated transcripts may contain private or consent-sensitive content and are stored locally. <br>\nMitigation: Use the skill only for content you are allowed to process, set OBSIDIAN_VAULT_PATH to a controlled location, and avoid private or consent-sensitive videos unless appropriate. <br>\nRisk: Temporary media, audio, and transcript files can remain under /tmp/douyin_analysis after execution. <br>\nMitigation: Delete /tmp/douyin_analysis entries after use when retained media or transcripts are not needed. <br>\n\n\n## Reference(s): <br>\n- [ClawHub release page](https://clawhub.ai/afeicn/douyin-video-to-txt) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance] <br>\n**Output Format:** [Markdown guidance with bash and Python code blocks, plus generated local text and Markdown files] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Creates local temporary media, audio, timestamped transcript, plain transcript, and an Obsidian note when executed.] <br>\n\n## Skill Version(s): <br>\n2.0.1 (source: server release metadata; artifact frontmatter says 2.0.0) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v2.0.0: 3 files, 4359 bytes\n\nFiles: skill-card.md (1852b), SKILL.md (6618b), _meta.json (138b)\n\nFile v2.0.0:SKILL.md\n\n---\nname: douyin-video-to-txt\ndescription: Download a Douyin video and transcribe its speech to text using local faster-whisper. Outputs timestamped subtitle + plain text, then saves to Obsidian knowledge base.\nargs: <douyin_url> - 抖音视频链接\nversion: 2.0.0\n---\n\n# Douyin Video to Text\n\n下载抖音视频 → 提取音频 → faster-whisper 转写文字 → 输出双版本字幕 → 写入 Obsidian 知识库\n\n纯本地运行，不需要任何外部 API Key。\n\n## Prerequisites\n\n| 工具 | 用途 | 安装 |\n| --- | --- | --- |\n| **yt-dlp** | 下载抖音视频 | `brew install yt-dlp` |\n| **FFmpeg** | 提取音频 | `brew install ffmpeg` |\n| **faster-whisper** | 语音转文字 | `pip3 install faster-whisper` |\n\n环境变量（可选，用于 Obsidian 知识库路径）：\n- `OBSIDIAN_VAULT_PATH` — Obsidian vault 根目录，默认 `~/Documents`\n\n## Workflow\n\n### Step 1: 获取视频信息并下载\n\n```bash\nmkdir -p /tmp/douyin_analysis/{VIDEO_ID}\ncd /tmp/douyin_analysis/{VIDEO_ID}\nyt-dlp --print-json \"{DOUYIN_URL}\" 2>/dev/null | python3 -c \"\nimport json, sys\nd = json.load(sys.stdin)\nprint(f'ID={d[\\\"id\\\"]}')\nprint(f'Title={d[\\\"title\\\"]}')\nprint(f'Duration={d[\\\"duration\\\"]}')\nprint(f'Uploader={d.get(\\\"uploader\\\",\\\"\\\")}')\nprint(f'UploadDate={d.get(\\\"upload_date\\\",\\\"\\\")}')\n\"\nyt-dlp -o \"video.mp4\" \"{DOUYIN_URL}\" 2>/dev/null\n```\n\n### Step 2: 提取音频\n\n```bash\nffmpeg -i video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -y 2>/dev/null\n```\n\n### Step 3: 语音转文字（双版本输出）\n\n```python\nfrom faster_whisper import WhisperModel\n\nmodel = WhisperModel('small', device='auto', compute_type='auto')\nsegments, info = model.transcribe('/tmp/douyin_analysis/{VIDEO_ID}/audio.wav', language='zh')\n\nall_segments = []\nfor seg in segments:\n    all_segments.append(seg)\n\n# 输出 1: 带时间戳版本\nwith open('/tmp/douyin_analysis/{VIDEO_ID}/text.txt', 'w', encoding='utf-8') as f:\n    for seg in all_segments:\n        line = f'[{seg.start:.1f}s -> {seg.end:.1f}s] {seg.text.strip()}'\n        f.write(line + '\\n')\n\n# 输出 2: 纯文字稿（无时间戳）\nplain_lines = []\nfor seg in all_segments:\n    plain_lines.append(seg.text.strip())\nplain_text = '\\n'.join(plain_lines)\n\nwith open('/tmp/douyin_analysis/{VIDEO_ID}/text_plain.txt', 'w', encoding='utf-8') as f:\n    f.write(plain_text)\n```\n\n### Step 4: 写入 Obsidian 知识库\n\n把纯文字稿保存到知识库中合适的目录下。每条视频保存为一个独立的 markdown 文件，格式如下：\n\n```markdown\n---\nsource: 抖音\nurl: {DOUYIN_URL}\nauthor: {UPLOADER}\ndate: {UPLOAD_DATE}\nduration: {DURATION}s\ntags: [抖音转录, {AUTHOR}]\n---\n\n# {TITLE}\n\n**来源：** 抖音 | **作者：** {UPLOADER} | **时长：** {DURATION}s\n\n---\n\n## 文字稿\n\n{PLAIN_TEXT}\n```\n\n知识库路径规则：\n- 优先写入 `$OBSIDIAN_VAULT_PATH/61飞哥说AI/抖音转录/{TITLE_SLUG}.md`\n- 如果 `OBSIDIAN_VAULT_PATH` 未设置，默认 `~/Documents/61飞哥说AI/抖音转录/`\n- 自动创建目录（如果不存在）\n\n```bash\nVAULT=\"${OBSIDIAN_VAULT_PATH:-$HOME/Documents}\"\nTARGET_DIR=\"$VAULT/61飞哥说AI/抖音转录\"\nmkdir -p \"$TARGET_DIR\"\n\n# 用视频标题做文件名（清理特殊字符）\nSAFE_TITLE=$(echo \"$VIDEO_TITLE\" | sed 's/[\\/:*?\"<>|]/_/g' | cut -c1-60)\nNOTE_PATH=\"$TARGET_DIR/${SAFE_TITLE}.md\"\n\npython3 << 'PYEOF'\nimport os\nurl = \"{DOUYIN_URL}\"\ntitle = \"\"\"{TITLE}\"\"\"\nuploader = \"{UPLOADER}\"\ndate = \"{UPLOAD_DATE}\"\nduration = \"{DURATION}\"\n\nwith open('/tmp/douyin_analysis/{VIDEO_ID}/text_plain.txt', 'r', encoding='utf-8') as f:\n    plain_text = f.read()\n\nnote = f\"\"\"---\nsource: 抖音\nurl: {url}\nauthor: {uploader}\ndate: {date}\nduration: {duration}s\ntags: [抖音转录, {uploader}]\n---\n\n# {title}\n\n**来源：** [抖音]({url}) | **作者：** {uploader} | **时长：** {duration}s\n\n---\n\n## 文字稿\n\n{plain_text}\n\"\"\"\n\nwith open('{NOTE_PATH}', 'w', encoding='utf-8') as f:\n    f.write(note)\nPYEOF\n```\n\n### Step 5: 生成 AI 总结\n\n读取 text.txt 和 text_plain.txt，用 AI 生成：\n1. AI 标题（不超过 30 字）\n2. AI 摘要（200-300 字）\n3. 核心要点（3-5 条结构化要点）\n\n同时把 AI 总结追加写入 Obsidian 笔记文件（在文字稿下方追加 `## AI 总结` 和 `### 核心要点` 部分）。\n\n### 完整示例（一镜到底）\n\n```bash\n# 装依赖（首次）\nbrew install yt-dlp ffmpeg 2>/dev/null\npip3 install faster-whisper 2>&1 | tail -3\n\nURL=\"https://www.douyin.com/video/xxxxx\"\nVID=\"xxx\"\nmkdir -p /tmp/douyin_analysis/$VID\ncd /tmp/douyin_analysis/$VID\n\n# 下载\nyt-dlp -o \"video.mp4\" \"$URL\"\n\n# 提取音频\nffmpeg -i video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -y 2>/dev/null\n\n# 转写（双版本）\npython3 << 'PYEOF'\nfrom faster_whisper import WhisperModel\nmodel = WhisperModel('small', device='auto', compute_type='auto')\nsegments, info = model.transcribe('audio.wav', language='zh')\nsegs = [seg for seg in segments]\n\nwith open('text.txt', 'w', encoding='utf-8') as f:\n    for seg in segs:\n        f.write(f'[{seg.start:.1f}s -> {seg.end:.1f}s] {seg.text.strip()}\\n')\n\nplain = '\\n'.join(s.text.strip() for s in segs)\nwith open('text_plain.txt', 'w', encoding='utf-8') as f:\n    f.write(plain)\nPYEOF\n\n# 写入知识库\nVAULT=\"${OBSIDIAN_VAULT_PATH:-$HOME/Documents}\"\nTARGET=\"$VAULT/61飞哥说AI/抖音转录\"\nmkdir -p \"$TARGET\"\ncp text_plain.txt \"$TARGET/video-title.txt\"\n```\n\n## Output\n\n### 临时文件（`/tmp/douyin_analysis/{VIDEO_ID}/`）\n\n| 文件 | 内容 |\n| --- | --- |\n| `video.mp4` | 下载的原视频 |\n| `audio.wav` | 提取的音频（16kHz 单声道） |\n| `text.txt` | **带时间戳**的完整字幕文本 |\n| `text_plain.txt` | **纯文字稿**（无时间戳，连续文本） |\n\n### 知识库文件\n\n| 路径 | 内容 |\n| --- | --- |\n| `$OBSIDIAN_VAULT/61飞哥说AI/抖音转录/{标题}.md` | 含元数据 + 完整文字稿 + AI 总结的笔记 |\n\n## 注意事项\n\n- **首次运行** faster-whisper 会从 HuggingFace 下载模型（small 约 466MB），需要网络连接\n- **Apple Silicon** 上使用 `device='auto'` 会自动用 MPS（Metal）加速，速度很快\n- **Proxy 问题**：如果 yt-dlp 下载失败，检查是否有代理在跑\n- **标题清理**：文件名的特殊字符（`/ : * ? \" < > |`）会自动替换为 `_`\n- **AI 总结**：由 AI 在转写后生成，会追加到 Obsidian 笔记的文字稿下方\n\n## 已知问题\n\n- Docker 网络不通时不要试图用 Docker Whisper ASR 容器，直接本地 faster-whisper 更可靠\n- 长视频（>30分钟）转写时间较长，small 模型大约 1:1 实时\n- Obsidian vault 路径优先从环境变量 `OBSIDIAN_VAULT_PATH` 读取，默认 `~/Documents`\n\nFile v2.0.0:_meta.json\n\n{\n  \"ownerId\": \"kn77499qe4se2kf8tcm3a5nypx8194cw\",\n  \"slug\": \"douyin-video-to-txt\",\n  \"version\": \"2.0.0\",\n  \"publishedAt\": 1781407060532\n}\n\nFile v2.0.0:skill-card.md\n\n## Description: <br>\nDownload a Douyin video and transcribe its speech to text using local faster-whisper, producing timestamped subtitles, plain text, and an Obsidian knowledge-base note. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[afeicn](https://clawhub.ai/user/afeicn) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and knowledge workers use this skill to turn Douyin video speech into local transcript files and Obsidian notes for later review, search, and summarization. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill writes generated notes into an Obsidian vault path, and duplicate or ambiguous video titles can overwrite or append to the wrong note. <br>\nMitigation: Set OBSIDIAN_VAULT_PATH to the intended vault, review the target folder, and avoid ambiguous video titles unless overwriting or appending is acceptable. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/afeicn/douyin-video-to-txt) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, Shell commands, Configuration] <br>\n**Output Format:** [Markdown guidance with shell and Python command blocks; generated transcript outputs are text and Markdown files] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Creates local video, audio, timestamped transcript, plain-text transcript, and Obsidian note files.] <br>\n\n## Skill Version(s): <br>\n2.0.0 (source: frontmatter and server release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.0.0: 3 files, 3383 bytes\n\nFiles: skill-card.md (1870b), SKILL.md (3785b), _meta.json (138b)\n\nFile v1.0.0:SKILL.md\n\n---\nname: douyin-video-to-txt\ndescription: Download a Douyin video and transcribe its speech to text using local faster-whisper. No API keys needed — fully local pipeline via yt-dlp + ffmpeg + faster-whisper.\nargs: <douyin_url> - 抖音视频链接\nversion: 1.0.0\n---\n\n# Douyin Video to Text\n\n下载抖音视频 → 提取音频 → faster-whisper 转写文字 → 输出完整字幕\n\n纯本地运行，不需要任何外部 API Key。\n\n## Prerequisites\n\n| 工具 | 用途 | 安装 |\n| --- | --- | --- |\n| **yt-dlp** | 下载抖音视频 | `brew install yt-dlp` |\n| **FFmpeg** | 提取音频 | `brew install ffmpeg` |\n| **faster-whisper** | 语音转文字 | `pip3 install faster-whisper` |\n\n## Workflow\n\n### Step 1: 获取视频信息并下载\n\n```bash\nmkdir -p /tmp/douyin_analysis\nyt-dlp --print-json \"{DOUYIN_URL}\" 2>&1\n```\n\n从输出中提取关键信息：\n- `id` — 视频 ID \n- `title` — 标题\n- `duration` — 时长（秒）\n- `uploader` — 发布者\n- `like_count`, `comment_count` 等互动数据\n\nyt-dlp 会自动选择最佳格式下载视频。\n\n### Step 2: 提取音频\n\n```bash\nffmpeg -i \"{VIDEO_PATH}\" -ar 16000 -ac 1 -c:a pcm_s16le /tmp/douyin_analysis/{VIDEO_ID}/audio.wav -y\n```\n\n参数说明：\n- `-ar 16000`: 16kHz 采样率（faster-whisper 推荐）\n- `-ac 1`: 单声道\n- `-c:a pcm_s16le`: 16-bit PCM WAV\n\n### Step 3: 语音转文字\n\n```python\nfrom faster_whisper import WhisperModel\n\nmodel = WhisperModel('small', device='auto', compute_type='auto')\nsegments, info = model.transcribe('/tmp/douyin_analysis/{VIDEO_ID}/audio.wav', language='zh')\n\nwith open('/tmp/douyin_analysis/{VIDEO_ID}/text.txt', 'w', encoding='utf-8') as f:\n    for seg in segments:\n        line = f'[{seg.start:.1f}s -> {seg.end:.1f}s] {seg.text.strip()}'\n        f.write(line + '\\n')\n```\n\n使用 `small` 模型（约 466MB，首次运行自动下载），在 Apple Silicon 上速度很快。\n\n### Step 4: 生成 AI 总结\n\n读取 text.txt，用 AI 生成：\n1. AI 标题（不超过 30 字）\n2. AI 摘要（200-300 字）\n3. 核心要点（3-5 条结构化要点）\n\n### 完整示例（一镜到底）\n\n```bash\n# 装依赖（首次）\nbrew install yt-dlp ffmpeg 2>/dev/null\npip3 install faster-whisper 2>&1 | tail -3\n\n# 下载\nURL=\"https://www.douyin.com/video/xxxxx\"\nmkdir -p /tmp/douyin_analysis\ncd /tmp/douyin_analysis\nyt-dlp \"$URL\"\n# => 自动下载到当前目录\n\n# 提取音频\nVIDEO=$(ls *.mp4 | head -1)\nffmpeg -i \"$VIDEO\" -ar 16000 -ac 1 -c:a pcm_s16le audio.wav -y 2>/dev/null\n\n# 转写\npython3 -c \"\nfrom faster_whisper import WhisperModel\nmodel = WhisperModel('small', device='auto', compute_type='auto')\nsegments, info = model.transcribe('audio.wav', language='zh')\nwith open('text.txt', 'w', encoding='utf-8') as f:\n    for seg in segments:\n        line = f'[{seg.start:.1f}s -> {seg.end:.1f}s] {seg.text.strip()}'\n        print(line)\n        f.write(line + '\\n')\n\"\n```\n\n## Output\n\n保存在 `/tmp/douyin_analysis/{VIDEO_ID}/` 目录下：\n\n| 文件 | 内容 |\n| --- | --- |\n| `{title}.mp4` | 下载的原视频 |\n| `audio.wav` | 提取的音频（16kHz 单声道） |\n| `text.txt` | 带时间戳的完整字幕文本 |\n\n## 注意事项\n\n- **首次运行** faster-whisper 会从 HuggingFace 下载模型（small 约 466MB），需要网络连接\n- **Apple Silicon** 上使用 `device='auto'` 会自动用 MPS（Metal）加速，速度很快\n- **Proxy 问题**：如果 yt-dlp 下载失败，检查是否有代理在跑，yt-dlp 默认不走系统代理\n- **不支持**：仅限抖音视频，其他平台可能不兼容。YouTube/B站等有其他适配方案\n\n## 已知问题\n\n- Docker 网络不通时，不要试图用 Docker Whisper ASR 容器，直接本地 faster-whisper 更可靠\n- 长视频（>30分钟）转写时间较长，small 模型大约 1:1 实时\n\nFile v1.0.0:_meta.json\n\n{\n  \"ownerId\": \"kn77499qe4se2kf8tcm3a5nypx8194cw\",\n  \"slug\": \"douyin-video-to-txt\",\n  \"version\": \"1.0.0\",\n  \"publishedAt\": 1781406943253\n}\n\nFile v1.0.0:skill-card.md\n\n## Description: <br>\nDownload a Douyin video and transcribe its speech to text using local faster-whisper with a local yt-dlp, ffmpeg, and faster-whisper pipeline. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[afeicn](https://clawhub.ai/user/afeicn) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and content analysts use this skill to download a Douyin video URL, extract audio locally, transcribe Chinese speech with faster-whisper, and optionally summarize the transcript. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The server security review marked this release suspicious and calls for maintainer-level caution before granting local authority. <br>\nMitigation: Install only in a trusted maintainer environment and review the skill before use. <br>\nRisk: The workflow downloads external media and a transcription model, then runs local shell and Python commands. <br>\nMitigation: Use trusted dependency sources, verify the Douyin URL, and run the workflow in an isolated workspace. <br>\n\n\n## Reference(s): <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Shell commands, Code, Guidance, Text] <br>\n**Output Format:** [Markdown with bash and Python code blocks] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May produce local video, audio, and timestamped transcript files under /tmp/douyin_analysis when the commands are executed.] <br>\n\n## Skill Version(s): <br>\n1.0.0 (source: frontmatter and server release metadata) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>","readmeExcerpt":"Skill: Douyin Video To Txt Owner: afeicn Summary: 抖音视频转文本知识库 — Download Douyin videos, transcribe to text via faster-whisper, save to Obsidian knowledge base. Tags: latest:2.0.3 Version history: v1.0.1 | 2026-07-10T06:25:30.731Z | user 更新：完善段落整理规则、补充whisper常见误识别表、优化长视频处理说明 v2.0.3 | 2026-06-14T03:23:15.129Z | user 清理：移除 Docker 相关描述（已不再依赖 Docker） v2.0.2 | 2026-06-14T03:21:54.181Z | user 名称改为中文：抖音视频转文本知识库 v2.0.1 | 2026-","codeSnippets":[],"executableExamples":[{"language":"text","snippet":"[Phase 1 — transcribe.py]"},{"language":"text","snippet":"## 前置依赖\n\n| 工具 | 状态 |\n|------|------|\n| ffmpeg | ✅ 已装 |\n| yt-dlp | ✅ 已装（⚠️ Douyin extractor 可能因反爬升级失效） |\n| faster-whisper (Python) | ✅ 已装 (model: base) |\n\n## 备用方案：第三方下载服务（当 yt-dlp Douyin extractor 失效时）\n\n当 yt-dlp 持续报 \"Fresh cookies are needed\" 且更新后仍无效时，使用第三方抖音下载器代替 yt-dlp 下载音频。\n\n### 推荐服务\n\n| 服务 | 网址 | 成功率 | 说明 |\n|------|------|--------|------|\n| SaveTik | https://en.savetik.co/ | ⭐⭐⭐ | 可直接下载 MP3，部分视频可能找不到 |\n| Seekin.ai | https://www.seekin.ai/douyin-downloader/ | ⭐⭐⭐⭐ | 支持多分辨率（540p~8K），下载链接需在浏览器中捕获 |\n\n### 浏览器工作流\n\n1. **导航到下载服务网站**：用 browser_navigate 打开上述服务\n2. **粘贴抖音链接**：将抖音短链接粘贴到输入框（browser_type）\n3. **提交获取结果**：点击 Download Now / Get 按钮\n4. **捕获下载链接**：\n   - 如果服务直接提供 MP3 下载（SaveTik），用终端 curl/wget 下载\n   - 如果服务提供多分辨率选项（Seekin），**点击 Download 按钮后浏览器可能直接导航到原始 MP4 文件 URL**（URL 以 `v13-default.365yg.com/...video...mp4?` 等格式出现）。直接在当前页用 `curl -L -o /tmp/video.mp4 \"<current_url>\"` 下载，然后 `browser_back()` 回下载页\n   - 尝试通过浏览器控制台拦截 API 响应或检查 DOM 中的下载链接\n5. **手动下载（兜底）**：如果浏览器无法捕获下载链接，告诉用户去哪个服务手动下载，获取文件路径后再进行 Whisper 转写\n\n> 详情见 `references/douyin-downloader-workarounds.md`\n\n### 浏览器工作流常见坑（browser_click 对 Vue/React 按钮无效）\n\n当使用 Seekin.ai 等 SPA 网站下载时，`browser_click()` 经常无法触发按钮事件。这是因为这类网站的按钮用框架事件绑定而不是原生 DOM 事件。如果点击后页面无变化：\n\n1. **不要重复点** — 按钮可能已触发但 `browser_snapshot()` 感知不到变化\n2. 改用 `browser_console()` 执行 JS："},{"language":"text","snippet":"3. 触发后浏览器可能直接导航到视频 CDN 链接，立即用 `browser_console(expression='window.location.href')` 捕获 URL\n4. 然后用 `curl -L` 下载，再用 `browser_navigate()` 回到下载页\n\n详情见 `references/douyin-downloader-workarounds.md` 方案 B。\n\n### 手动转写已下载的音频文件\n\n如果通过第三方服务获得了 MP3/MP4 文件，可以直接用 faster-whisper 手动转写："},{"language":"text","snippet":"然后将输出文本按 Phase 2 流程（段落整理 + AI 总结）生成最终笔记。\n\n## 使用方法\n\n### 在对话中\n直接发抖音链接，比如："},{"language":"text","snippet":"或者直接丢链接。Agent 自动跑完整两阶段流程。\n\n### 手动运行脚本"},{"language":"text","snippet":"## 输出文件\n\n保存到 `$OBSIDIAN_VAULT_PATH/douyin_text/`。\n\n每次转写生成两个文件：\n\n| 文件 | 说明 |\n|------|------|\n| `2026-06-14_标题.md` | 最终笔记：AI总结 + 段落式完整文案 |\n| `2026-06-14_标题.data.json` | 中间数据（Agent 处理后不再需要） |\n\n### 笔记格式"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: douyin-video-to-txt\ndescription: 抖音视频转文字 - 粘贴抖音链接，自动下载音频、Whisper转写、AI摘要，保存到 Obsidian Vault\ntags: [douyin, transcription, obsidian, video-to-text]\n---\n\n# 抖音视频转文字 (douyin-video-to-txt)\n\n**一句话**：把抖音链接丢过来，自动转成整理好的文字稿+AI总结，存到 Obsidian。\n\n## 工作流程（两阶段）\n\n### 关键规则（重要，容易踩坑）\n\n#### 段落整理（必须做，不是简单去时间戳）\n原始转写输出的是一句一行的碎片文本。**必须由 Agent 整理成自然段落**：\n1. 相邻短句按语义合并成段落\n2. 话题切换处分段（如\"第一层\"\"第二层\"等层级标记）\n3. 每段是完整通顺的中文段落，有逗号句号\n4. 专业术语保留原样\n5. 去掉 Whisper 产生的重复/断裂\n\n#### AI 总结（必须做，不是取前几句）\n- 基于全文理解，提炼核心论点\n- 结构化呈现（如分层级、分要点）\n- 用自然语言，不要\"本文介绍了\"\"作者认为\"这类废话\n- 长度 150-300 字，提炼精华不是复述细节\n\n#### 错误案例（之前踩过的坑）\n❌ 转写完成后只保存了带时间戳的原始文本\n❌ \"摘要\" = 取前 5 句拼接\n❌ 完整文案 = 一句一行，没有段落\n✅ 正确做法：AI 总结 + 段落式完整文案\n\n```\n[Phase 1 — transcribe.py]\n\n```\n[Phase 1 — transcribe.py]\n用户发抖音链接\n  │\n  ▼ yt-dlp 下载音频\n  │\n  ▼ faster-whisper 转写\n  │\n  ▼ 保存两样东西:\n     ├── 原始笔记 .md（纯文本、句句分行、无时间戳）\n     └── 数据文件 .data.json（带 segments 详情，供 Agent 处理）\n\n[Phase 2 — Hermes Agent]\n  │\n  ▼ 读取原始文本\n  │\n  ▼ 整理成自然段落\n     - 相近句子合并成一段\n     - 按话题切换分段（如\"第一层\"、\"第二层\"等）\n     - 中文语境下，短句合并为通顺的段落\n  │\n  ▼ 生成 AI 总结（基于全文理解，非简单截取）\n  │\n  ▼ 更新 Obsidian 笔记：\n     标题 + metadata\n     → AI 总结\n     → 完整文案（段落式）\n```\n\n## 前置依赖\n\n| 工具 | 状态 |\n|------|------|\n| ffmpeg | ✅ 已装 |\n| yt-dlp | ✅ 已装（⚠️ Douyin extractor 可能因反爬升级失效） |\n| faster-whisper (Python) | ✅ 已装 (model: base) |\n\n## 备用方案：第三方下载服务（当 yt-dlp Douyin extractor 失效时）\n\n当 yt-dlp 持续报 \"Fresh cookies are needed\" 且更新后仍无效时，使用第三方抖音下载器代替 yt-dlp 下载音频。\n\n### 推荐服务\n\n| 服务 | 网址 | 成功率 | 说明 |\n|------|------|--------|------|\n| SaveTik | https://en.savetik.co/ | ⭐⭐⭐ | 可直接下载 MP3，部分视频可能找不到 |\n| Seekin.ai | https://www.seekin.ai/douyin-downloader/ | ⭐⭐⭐⭐ | 支持多分辨率（540p~8K），下载链接需在浏览器中捕获 |\n\n### 浏览器工作流\n\n1. **导航到下载服务网站**：用 browser_navigate 打开上述服务\n2. **粘贴抖音链接**：将抖音短链接粘贴到输入框（browser_type）\n3. **提交获取结果**：点击 Download Now / Get 按钮\n4. **捕获下载链接**：\n   - 如果服务直接提供 MP3 下载（SaveTik），用终端 curl/wget 下载\n   - 如果服务提供多分辨率选项（Seekin），**点击 Download 按钮后浏览器可能直接导航到原始 MP4 文件 URL**（URL 以 `v13-default.365yg.com/...video...mp4?` 等格式出现）。直接在当前页用 `curl -L -o /tmp/video.mp4 \"<current_url>\"` 下载，然后 `browser_back()` 回下载页\n   - 尝试通过浏览器控制台拦截 API 响应或检查 DOM 中的下载链接\n5. **手动下载（兜底）**：如果浏览器无法捕获下载链接，告诉用户去哪个服务手动下载，获取文件路径后再进行 Whisper 转写\n\n> 详情见 `references/douyin-downloader-workarounds.md`\n\n### 浏览器工作流常见坑（browser_click 对 Vue/React 按钮无效）\n\n当使用 Seekin.ai 等 SPA 网站下载时，`browser_click()` 经常无法触发按钮事件。这是因为这类网站的按钮用框架事件绑定而不是原生 DOM 事件。如果点击后页面无变化：\n\n1. **不要重复点** — 按钮可能已触发但 `browser_snapshot()` 感知不到变化\n2. 改用 `browser_console()` 执行 JS：\n   ```js\n   document.querySelectorAll('.btn--download')[索引].dispatchEvent(new MouseEvent('click', {bubbles: true, cancelable: true}))\n   ```\n3. 触发后浏览器可能直接导航到视频 CDN 链接，立即用 `browser_console(expression='window.location.href')` 捕获 URL\n4. 然后用 `curl -L` 下载，再用 `browser_navigate()` 回到下载页\n\n详情见 `references/douyin-downloader-workarounds.md` 方案 B。\n\n### 手动转写已下载的音频文件\n\n如果通过第三方服务获得了 MP3/MP4 文件，可以直接用 faster-whisper 手动转写：\n\n```python\nfrom faster_whisper import WhisperModel\nmodel = WhisperModel('base', device='cpu', compute_type='float32')\nsegments, info = model.transcribe('/path/to/audio.mp3', language='zh', bea"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn77499qe4se2kf8tcm3a5nypx8194cw\",\n  \"slug\": \"douyin-video-to-txt\",\n  \"version\": \"1.0.1\",\n  \"publishedAt\": 1783664730731\n}"},{"path":"references/clawhub-publish.md","content":"# ClawHub 发布参考\n\n## 命令\n\n```bash\nclawhub skill publish <absolute_path> --version X.Y.Z --changelog \"更新说明\"\n```\n\n当需要指定显示名称时：\n```bash\nclawhub skill publish <path> --version X.Y.Z --name \"中文显示名\"\n```\n\n## 已知坑\n\n### `--version` 必须作为 CLI 参数\n版本号写在 SKILL.md frontmatter 里不够——`clawhub` 还会报 `Error: --version must be valid semver`。必须显式传 `--version X.Y.Z`。\n\n### 绝对路径比相对路径可靠\n第一次用 `cd <dir> && clawhub skill publish .` 报了 `Error: SKILL.md required`，即使文件确实在目录里。换成绝对路径（加 `DEBUG=1`）就通过了。建议直接用绝对路径。\n\n### DEBUG 环境变量\n遇到奇怪错误时加 `DEBUG=1` 可以看到更多信息，有时换了就过了（可能是竞态或缓存问题）。\n\n## 版本号建议\n\n- 修 bug / 改文案 → patch（2.0.0 → 2.0.1）\n- 加功能 → minor（2.0.0 → 2.1.0）\n- 大重构 → major（2.0.0 → 3.0.0）"},{"path":"references/completed-note-example.md","content":"# 完成笔记示例\n\n这是 douyin-video-to-txt Phase 2 完成后的最终笔记格式。Agent 在整理段落和生成总结时以此为参考标准。\n\n## 实际示例：Palantir Ontology 视频\n\n```markdown\n---\ntitle: \"Palantir Ontology 是怎么跑起来的\"\nsource: \"douyin\"\nurl: \"https://www.douyin.com/video/7650867554675641638\"\nauthor: \"Suncooler\"\ndate: \"2026-06-14 11:29\"\nduration: \"6:35\"\ntags: [douyin, transcription, palantir, ontology, AI]\nstatus: \"complete\"\n---\n\n## AI 总结\n\nPalantir Ontology 不是用来表示数据的，是用来表示决策的——数据是原料，决策是成品。视频用一个真实 demo 开场：AI agent 监测到供应链风险后，自动跑完五步——查供应商、锁原材料、顺价值链推下游影响、算 Revenue at Risk、提交结论给人类审核。整个过程不到两分钟。\n\n但作者说：这不是 AI 案例，这是 Pipeline 案例。AI 只是最后两脚油门，前面五层数据加工才是它能踩油门的前提。\n\nOntology = Palantir Foundry 的核心，拆成 7 层：\n\n1. **Data Connection**（线）— 把数据从原系统拉进来，Palantir 把传统 ETL 产品化了\n2. **Raw Storage**（表）— 保留原始数据血统，从根上解决数据口径对不上的问题\n3. **Cleaning & Parsing**（清洗）— Code Workbook + Pipeline Builder 混合\n4. **Standardize Tables**（半对象）— 跨系统整合成业务可用的视图\n5. **Object Backing**（对象化）— 标准表变成 Ontology 对象\n\n后三层（下期讲）：Final、AIP Logic、Action Type。\n\n## 完整文案\n\n今年4月，汉奴威工业展AWS的舞台上，Mirkega默克集团百年生命科学巨头的数字化采购负责人Mike Benzheim跟Palantir的FDE一起做了一场Live demo。屏幕上跑的是一个叫Foundry的平台，一个AI agent刚刚监测到一条新闻——某个区域出现了供应链风险。\n\n普通人的反应是什么？开会、找人、打电话。这个Agent的反应是他自己跑完了五步：第一步查供应商，第二步锁原材料，第三步顺价值链推下游影响，第四步算Revenue at Risk，第五步把结论和数据节点、推理过程提交给人类审核。整个过程不到两分钟。\n\n你听完这段可能会说，这是个很酷的AI案例。错，这不是AI案例，这是Pipeline案例。AI只是最后两脚油门……\n\n---\n*由 douyin-video-to-txt 自动转录生成*\n```\n\n## 关键原则\n\n| 方面 | 要求 |\n|------|------|\n| AI 总结 | 基于全文理解，提炼核心论点。不是取前几句也不是复述全部。用语自然，无\"本文介绍了\"类废话 |\n| 段落整理 | 相邻短句合并，按话题切换分段。保留专业术语原样。去掉填充词但保持语气节奏 |\n| 标题 | 用有意义的中文标题，去掉 yt-dlp 返回的杂乱描述后缀 |\n| author | 用视频创作者的真实名字（如 Suncooler），不是 user ID |\n| tags | 根据内容打标签，帮助 Obsidian 检索 |"},{"path":"references/douyin-downloader-workarounds.md","content":"# Douyin Downloader Workarounds\n\n当 yt-dlp Douyin extractor 因反爬升级失效时的备用方案。\n\n## 根因分析\n\nyt-dlp 的 Douyin extractor 报错 `Fresh cookies (not necessarily logged in) are needed` 的原因：\n- Douyin 的 API 返回空 JSON（API endpoint 返回 `{}` 或 200 HTTP 无 body）\n- extractor 内部检查 `s_v_web_id` cookie，但该 cookie 有有效期\n- macOS 沙箱限制无法读取 Chrome cookie 数据库（`--cookies-from-browser chrome` 失败）\n- 从浏览器 console 提取的 cookies 可能在短时间内过期\n- 本地存在代理（127.0.0.1:7897），可能干扰 SSL 握手\n\n## 已验证的工作流（2026-06-29）\n\n### 方案 A：SaveTik.io（推荐，可直接下载 MP3）\n\n1. 浏览器导航到 `https://en.savetik.co/`\n2. 粘贴抖音短链接到输入框\n3. 点击 Get/Download\n4. 服务返回 MP3 下载链接 → 用 curl/wget 下载到本地\n5. 直接用 faster-whisper 转写已下载的 MP3\n\n**已验证**：6.5MB MP3 下载成功，whisper 转写正常。\n\n### 方案 B：Seekin.ai（推荐，MP4 直链最稳定）\n\n1. 浏览器导航到 `https://www.seekin.ai/douyin-downloader/`\n2. 粘贴抖音短链接，点击 Download Now\n3. 等待服务处理完成（按钮从 \"Extracting\" 变回 \"Download Now\"）\n4. 结果会显示多分辨率选项（8K/1080p/720p/540p + MP3/JPG）\n5. **⚠️ 关键技巧：触发 Download 按钮下载**\n   - Seekin.ai 是 Nuxt.js 应用，Download 按钮用 Vue 事件绑定\n   - `browser_click()` 对这类按钮**无效**（DOM 事件未正确触发）\n   - 正确做法：用 `browser_console(expression=...)` 执行 JS 派发事件：\n     ```js\n     document.querySelectorAll('.btn--download')[0].dispatchEvent(new MouseEvent('click', {bubbles: true, cancelable: true}))\n     ```\n   - 推荐选 **540p 或 720p**（文件更小，音频足够转写，8K 的 69MB 纯属浪费）\n   - **分辨率索引**：第 0 个是 8K，第 1 个是 1080p，第 2 个是 720p，第 3 个是 540p\n     ```js\n     // 选 540p：\n     document.querySelectorAll('.btn--download')[3].dispatchEvent(new MouseEvent('click', {bubbles: true, cancelable: true}))\n     ```\n6. **捕获 MP4 直链**\n   - DispatchEvent 触发后，**浏览器直接导航到原始 MP4 文件 URL**（URL 以 `v26-default.365yg.com/...video...mp4?` 等格式出现）\n   - 立即用 `browser_console(expression='window.location.href')` 获取当前 URL\n   - 然后用 `curl -L -o /tmp/video.mp4 \"<url>\"` 下载（timeout 设 120-180s）\n   - 之后用 `browser_navigate(url=...)` 回到下载页面继续操作\n7. 下载完成后，用 ffmpeg 提取音频进行 Whisper 转写：\n   ```bash\n   ffmpeg -i /tmp/video.mp4 -vn -acodec pcm_s16le -ar 16000 -ac 1 /tmp/audio.wav -y\n   ```\n\n**已验证**：720p 约 16MB，1080p 约 20.92MB，下载速度约 1.8MB/s。\n\n### 方案 C：使用节点时代的反代 API\n\n如果浏览器方案都不通，可以搜索抖音解析 API（如 `douyin.wtf` 等），但这些 API 稳定性较差：\n\n```bash\ncurl -s \"https://api.douyin.wtf/api?url=https://v.douyin.com/xxx/\"\n```\n\n## 注意事项\n\n- 第三方服务可能限流或被墙，需配合代理\n- 下载的 MP3 文件可能包含水印音频（不影响转写）\n- 每次使用前先试 yt-dlp 主流程，不通再降级到第三方服务\n- 第三方服务返回的视频/音频链接有时效性，应及时下载"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"抖音视频转文本知识库 — Download Douyin videos, transcribe to text via faster-whisper, save to Obsidian knowledge base. Skill: Douyin Video To Txt Owner: afeicn Summary: 抖音视频转文本知识库 — Download Douyin videos, transcribe to text via faster-whisper, save to Obsidian knowledge base. Tags: latest:2.0.3 Version history: v1.0.1 | 2026-07-10T06:25:30.731Z | user 更新：完善段落整理规则、补充whisper常见误识别表、优化长视频处理说明 v2.0.3 | 2026-06-14T03:23:15.129Z | user 清理：移除 Docker 相关描述（已不再依赖 Docker） v2.0.2 | 2026-06-14T03:21:54.181Z | user 名称改为中文：抖音视频转文本知识库 v2.0.1 | 2026-","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":782,"uniquenessScore":58,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-11T20:43:23.051Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-11T20:43:23.051Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-14T11:55:23.025Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}