scrapling-skill
Install, troubleshoot, and use Scrapling CLI to extract HTML, Markdown, or text from webpages. Use this skill whenever the user mentions Scrapling, `uv tool install scrapling`, `scrapling extract`, WeChat/mp.weixin articles, browser-backed page fetching, or needs help deciding between static and dynamic extraction.
1How It Works & Mechanism
It does not implement scraping itself: its entire capability lies in invoking the external CLI 'scrapling' properly. The essence of the skill is a three-stage SOP consisting of 'installation diagnosis + scraping tier selection + output verification', with the scraping engine completely outsourced to the external tool.
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.
Diagnose-first before use is a strict prerequisite: the skill adopts the default assumption that 'the user's installation may be broken', requiring running the built-in diagnostic script first and treating its output as the sole basis for the next step.
Run the bundled diagnostic script first: ```bash python3 scripts/diagnose_scrapling.py ``` Use the result as the source of truth for the next step.
The diagnostic script uses shutil.which alongside the actual exit code and stderr keywords of `scrapling --help` ('no module named click' / 'install scrapling with any of the extras') to distinguish between 'not installed' and 'installed but missing CLI extras', and directly provides the corresponding remediation commands.
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]'`")
Scraping intensity follows a three-tier ladder (static get → browser fetch → anti-detection stealthy-fetch), with an explicit rule 'do not use the strongest tier by default'—this is the core methodology of this skill compared to generic 'CLI-invoking' documentation.
- 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.
Output verification is established as strict discipline: declaring success based solely on the exit code is forbidden; files written to disk must be opened to inspect their size and content. This treats 'false success' as the primary failure mode to guard against.
- Do not claim success from exit code alone. Inspect the saved file.
It provides a recovery recipe to 'disable verification' (--no-verify) for TLS certificate verification failures, but attaches two verbal prerequisites: 'must first confirm the failure matches curl:(60) pattern' and 'must not disable by default'.
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.
2Core Capabilities
3External Dependencies
| 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(文档中的占位目标,非固定端点) |
4Recommended Governance & Evidence
- SKILL.md / 脚本参数: Contains bypassing automated detection, disabling host sandboxes, or skipping SSL certificate verification
- scripts/: Executes local scripts or commands: python3 scripts/diagnose_scrapling.py [--url U] [--selector S] [--dynamic]
- 网络端点: Declares external network access: scrapling CLI initiates HTTP scraping (static get or browser fetch) against arbitrary user-provided URLs; the skill's scripts themselves make no network calls
- 本地工作目录: File I/O and artifact output: scraping outputs are saved to user-specified paths (examples: page.html / article.md)
5Second-Pass Verification
- [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。
6Verdict & Scenarios
65c575aca652cc60…