项目简介
Crawl4AI 是一款开源网页爬虫,专为 LLM 生成干净、结构化的 Markdown。具备异步爬取、缓存、反爬虫检测和自适应智能,无需 API 密钥即可部署。
README 预览
# 🚀🤖 Crawl4AI: Open-source LLM Friendly Web Crawler & Scraper.\n\n\n\n\n\n[](https://github.com/unclecode/crawl4ai/stargazers)\n[](https://github.com/unclecode/crawl4ai/network/members)\n\n[](https://badge.fury.io/py/crawl4ai)\n[](https://pypi.org/project/crawl4ai/)\n[](https://pepy.tech/project/crawl4ai)\n[](https://github.com/sponsors/unclecode)\n\n---\n#### 🚀 Crawl4AI Cloud API — Closed Beta (Launching Soon)\nReliable, large-scale web extraction, now built to be _**drastically more cost-effective**_ than any of the existing solutions.\n\n👉 **Apply [here](https://forms.gle/E9MyPaNXACnAMaqG7) for early access** \n_We’ll be onboarding in phases and working closely with early users.\nLimited slots._\n\n---\n\n\n \n \n \n \n \n \n \n \n \n \n\n\nCrawl4AI turns the web into clean, LLM ready Markdown for RAG, agents, and data pipelines. Fast, controllable, battle tested by a 50k+ star community.\n\n[✨ Check out latest update v0.8.6](#-recent-updates)\n\n✨ **New in v0.8.6**: Security hotfix — replaced `litellm` with `unclecode-litellm` due to a PyPI supply chain compromise. If you're on v0.8.5, please upgrade immediately.\n\n✨ Recent v0.8.5: Anti-Bot Detection, Shadow DOM & 60+ Bug Fixes! Automatic 3-tier anti-bot detection with proxy escalation, Shadow DOM flattening, deep crawl cancellation, config defaults API, consent popup removal, and critical security patches. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.5.md)\n\n✨ Previous v0.8.0: Crash Recovery & Prefetch Mode! Deep crawl crash recovery with `resume_state` and `on_state_change` callbacks for long-running crawls. New `prefetch=True` mode for 5-10x faster URL discovery. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.0.md)\n\n✨ Previous v0.7.8: Stability & Bug Fix Release! 11 bug fixes addressing Docker API issues, LLM extraction improvements, URL handling fixes, and dependency updates. [Rele
常见问题 (5)
故障排除为什么在crawl4ai v8.0.0 Docker中发现“ImportError: __import__ not found”时,API夹会失败?
这是一个已知的回归在 v8.0.0 引起的过度限制的 builtins 白列表(PR #1712)。 链接管理器的内部编译步骤运行 exec("import asyncio", namespace) 需要内置 __import__,但它已从允许列表中删除。 任何用户提供的链接,即使是微不足道的,会引发此错误。 **Workarounds:** - **Downgrade** 到 v7.x (例如, unclecode/crawl4ai:v7.0.0) - **如果你控制了容器**,则编辑 hook_manager.py 或: 1. 添加 __import__ 回到 allowed_builtins 列表,或 2. 替换 `exec
故障排除为什么在 crawl4ai 中使用 NlpSentenceChunking 时会随机返回句子?
这是在“crawl4ai”中使用的已知错误,其中“NlpSentenceChunking.chunk()”使用“list(set(sens))”,因为Python“set(sens))”是未分配的,它会混合到“develop”分支中,并将包括在下一个版本中。 **Workaround**:通过编辑“chunking_strategy.py”并更改“python return list(set(sens)) # BUG”到“python return sens”或直接从修复分支中安装:“bash pip install git+https://github.com/unclecode/crawl4ai.gitdevelop”修复将保留文档秩序并保留故意重复的句子。
故障排除如何在crawl4ai Docker Job Queue API中修复“LLMTableExtraction不允许类型的deserialization”错误?
这个错误是由“LLMTableExtraction”在“async_configs.py”中的 deserialization allowlist中缺少造成的。 它在 crawl4ai v0.8.7 或更高版本中被修复。 要解决问题,请升级到最新版本:“bash docker pull ghcr.io/unclecode/crawl4ai:latest” 如果使用 pip,请使用“pip install crawl4ai>=0.8.7”更新。 重新启动您的 Docker 容器以执行修复。
故障排除为什么 crawl4ai 忽略 semaphore_count 并导致 429 个“太多的请求”错误?
这是一个已知的错误,其中“DeepCrawlStrategy”创建了一个“MemoryAdaptiveDispatcher”,它忽略了“semaphore_count”设置从你的“CrawlerRunConfig”,默认到20个并行任务和触发率限制。 修正程序从配置中读取“semaphore_count”并将其传递为“max_session_permit”。 **解决方案:升级到版本 0.8.7 或更高版本: **“bash pip install --upgrade crawl4ai ′′ ** 如果您需要临时 workaround**,请将此更改应用到本地安装(pre‐0.8.7): Editcrawl4ai/async_webcrawler.py接近线 1032: ``python max_session_
故障排除为什么在 crawl4ai 0.8.6 中不允许_stealth=True 隐藏 navigator.webdriver?
在 crawl4ai 0.8.6 中,“StealthAdapter”错误地从“playwright-stealth” 2.x 导入“stealth_async”/“stealth_sync”,导致隐藏被悄悄地跳过。升级到 crawl4ai 0.8.7,更新适配器以使用“Stealth”类:“bash pip install -upgrade crawl4ai==0.8.7” 如果您无法立即升级,暂时的解决方案是将“playwright-stealth”降级到 1.x 系列:“bash pip install “playwright-stealth<2” ”(请注意,这可能与其他依赖性相冲突)。