1实现原理 · 为什么它能做到
站点条目『Tapestry Sources』在本 pin commit 无同名目录(仓库只有 7 个 skill:learn-this / article-extractor / youtube-transcript / ship-learn-next / scrum-sage / session-log / unblock-action),本报告按『下载文章、PDF、YouTube 字幕源材料』这一描述映射到内容获取总编排 learn-this,并以它实际调用的 article-extractor 与 youtube-transcript 作为下载实现取证。
| [Learn This](#0-learn-this-) | One command to extract content from any URL and turn it into an action plan. |
内容获取靠 URL 类型分派:YouTube 走 yt-dlp、文章走 readability/trafilatura、PDF 走 curl+pdftotext,检测与分派全部写成可直接执行的内联 bash。
elif [[ "$URL" =~ \.pdf$ ]] || curl -sI "$URL" | grep -iq "Content-Type: application/pdf"; then CONTENT_TYPE="pdf"
YouTube 分支是 yt-dlp 抓自动字幕 + 内联 Python 去重清洗成纯文本的固定套路,并用视频标题命名输出文件。
yt-dlp --write-auto-sub --skip-download --sub-langs en --output "temp_transcript" "$URL"
文章分支是三级降级链:reader(Mozilla Readability)→ trafilatura → curl + 内联 HTMLParser,缺工具时按 npm/pip 现场安装。
### Option 1: reader (Recommended - Mozilla's Readability) ```bash command -v reader ```
PDF 分支最简:curl -L 下载后用 pdftotext 抽取,缺 poppler 时不阻塞——保留 PDF 并提示安装命令。
echo "⚠️ pdftotext not found. PDF downloaded but not extracted." echo " Install with: brew install poppler"
所有分支都以『标题转安全文件名 + 落到当前工作目录』收尾:清 / : ? " < > |、截断 80-100 字符再拼 .txt。
FILENAME=$(echo "$ARTICLE_TITLE" | tr '/' '-' | tr ':' '-' | tr '?' '' | tr '"' '' | cut -c 1-80 | sed 's/ *$//')
内容获取只是前半程:拿到 txt 后 learn-this 强制('Always create an action plan')调用 ship-learn-next 生成 5-rep 行动计划,交付『内容文件 + 计划文件』两份产物。
**IMPORTANT**: Always create an action plan after extracting content.
2核心能力
3外部依赖
| Kind | Dependency / Endpoint |
|---|---|
| cli | yt-dlp(字幕/元数据/音频下载) |
| cli | reader(@mozilla/readability-cli 或 reader-cli,文章提取首选) |
| cli | trafilatura(Python 文章提取备选) |
| cli | curl(PDF 下载与文章兜底抓取) |
| cli | pdftotext(poppler,PDF 取文) |
| cli | whisper(openai-whisper,仅在完全无字幕时使用) |
| cli | python3(VTT 去重清洗与 HTML 兜底解析的内联脚本) |
| network | YouTube(经 yt-dlp 取字幕/元数据/音频) |
| network | 目标网页(用户给的任意 URL:HEAD 探测、curl 抓 HTML、reader/trafilatura 拉正文) |
| network | 包管理器源(Homebrew / apt / PyPI / npm registry)——依赖自动安装路径上的网络出口 |
4管控建议与判定依据
- scripts/: 执行本地脚本或命令: yt-dlp --list-subs / --write-sub / --write-auto-sub --skip-download --sub-l
- scripts/ 或 SKILL.md: 声明动态安装外部语言包依赖
- 网络端点: 声明外部网络访问: YouTube(yt-dlp:字幕、元数据、必要时音频;youtube.com / youtu.be / /shorts/)
- 本地工作目录: 文件读写与工件输出: 当前工作目录:<标题>.txt(清洗后的正文/字幕,最终产物)
5第二遍独立确认
- [unlocatable] 任务表 name_slug=tapestry-sources 对应的 skill 目录 — git ls-tree -r HEAD 列名:LICENSE、README.md、article-extractor/SKILL.md、install.sh、learn-this/SKILL.md、scrum-sage/SKILL.md、session-log/SKILL.md、ship-learn-next/SKILL.md、unblock-action/SKILL.md、youtube-transcript/SKILL.md——无 tapestry-sources 或任何 sources 命名的目录/SKILL.md;pool.json 侧该条目 path="{空}"、来源为 awesome-skills.com 的 repo 级摘要。按任务书规则记为 unlocatable,不硬造目录。
- [discrepancy] 映射决定:以 learn-this 作为本条目主体 — 站点摘要『Download sources from articles, PDFs, and YouTube video transcripts』与 learn-this frontmatter description 的三源检测('Automatically detects content type (YouTube video, article, PDF)')逐项对应,仓库内没有第二个覆盖三源的入口(article-extractor 只做文章、youtube-transcript 只做视频)。故 skill.path 记为 learn-this,报告显式说明这是映射而非同名命中;如需严格一一对应,本条目应在站点侧标注为 repo 级条目。
- [ok] 文章三级降级链真实存在 — article-extractor/SKILL.md '## Extraction Methods' 依次 Method 1 reader、Method 2 trafilatura、Method 3 兜底 curl + 内联 HTMLParser;'## Complete Workflow' 用 if command -v reader / elif command -v trafilatura / else 分支实现,与 learn-this Step 2 的 case 一致。
- [ok] YouTube 三段策略与确认门 — youtube-transcript/SKILL.md 明列 Option 1 --write-sub、Option 2 --write-auto-sub、Option 3 Whisper('**ONLY use this if both manual and auto-generated subtitles are unavailable.**'),且 Whisper 前有体积展示+等待确认、安装前再次等待确认、转写后询问是否删除音频——确认门原文均在。
- [ok] PDF 分支的 pdftotext 与降级 — learn-this Step 2 PDF 段:curl -L 下载 → if command -v pdftotext → pdftotext 取文并可选删 PDF;否则打印 'pdftotext not found' 与 brew/apt 安装提示并保留 PDF 作为产物。
- [ok] 无凭证读取(重要:决定档位) — 对 learn-this/article-extractor/youtube-transcript/install.sh/README 扫描 .env|API_KEY|token|secret|cookie|login 无命中;yt-dlp 未使用 --cookies-from-browser,Whisper 为本地模型,无任何账号依赖。故 credential_reads 为空、档位落黄而非橙。
- [ok] 文件名清洗与写盘范围 — 清洗链在 learn-this(article 行)与 article-extractor(tr '/' '-' / tr ':' '-' / cut -c 1-80|100)均存在;产物写当前目录,中间文件 rm;install.sh 只写 $HOME/.claude/skills(SOURCE 目录为脚本自身所在目录)。
- [ok] 安装命令是否需要提权 — youtube-transcript/SKILL.md 的 Linux 路径为 'sudo apt update && sudo apt install -y yt-dlp'(需要 sudo);macOS/pip/npm 路径无需提权。已如实写入 scripts_executed 与 external_deps。
6结论
1da7c419a2dedca5…