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外部依赖
| 类型 | 依赖 |
|---|---|
| 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风险提醒 风险提醒:黄色 · 留意使用
- 抓取内容直通下游模型 — 网页正文与字幕是不可信外部文本,落盘后作为 'learn-this' 完整流程的输入交给模型改写;恶意页面/字幕可植入指令影响产出,skill 无任何来源标注或内容消毒步骤。
- 任意 URL 抓取与命令拼接 — URL 直接进入 curl/reader/trafilatura/yt-dlp 命令行(普遍有双引号但无 scheme 白名单与格式校验),内联 python 片段中还把文件名变量拼进 'open(...)';理论上可被带引号/换行的输入破坏脚本结构(本机自用场景风险有限)。
- 运行时安装第三方软件(含 sudo) — 缺依赖时按 SKILL.md 直接执行 brew/apt/pip/npm 安装命令,Linux 路径需要 sudo;供应链与权限面由用户环境决定,skill 不做校验也不锁定版本。
- 版权与站点条款 — 抓取文章正文、YouTube 字幕,必要时下载音频转写,属批量取用他人内容的场景;README/SKILL.md 未涉及版权、robots.txt 或平台条款,使用者需自行判断。
- 无质量校验 — 抓取失败与『抓到的是导航/广告垃圾』在提示词层无法区分(兜底 HTMLParser 明确 'less reliable'),落盘前只做字符清洗与去重,不做内容完整性检查。
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…80e1dc56df