1实现原理 · 为什么它能做到
它自己不实现抓取:全部能力是把外部 CLI「scrapling」用正确姿势调起来。skill 的实质是「安装诊断 + 抓取档位选择 + 输出验收」三段 SOP,抓取引擎完全在外包工具里。
Use Scrapling through its CLI as the default path. Start with the smallest working command, validate the saved output, and only escalate to browser-backed fetching when the static fetch does not contain the real page content.
先诊断后使用是硬前置:skill 把「用户的安装可能是坏的」当作默认假设,要求先跑自带诊断脚本,并以其输出为下一步的唯一依据。
Run the bundled diagnostic script first: ```bash python3 scripts/diagnose_scrapling.py ``` Use the result as the source of truth for the next step.
诊断脚本用 shutil.which + `scrapling --help` 的真实退出码与 stderr 关键字('no module named click' / 'install scrapling with any of the extras')区分「没装」与「装了但缺 CLI extras」,并直接给出对应的修复命令。
print("status: broken") if "install scrapling with any of the extras" in output.lower() or "no module named 'click'" in output.lower(): print("cause: installed without CLI extras") print("fix: `uv tool uninstall scrapling` then `uv tool install 'scrapling[shell]'`")
抓取强度是三级阶梯(静态 get → 浏览器 fetch → 反检测 stealthy-fetch),且被明确要求「不要默认用最强档」——这是该 skill 相对普通「调 CLI」文档的核心方法论。
- Start with `extract get` for normal pages, article pages, and most WeChat public articles. - Use `extract fetch` when the static HTML does not contain the real content or the page depends on JavaScript rendering. - Use `extract stealthy-fetch` only after `fetch` still fails because of anti-bot or challenge behavior. Do not make it the default.
输出验收被写成硬纪律:不准凭退出码宣布成功,必须打开落盘文件看大小与内容。这是把「假成功」当主要失败模式来防。
- Do not claim success from exit code alone. Inspect the saved file.
对 TLS 证书验证失败给出「关闭校验」的恢复配方(--no-verify),但附加了「必须先确认失败匹配 curl:(60) 模式」和「不得默认关闭」两道口头前置。
If `extract get` fails with `curl: (60) SSL certificate problem`, treat it as a local trust-store problem first, not a Scrapling content failure. Retry the same command with: ```bash --no-verify ``` Only do this after confirming the failure matches the local certificate verification error pattern. Do not silently disable verification by default.
2核心能力
3外部依赖
| 类型 | 依赖 |
|---|---|
| cli | scrapling(外部开源抓取 CLI;本 skill 的核心依赖,未随包分发) |
| cli | uv(工具安装器) |
| cli | python3(运行自带诊断脚本) |
| cli | rg / wc / sed(输出验收用,均为常规 POSIX 工具) |
| package | Playwright 浏览器运行时(由 `scrapling install` 下载,落 ~/Library/Caches/ms-playwright 或 ~/.cache/ms-playwright) |
| network | 任意目标站点(用户给定的 URL;skill 不限定域名,示例用 example.com 与 mp.weixin.qq.com) |
| network | example.com(文档中的占位目标,非固定端点) |
4风险提醒 风险提醒:红色 · 谨慎使用
- 教导关闭 TLS 证书校验(--no-verify),且已进入可复制示例命令 — SKILL.md 与 references/troubleshooting.md 均给该恢复配方,微信冒烟示例把它与 #js_content 并列写死;脚本 `if args.no_verify: cmd.append("--no-verify")` 真实透传。在验证被关掉的连接上,中间人可篡改正文而用户无从察觉——而本 skill 的产物(抓回的正文)通常正是要被阅读和信任的内容。后果是「抓到的内容可能不是站点真正返回的内容」。建议:仅在确认 curl:(60) 且已排除代理/自签 CA 问题后临时使用,不要写进固定脚本。
- 反反爬升级通道被常态化 — stealthy-fetch 是明确的 anti-bot/challenge 绕过入口。用于自有站点或明确授权目标属正常运维;用于他人站点时可能违反其服务条款,且该 skill 不提供站点授权判断。使用前应确认目标站点允许自动化访问。
- 抓回的第三方内容进入 agent 上下文(prompt injection 面) — 流程要求 agent 保存后读回预览与校验。网页正文中若嵌入指令性文本,会作为普通内容出现在上下文里影响后续判断——这是抓取类 skill 的固有面,skill 自身未提供隔离或净化。建议只把抓取结果当数据处理,不要让它成为下一步动作的指令源。
- 命令拼装依赖 agent 遵守引号纪律 — URL 与选择器要拼进 shell 命令;SKILL.md 要求必须加引号(尤其在 zsh 下),但没有程序化校验。含空格/特殊字符的选择器可能被 shell 重新分词。诊断脚本自身走参数列表不受影响,风险只在 agent 手写命令一侧。
- 平台覆盖偏 macOS/Linux — 浏览器缓存探测只覆盖 ~/Library/Caches/ms-playwright 与 ~/.cache/ms-playwright,Windows 路径未涉及;文档正文也未给 Windows 安装路径。Windows 用户只能从 SKILL.md 的通用步骤外推。
5第二遍独立确认
- [ok] 每条外部依赖的调用点是否真实存在(而非推测) — 六条依赖全部回到原文:scrapling(Step 2 的 uv tool install 'scrapling[shell]'、Step 4 的 scrapling extract …)、uv(同处)、python3(Step 1 的 python3 scripts/diagnose_scrapling.py)、Playwright 运行时(Step 2 的 scrapling install + 诊断脚本的 ms-playwright 缓存探测代码)、mp.weixin.qq.com(Step 4 的公众号示例)、example.com(Step 4 占位示例)。无推测项。
- [ok] 代码层面是否存在被遗漏的网络/凭证行为(找反例) — 反例检索失败:diagnose_scrapling.py 的 import 仅 argparse/shutil/subprocess/sys/tempfile/pathlib/typing;无 urllib/requests/socket;无环境变量或 token 读取(grep os.environ/getenv 零命中);唯一的网络行为全在被调用的 scrapling CLI 里,本仓库不自带该 CLI。故『脚本自身不发网络请求、不读凭证』成立。
- [ok] 『外部 CLI 才是能力本体』这一实现原理是否夸大——skill 自身是否另有抓取实现 — 三文件全部读毕:诊断脚本只做 which/--help/缓存目录探测与一次可选 subprocess 冒烟;troubleshooting.md 全是命令与症状;SKILL.md 全是 SOP。无任何自研抓取/解析代码,原理陈述成立且不夸大。
- [discrepancy] 安全降级(--no-verify)是否只出现在文档说明、未进入可执行示例 — 第一遍按上一条思路复核后发现更强的事实:SKILL.md 的『### Diagnose and smoke test a WeChat article body』代码块是把 --no-verify 与 --selector '#js_content' 写在一起的三行命令(python3 scripts/diagnose_scrapling.py \ --url 'https://mp.weixin.qq.com/s/ARTICLE_ID?scene=1' \ --selector '#js_content' \ --no-verify),而诊断脚本确实会把它透传:`if args.no_verify: cmd.append("--no-verify")`。即降级路径不仅被说明、还被脚本实现并示范,不是纯叙述。
- [ok] references/troubleshooting.md 与 SKILL.md 是否一致 — 三档抓取顺序(get → fetch → stealthy-fetch)、--no-verify 的限定条件、浏览器缓存两处路径、微信抓取模式在三档文档中表述一致;troubleshooting.md 额外给出 Contents 与更细的症状清单,属补充而非冲突。
- [discrepancy] 本 pin 下目录内容与历史(含 .security-scan-passed 标记)是否变化 — git diff 63a65c1fccae9f32f7d1e0e99670321ae09d4f53..HEAD -- scrapling-skill/ 显示唯一变化是删除 scrapling-skill/.security-scan-passed('1 file changed, 4 deletions(-)'),三个实质文件字节未变。该标记文件是 gitleaks 类密钥扫描的通过记录,与本 skill 的能力/风险结论无关,但意味着『曾有过的安全扫描通过标记在当前 pin 已不存在』,引用旧记录时不应再把它算作现状。另:同 pin 的 data/analysis 目录内已有一份本 skill 的旧侦查记录(commit 63a65c1…),本次为按新 pin 的独立重做,结论方向一致(均判红)而证据面按当前 pin 重新采集。
- [ok] pin commit 与 skill.path 是否与任务书一致 — git rev-parse HEAD = d5c4678cb5d4fd6acc9c922690df035dbd33d247;该目录位于仓库根,相对路径 scrapling-skill;本目录最后实质提交 878f947(2026-09-07)。GitHub API 复核 MIT / stars 1392 / pushed 2026-09-15T09:30:04Z。
6结论
65c575aca652cc60…d5c4678cb5