К основному содержанию
скилл CX Codex

scrapling-skill — скилл для Claude Code: извлечение страниц

Скилл учит агента ставить Scrapling CLI, выбирать статический или браузерный фетчер и проверять сохранённый файл вместо веры в код возврата.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add daymade/claude-code-skills --skill scrapling-skill -a claude-code
Открыть на GitHub

Что делает scrapling-skill

Скилл описывает работу со Scrapling через CLI: сначала самая простая команда, потом проверка файла, и только затем переход на браузерный режим. Внутри лежит чек-лист из шести шагов и скрипт scripts/diagnose_scrapling.py, который проверяет локальную установку и умеет прогонять URL на выборку.

Диагностика идёт первой не случайно: если scrapling --help падает из-за отсутствующего click, скилл предлагает переустановку через uv tool uninstall scrapling и uv tool install 'scrapling[shell]'. Для страниц на JavaScript нужен рантайм Playwright — scrapling install. Вариант scrapling[all] не берётся по умолчанию.

Выбор фетчера простой: extract get для обычных страниц и статей, extract fetch когда в HTML нет реального содержимого, extract stealthy-fetch только после того, как fetch упёрся в защиту от ботов. Для статей на mp.weixin.qq.com скилл советует селектор #js_content. Если extract get возвращает ошибку curl: (60) SSL certificate problem, это проблема локального хранилища сертификатов, а не Scrapling — повтор с --no-verify допустим только после такой проверки.

Какие задачи решает

  • поставить Scrapling CLI с нужными extras
  • отличить статическую страницу от страницы на JavaScript
  • вытащить тело статьи с mp.weixin.qq.com
  • проверить, что сохранённый файл не пустой
  • разобраться с ошибкой SSL-сертификата при выборке

Примеры запросов агенту

  • Помоги поставить scrapling и вытащи статью по ссылке
  • Скачай страницу через scrapling extract get и покажи первые строки файла
  • Почему extract fetch падает — прогони диагностику скилла

Как установить scrapling-skill

1Через Skills CLI (Vercel)

npx skills add daymade/claude-code-skills --skill scrapling-skill -a claude-code

2Вручную: положить файлы

~/.claude/skills/scrapling-skill/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/scrapling-skill/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора64

repomix-safe-mixer Скилл сканирует проект на захардкоженные ключи и токены и не даёт repomix упаковать код, пока секреты не убраны. CX Codex +1 912установок financial-data-collector Собирает реальные финансовые данные по публичным компаниям США из yfinance и отдаёт структурированный JSON для DCF, сравнений и разбора отчётности. CX Codex +1 883установок repomix-unmixer Распаковывает репозитории из файлов Repomix обратно в дерево каталогов. Пригодится, когда проект упакован в один XML, Markdown или JSON для ИИ. CX Codex +1 882установок doc-to-markdown Превращает DOCX, PDF, PPTX и сохранённый HTML в аккуратный Markdown и сам чинит типовые дефекты конвертации. Пригодится, когда нужно вытащить текст из документа без ручной правки. CX Codex +1 872установок douban-skill Выгружает книги, фильмы, музыку и игры из профиля Douban в CSV и умеет добирать свежие записи по RSS. CX Codex +1 749установок terraform-skill Разбирает, почему terraform plan показывает «No changes», а сайт лежит, и не даёт релизу задеть чужой сервис на общем хосте. CX Codex +1 710установок marketplace-dev Превращает репозиторий со скиллами в маркетплейс плагинов Claude: генерирует marketplace.json, добавляет записи и переносит скиллы между наборами. CX Codex +1 695установок tunnel-doctor Диагностирует сетевые сбои на macOS и Windows/WSL при конфликтах Tailscale, прокси и TUN-адаптеров. Помогает, когда пинг проходит, а SSH или браузер не отвечают. CX Codex +1 678установок

Похожие

Рядом в теме «Браузер и парсинг»

Все скиллы по теме «Браузер и парсинг» →

Вопросы о scrapling-skill

Как установить scrapling-skill в Claude?

Выполните npx skills add daymade/claude-code-skills --skill scrapling-skill -a claude-code. После этого файл скилла окажется в ~/.claude/skills/scrapling-skill/SKILL.md.

Что делает scrapling-skill?

Проводит агента по установке и использованию Scrapling CLI: диагностика, починка extras и рантайма Playwright, выбор фетчера, сохранение вывода в файл и его проверка.

Когда нужен stealthy-fetch, а не fetch?

Только если extract fetch уже не справился из-за защиты от ботов или проверки в браузере. По умолчанию скилл его не использует.

Исходный текст

SKILL.md · MIT
---
name: scrapling-skill
description: >-
  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.
---

# Scrapling Skill

## Overview

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.

Do not assume the user's Scrapling install is healthy. Verify it first.

## Default Workflow

Copy this checklist and keep it updated while working:

```text
Scrapling Progress:
- [ ] Step 1: Diagnose the local Scrapling install
- [ ] Step 2: Fix CLI extras or browser runtime if needed
- [ ] Step 3: Choose static or dynamic fetch
- [ ] Step 4: Save output to a file
- [ ] Step 5: Validate file size and extracted content
- [ ] Step 6: Escalate only if the previous path failed
```

## Step 1: Diagnose the Install

Resolve the loaded Skill directory without changing the user's working directory.
Replace the placeholder once, then run the bundled diagnostic:

```bash
SCRAPLING_SKILL_DIR='<absolute path to the loaded scrapling-skill directory>'
python3 "$SCRAPLING_SKILL_DIR/scripts/diagnose_scrapling.py"
```

Use the result as the source of truth for the next step.
For platform defaults, custom or unknown cache locations and smoke-test output
retention, read `references/troubleshooting.md`.

## Step 2: Fix the Install

### If the CLI was installed without extras

If `scrapling --help` fails with missing `click` or a message about installing Scrapling with extras, reinstall it with the CLI extra:

```bash
uv tool uninstall scrapling
uv tool install 'scrapling[shell]'
```

Do not default to `scrapling[all]` unless the user explicitly needs the broader feature set.

### If browser-backed fetchers are needed

Install the Playwright runtime:

```bash
scrapling install
```

If the install looks slow or opaque, read `references/troubleshooting.md` before guessing.
Treat an already-installed message or cache-directory presence as installation
clues. Verify browser-backed readiness with the needed fetch and inspect its saved
content; neither clue proves compatible versions or a working browser launch.

## Step 3: Choose the Fetcher

Use this decision rule:

- 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.

## Step 4: Run the Smallest Useful Command

Always quote URLs in shell commands. This is mandatory in `zsh` when the URL contains `?`, `&`, or other special characters.

### Full page to HTML

```bash
scrapling extract get 'https://example.com' page.html
```

### Main content to Markdown

```bash
scrapling extract get 'https://example.com' article.md -s 'main'
```

### JS-rendered page with browser automation

```bash
scrapling extract fetch 'https://example.com' page.html --timeout 20000
```

### WeChat public article body

Use `#js_content` first. This is the default selector for article body extraction on `mp.weixin.qq.com` pages.

```bash
scrapling extract get 'https://mp.weixin.qq.com/s/ARTICLE_ID?scene=1' article.md -s '#js_content'
```

## Step 5: Validate the Output

After every extraction, verify the file instead of assuming success:

```bash
wc -c article.md
sed -n '1,40p' article.md
```

For HTML output, check that the expected title, container, or selector target is actually present:

```bash
rg -n '<title>|js_content|rich_media_title|main' page.html
```

If the file is tiny, empty, or missing the expected container, the extraction did not succeed. Go back to Step 3 and switch fetchers or selectors.

## Step 6: Handle Known Failure Modes

### Local TLS trust store problem

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.

### WeChat article pages

For `mp.weixin.qq.com`:
- Try `extract get` before `extract fetch`
- Use `-s '#js_content'` for the article body
- Validate the saved Markdown or HTML immediately

### Browser-backed fetch failures

If `extract fetch` fails:
1. Re-check the install with `python3 "$SCRAPLING_SKILL_DIR/scripts/diagnose_scrapling.py"`
2. Check the selected browser cache; resolve an `unknown` location through `references/troubleshooting.md`
3. Retry with a slightly longer timeout
4. Escalate to `stealthy-fetch` only if the site behavior justifies it

## Command Patterns

### Diagnose and smoke test a URL

```bash
python3 "$SCRAPLING_SKILL_DIR/scripts/diagnose_scrapling.py" --url 'https://example.com'
```

### Diagnose and smoke test a WeChat article body

```bash
python3 "$SCRAPLING_SKILL_DIR/scripts/diagnose_scrapling.py" \
  --url 'https://mp.weixin.qq.com/s/ARTICLE_ID?scene=1' \
  --selector '#js_content' \
  --no-verify
```

### Diagnose and smoke test a browser-backed fetch

```bash
python3 "$SCRAPLING_SKILL_DIR/scripts/diagnose_scrapling.py" \
  --url 'https://example.com' \
  --dynamic
```

## Guardrails

- Do not tell the user to reinstall blindly. Verify first.
- Do not default to the Python library API when the user is clearly asking about the CLI.
- Do not jump to browser-backed fetching unless the static result is missing the real content.
- Do not claim success from exit code alone. Inspect the saved file.
- Do not hardcode user-specific absolute paths into outputs or docs.

## Resources

- Installation and smoke test helper: `scripts/diagnose_scrapling.py`
- Verified failure modes and recovery paths: `references/troubleshooting.md`

© daymade · MIT · daymade/claude-code-skills

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой