OpenSource-Hub

crawl4ai

ライブラリ

unclecode/crawl4ai

LLM向けのWebクローラー、クリーンなMarkdownを出力します。

概要

Crawl4AI は、LLM 向けにクリーンで構造化されたMarkdownを生成するためのオープンソースのWebクローラーです。非同期クロール、キャッシュ、アンチスクレイピング検出、適応型インテリジェンスを備え、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

FAQ (5)

トラブル対応
crawl4ai v8.0.0 Docker で API hooks が 'ImportError: __import__ not found' で失敗するのはなぜですか?

これはv8.0.0における既知のリグレッションであり、過度に制限的な組み込み関数のホワイトリスト(PR #1712)が原因です。フックマネージャの内部コンパイルステップは exec("import asyncio", namespace) を実行し、これには __import__ 組み込み関数が必要ですが、許可リストから削除されていました。ユーザーが提供するフックは、たとえ些細なものでも、このエラーを引き起こします。

**回避策:**
- **ダウングレード** v7.xへ(例:unclecode/crawl4ai:v7.0.0
- **コンテナを制御している場合**、hook_manager.py を編集して以下のいずれかを実行します:
1. allowed_builtins リストに '__import__' を追加する、または
2. exec("import asyncio") / exec("import json") の行を直接代入に置き換える:
import asyncio, json
namespace['asyncio'] = asyncio
namespace['json'] = json

恒久的な修正については、issue #1878 を追跡してください。

参照 Issue #1878
トラブル対応
crawl4aiでNlpSentenceChunkingを使用する際に、なぜ文がランダムな順序で返されるのか?

これはcrawl4aiの既知のバグで、NlpSentenceChunking.chunk()list(set(sens))を使用しているため、Pythonのsetは順序を保持しないため文がシャッフルされます。修正はdevelopブランチにマージ済みで、次のリリースに含まれます。

**回避策**: chunking_strategy.pyを手動で編集し、以下のように変更してください:

return list(set(sens))  # バグ

を次のように:
return sens

または修正ブランチから直接インストール:

pip install git+https://github.com/unclecode/crawl4ai.git@develop

この修正により文書の順序が保持され、意図的な重複文も維持されます。

参照 Issue #1909
トラブル対応
crawl4ai Docker Job Queue APIで「Deserialization of type LLMTableExtraction is not allowed」エラーを修正する方法

このバグは、async_configs.py内の逆シリアル化許可リストにLLMTableExtractionが含まれていなかったために発生しました。これはcrawl4ai v0.8.7以降で修正されています。解決するには、最新バージョンにアップグレードしてください:

docker pull ghcr.io/unclecode/crawl4ai:latest

pipを使用している場合は、pip install crawl4ai>=0.8.7で更新してください。修正を適用するには、Dockerコンテナを再起動してください。

参照 Issue #1924
トラブル対応
なぜcrawl4aiはsemaphore_countを無視して429 'Too Many Requests'エラーを引き起こすのですか?

DeepCrawlStrategyMemoryAdaptiveDispatcherを作成する際に、CrawlerRunConfigsemaphore_count設定を無視し、デフォルトで20件の同時タスクを生成してレート制限を引き起こす既知のバグです。修正ではsemaphore_countを設定から読み取り、max_session_permitとして渡すようになります。

**解決策: バージョン0.8.7以降にアップグレード:**

pip install --upgrade crawl4ai

**一時的な回避策が必要な場合**、ローカルインストール(0.8.7未満)に以下の変更を適用します:

crawl4ai/async_webcrawler.pyの1032行目付近を編集:

max_session_permit = max(1, int(getattr(primary_cfg, "semaphore_count", 5) or 5))
dispatcher = MemoryAdaptiveDispatcher(
    max_session_permit=max_session_permit,
    ...
)

または、パッチ適用済みブランチをインストール:

pip install git+https://github.com/hafezparast/crawl4ai.git@fix/maysam-dispatcher-semaphore-count-1927

修正後、設定内のsemaphore_countが適切に同時実行数を制御し、429エラーを防止します。

参照 Issue #1927
トラブル対応
なぜ enable_stealth=True が crawl4ai 0.8.6 で navigator.webdriver を隠さないのですか?

crawl4ai 0.8.6では、StealthAdapterplaywright-stealth 2.xからstealth_async/stealth_syncを誤ってインポートしており、stealthが静かにスキップされる原因となっています。crawl4ai 0.8.7にアップグレードすると、アダプターがStealthクラスを使用するように更新されます:

pip install --upgrade crawl4ai==0.8.7

すぐにアップグレードできない場合の一時的な回避策は、playwright-stealthを1.xシリーズにダウングレードすることです:

pip install 'playwright-stealth<2'

(他の依存関係と競合する可能性があることに注意してください。)

参照 Issue #1959