1仕組みと動作原理
自身ではスクレイピングを実装していません。すべての機能は外部 CLI「scrapling」を適切な手順で呼び出すことです。本スキルの実質は「インストール診断 + スクレイピング強度の選択 + 出力結果の検証」という3段階の 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.
使用前の事前診断が必須条件となっています。本スキルは「ユーザーのインストール環境が壊れている可能性がある」ことをデフォルトの前提とし、付属の診断スクリプトを最初に実行して、その出力結果のみを次のステップの判断基準とすることを求めています。
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]'`")
スクレイピング強度は3段階のラダー(静的 get → ブラウザ fetch → 検出回避 stealthy-fetch)となっており、「デフォルトで最強段階を使用しない」ことが明確に求められています。これは、一般的な「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) パターンに一致することを事前に確認すること」および「デフォルトで無効化しないこと」という2つの口頭の前提条件を課しています。
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外部依存関係
| Kind | Dependency / Endpoint |
|---|---|
| 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推奨統制措置と判定根拠
- SKILL.md / 脚本参数: 自動検出の回避、ホストサンドボックスの無効化、または SSL 証明書検証のスキップが含まれる
- scripts/: ローカルスクリプトまたはコマンドの実行: python3 scripts/diagnose_scrapling.py [--url U] [--selector S] [--dynamic]
- 网络端点: 外部ネットワークアクセスの宣言: scrapling CLI により、ユーザーが指定した任意の URL に対して HTTP スクレイピング(静的 get またはブラウザ fetch)を実行(スキル自身のスクリプトはネットワーク通信を行わない)
- 本地工作目录: ファイルの読み書きと成果物の出力: スクレイピング成果物をユーザー指定のパスに保存(例: page.html / article.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…