crawl4ai
БесплатноБез исполняемых скриптовНе проверенCrawl4AI is an open-source Python web crawler that turns web pages into clean markdown and structured data for LLMs. Use it when asked to scrape a site for a…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Crawl4AI — LLM-Friendly Web Crawler
Overview
Crawl4AI (checked against 0.9.5, October 2026) drives a Playwright browser, so it renders JavaScript, and returns markdown, cleaned HTML, links, media and metadata. Extraction can be CSS/XPath based (no LLM, deterministic) or LLM based (any LiteLLM provider string). All examples are async.
Instructions
Installation
pip install crawl4ai
crawl4ai-setup # installs the Playwright browser; run `crawl4ai-doctor` to check
crawl4ai-setup may need root to install system libraries on Linux; if it cannot, run playwright install-deps yourself. A quick CLI check: crwl crawl https://docs.python.org/3/ -o markdown.
Basic Crawling
import asyncio
from crawl4ai import AsyncWebCrawler, CrawlerRunConfig, CacheMode
async def main():
async with AsyncWebCrawler() as crawler:
result = await crawler.arun(
url="https://docs.python.org/3/tutorial/index.html",
config=CrawlerRunConfig(
word_count_threshold=10, # skip blocks with fewer than 10 words
cache_mode=CacheMode.BYPASS, # always fetch fresh; ENABLED reuses the local cache
),
)
if not result.success:
raise RuntimeError(result.error_message)
print(result.markdown) # str-like MarkdownGenerationResult
print(result.markdown.raw_markdown) # full markdown
print(result.cleaned_html)
print(result.media["images"])
print(result.links["internal"], result.links["external"])
print(result.metadata) # title, description, ...
asyncio.run(main())
arun does not raise on HTTP or navigation failures: check result.success.
Fit markdown (drop boilerplate)
from crawl4ai import CrawlerRunConfig, DefaultMarkdownGenerator, PruningContentFilter
config = CrawlerRunConfig(
markdown_generator=DefaultMarkdownGenerator(
content_filter=PruningContentFilter(threshold=0.48, threshold_type="fixed"),
),
)
# after arun: result.markdown.fit_markdown holds the filtered text
LLM-Powered Structured Extraction
import asyncio, json, os
from pydantic import BaseModel
from crawl4ai import AsyncWebCrawler, CrawlerRunConfig, LLMConfig, LLMExtractionStrategy
class Product(BaseModel):
name: str
price: float
rating: float | None
features: list[str]
extraction = LLMExtractionStrategy(
llm_config=LLMConfig(provider="openai/gpt-4o-mini", api_token=os.environ["OPENAI_API_KEY"]),
schema=Product.model_json_schema(),
extraction_type="schema",
instruction="Extract every product on the page.",
)
async def main():
async with AsyncWebCrawler() as crawler:
result = await crawler.arun(
url="https://www.keychron.com/collections/all-keyboards",
config=CrawlerRunConfig(extraction_strategy=extraction),
)
for p in json.loads(result.extracted_content):
print(p["name"], p["price"])
asyncio.run(main())
The old provider= / api_token= arguments directly on the strategy still exist but LLMConfig is the current form. Use provider="ollama/llama3.3" for a local model (no token).
CSS-Based Extraction (No LLM)
import asyncio, json
from crawl4ai import AsyncWebCrawler, CrawlerRunConfig, JsonCssExtractionStrategy
schema = {
"name": "Product listings",
"baseSelector": ".product-card", # repeating element
"fields": [
{"name": "title", "selector": "h3.product-title", "type": "text"},
{"name": "price", "selector": ".price", "type": "text"},
{"name": "url", "selector": "a", "type": "attribute", "attribute": "href"},
],
}
async def main():
async with AsyncWebCrawler() as crawler:
result = await crawler.arun(
url="https://shop.example-store.dev/all",
config=CrawlerRunConfig(
extraction_strategy=JsonCssExtractionStrategy(schema),
js_code="window.scrollTo(0, document.body.scrollHeight);",
wait_for="css:.product-card:nth-child(20)",
),
)
print(json.loads(result.extracted_content))
asyncio.run(main())
Verified offline: JsonCssExtractionStrategy(schema).extract(url, html) returns [{'title': 'Keychron K2', 'url': '/k2'}] for a matching card. JsonCssExtractionStrategy.generate_schema(html, query=...) can have an LLM draft the schema once; then reuse it with no LLM cost. wait_for takes css:<selector> or js:<expression>.
Many pages, sessions and deep crawls
import asyncio, json, os
from crawl4ai import AsyncWebCrawler, CrawlerRunConfig, BFSDeepCrawlStrategy
async def main():
async with AsyncWebCrawler() as crawler:
# Several known URLs in parallel
results = await crawler.arun_many(
urls=["https://docs.python.org/3/library/asyncio.html",
"https://do
Установить crawl4ai в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл crawl4ai?
Crawl4AI is an open-source Python web crawler that turns web pages into clean markdown and structured data for LLMs. Use it when asked to scrape a site for a RAG pipeline, convert pages to markdown, render JavaScript pages, extract JSON with CSS selectors or an LLM, or crawl many pages or a whole site with sessions and deep crawling.
Как установить скилл crawl4ai?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл crawl4ai запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic