Skip to content

Official Crawl4AI Cloud: a hosted web scraping, extraction, and search API for AI agents. Free API key, 1,000 credits a month, no card. Fully open source: this repo is the Apache-2.0 crawler that powers it, and you can self-host it.

Crawl4AI Cloud is live: the README with the two ways to use it and the launch banner, the docs home, the cloud notice as a daily yellow banner while the offer runs

unclecode1f68e5bd7c29
diff --git a/README-first.md b/README-first.md
deleted file mode 100644
index 2a21df39..00000000
--- a/README-first.md
+++ /dev/null
@@ -1,809 +0,0 @@
-# 🚀🤖 Crawl4AI: Open-source LLM Friendly Web Crawler & Scraper.
-
-<div align="center">
-
-<a href="https://trendshift.io/repositories/11716" target="_blank"><img src="https://trendshift.io/api/badge/repositories/11716" alt="unclecode%2Fcrawl4ai | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
-
-[![GitHub Stars](https://img.shields.io/github/stars/unclecode/crawl4ai?style=social)](https://github.com/unclecode/crawl4ai/stargazers)
-[![GitHub Forks](https://img.shields.io/github/forks/unclecode/crawl4ai?style=social)](https://github.com/unclecode/crawl4ai/network/members)
-
-[![PyPI version](https://badge.fury.io/py/crawl4ai.svg)](https://badge.fury.io/py/crawl4ai)
-[![Python Version](https://img.shields.io/pypi/pyversions/crawl4ai)](https://pypi.org/project/crawl4ai/)
-[![Downloads](https://static.pepy.tech/badge/crawl4ai/month)](https://pepy.tech/project/crawl4ai)
-[![GitHub Sponsors](https://img.shields.io/github/sponsors/unclecode?style=flat&logo=GitHub-Sponsors&label=Sponsors&color=pink)](https://github.com/sponsors/unclecode)
-
-<p align="center">
- <a href="https://x.com/crawl4ai">
- <img src="https://img.shields.io/badge/Follow%20on%20X-000000?style=for-the-badge&logo=x&logoColor=white" alt="Follow on X" />
- </a>
- <a href="https://www.linkedin.com/company/crawl4ai">
- <img src="https://img.shields.io/badge/Follow%20on%20LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" alt="Follow on LinkedIn" />
- </a>
- <a href="https://discord.gg/jP8KfhDhyN">
- <img src="https://img.shields.io/badge/Join%20our%20Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join our Discord" />
- </a>
- </p>
-</div>
-
-Crawl4AI is the #1 trending GitHub repository, actively maintained by a vibrant community. It delivers blazing-fast, AI-ready web crawling tailored for LLMs, AI agents, and data pipelines. Open source, flexible, and built for real-time performance, Crawl4AI empowers developers with unmatched speed, precision, and deployment ease.
-
-[✨ Check out latest update v0.7.0](#-recent-updates)
-
-🎉 **Version 0.7.0 is now available!** The Adaptive Intelligence Update introduces groundbreaking features: Adaptive Crawling that learns website patterns, Virtual Scroll support for infinite pages, intelligent Link Preview with 3-layer scoring, Async URL Seeder for massive discovery, and significant performance improvements. [Read the release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.0.md)
-
-<details>
-<summary>🤓 <strong>My Personal Story</strong></summary>
-
-My journey with computers started in childhood when my dad, a computer scientist, introduced me to an Amstrad computer. Those early days sparked a fascination with technology, leading me to pursue computer science and specialize in NLP during my postgraduate studies. It was during this time that I first delved into web crawling, building tools to help researchers organize papers and extract information from publications a challenging yet rewarding experience that honed my skills in data extraction.
-
-Fast forward to 2023, I was working on a tool for a project and needed a crawler to convert a webpage into markdown. While exploring solutions, I found one that claimed to be open-source but required creating an account and generating an API token. Worse, it turned out to be a SaaS model charging $16, and its quality didn’t meet my standards. Frustrated, I realized this was a deeper problem. That frustration turned into turbo anger mode, and I decided to build my own solution. In just a few days, I created Crawl4AI. To my surprise, it went viral, earning thousands of GitHub stars and resonating with a global community.
-
-I made Crawl4AI open-source for two reasons. First, it’s my way of giving back to the open-source community that has supported me throughout my career. Second, I believe data should be accessible to everyone, not locked behind paywalls or monopolized by a few. Open access to data lays the foundation for the democratization of AI, a vision where individuals can train their own models and take ownership of their information. This library is the first step in a larger journey to create the best open-source data extraction and generation tool the world has ever seen, built collaboratively by a passionate community.
-
-Thank you to everyone who has supported this project, used it, and shared feedback. Your encouragement motivates me to dream even bigger. Join us, file issues, submit PRs, or spread the word. Together, we can build a tool that truly empowers people to access their own data and reshape the future of AI.
-</details>
-
-## 🧐 Why Crawl4AI?
-
-1. **Built for LLMs**: Creates smart, concise Markdown optimized for RAG and fine-tuning applications.
-2. **Lightning Fast**: Delivers results faster with real-time, cost-efficient performance.
-3. **Flexible Browser Control**: Offers session management, proxies, and custom hooks for seamless data access.
-4. **Heuristic Intelligence**: Uses advanced algorithms for efficient extraction, reducing reliance on costly models.
-5. **Open Source & Deployable**: Fully open-source with no API keys—ready for Docker and cloud integration.
-6. **Thriving Community**: Actively maintained by a vibrant community and the #1 trending GitHub repository.
-
-## 🚀 Quick Start
-
-1. Install Crawl4AI:
-```bash
-# Install the package
-pip install -U crawl4ai
-
-# For pre release versions
-pip install crawl4ai --pre
-
-# Run post-installation setup
-crawl4ai-setup
-
-# Verify your installation
-crawl4ai-doctor
-```
-
-If you encounter any browser-related issues, you can install them manually:
-```bash
-python -m playwright install --with-deps chromium
-```
-
-2. Run a simple web crawl with Python:
-```python
-import asyncio
-from crawl4ai import *
-
-async def main():
- async with AsyncWebCrawler() as crawler:
- result = await crawler.arun(
- url="https://www.nbcnews.com/business",
- )
- print(result.markdown)
-
-if __name__ == "__main__":
- asyncio.run(main())
-```
-
-3. Or use the new command-line interface:
-```bash
-# Basic crawl with markdown output
-crwl https://www.nbcnews.com/business -o markdown
-
-# Deep crawl with BFS strategy, max 10 pages
-crwl https://docs.crawl4ai.com --deep-crawl bfs --max-pages 10
-
-# Use LLM extraction with a specific question
-crwl https://www.example.com/products -q "Extract all product prices"
-```
-
-## ✨ Features
-
-<details>
-<summary>📝 <strong>Markdown Generation</strong></summary>
-
-- 🧹 **Clean Markdown**: Generates clean, structured Markdown with accurate formatting.
-- 🎯 **Fit Markdown**: Heuristic-based filtering to remove noise and irrelevant parts for AI-friendly processing.
-- 🔗 **Citations and References**: Converts page links into a numbered reference list with clean citations.
-- 🛠️ **Custom Strategies**: Users can create their own Markdown generation strategies tailored to specific needs.
-- 📚 **BM25 Algorithm**: Employs BM25-based filtering for extracting core information and removing irrelevant content.
-</details>
-
-<details>
-<summary>📊 <strong>Structured Data Extraction</strong></summary>
-
-- 🤖 **LLM-Driven Extraction**: Supports all LLMs (open-source and proprietary) for structured data extraction.
-- 🧱 **Chunking Strategies**: Implements chunking (topic-based, regex, sentence-level) for targeted content processing.
-- 🌌 **Cosine Similarity**: Find relevant content chunks based on user queries for semantic extraction.
-- 🔎 **CSS-Based Extraction**: Fast schema-based data extraction using XPath and CSS selectors.
-- 🔧 **Schema Definition**: Define custom schemas for extracting structured JSON from repetitive patterns.
-
-</details>
-
-<details>
-<summary>🌐 <strong>Browser Integration</strong></summary>
-
-- 🖥️ **Managed Browser**: Use user-owned browsers with full control, avoiding bot detection.
-- 🔄 **Remote Browser Control**: Connect to Chrome Developer Tools Protocol for remote, large-scale data extraction.
-- 👤 **Browser Profiler**: Create and manage persistent profiles with saved authentication states, cookies, and settings.
-- 🔒 **Session Management**: Preserve browser states and reuse them for multi-step crawling.
-- 🧩 **Proxy Support**: Seamlessly connect to proxies with authentication for secure access.
-- ⚙️ **Full Browser Control**: Modify headers, cookies, user agents, and more for tailored crawling setups.
-- 🌍 **Multi-Browser Support**: Compatible with Chromium, Firefox, and WebKit.
-- 📐 **Dynamic Viewport Adjustment**: Automatically adjusts the browser viewport to match page content, ensuring complete rendering and capturing of all elements.
-
-</details>
-
-<details>
-<summary>🔎 <strong>Crawling & Scraping</strong></summary>
-
-- 🖼️ **Media Support**: Extract images, audio, videos, and responsive image formats like `srcset` and `picture`.
-- 🚀 **Dynamic Crawling**: Execute JS and wait for async or sync for dynamic content extraction.
-- 📸 **Screenshots**: Capture page screenshots during crawling for debugging or analysis.
-- 📂 **Raw Data Crawling**: Directly process raw HTML (`raw:`) or local files (`file://`).
-- 🔗 **Comprehensive Link Extraction**: Extracts internal, external links, and embedded iframe content.
-- 🛠️ **Customizable Hooks**: Define hooks at every step to customize crawling behavior.
-- 💾 **Caching**: Cache data for improved speed and to avoid redundant fetches.
-- 📄 **Metadata Extraction**: Retrieve structured metadata from web pages.
-- 📡 **IFrame Content Extraction**: Seamless extraction from embedded iframe content.
-- 🕵️ **Lazy Load Handling**: Waits for images to fully load, ensuring no content is missed due to lazy loading.
-- 🔄 **Full-Page Scanning**: Simulates scrolling to load and capture all dynamic content, perfect for infinite scroll pages.
-
-</details>
-
-<details>
-<summary>🚀 <strong>Deployment</strong></summary>
-
-- 🐳 **Dockerized Setup**: Optimized Docker image with FastAPI server for easy deployment.
-- 🔑 **Secure Authentication**: Built-in JWT token authentication for API security.
-- 🔄 **API Gateway**: One-click deployment with secure token authentication for API-based workflows.
-- 🌐 **Scalable Architecture**: Designed for mass-scale production and optimized server performance.
-- ☁️ **Cloud Deployment**: Ready-to-deploy configurations for major cloud platforms.
-
-</details>
-
-<details>
-<summary>🎯 <strong>Additional Features</strong></summary>
-
-- 🕶️ **Stealth Mode**: Avoid bot detection by mimicking real users.
-- 🏷️ **Tag-Based Content Extraction**: Refine crawling based on custom tags, headers, or metadata.
-- 🔗 **Link Analysis**: Extract and analyze all links for detailed data exploration.
-- 🛡️ **Error Handling**: Robust error management for seamless execution.
-- 🔐 **CORS & Static Serving**: Supports filesystem-based caching and cross-origin requests.
-- 📖 **Clear Documentation**: Simplified and updated guides for onboarding and advanced usage.
-- 🙌 **Community Recognition**: Acknowledges contributors and pull requests for transparency.
-
-</details>
-
-## Try it Now!
-
-✨ Play around with this [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1SgRPrByQLzjRfwoRNq1wSGE9nYY_EE8C?usp=sharing)
-
-✨ Visit our [Documentation Website](https://docs.crawl4ai.com/)
-
-## Installation 🛠️
-
-Crawl4AI offers flexible installation options to suit various use cases. You can install it as a Python package or use Docker.
-
-<details>
-<summary>🐍 <strong>Using pip</strong></summary>
-
-Choose the installation option that best fits your needs:
-
-### Basic Installation
-
-For basic web crawling and scraping tasks:
-
-```bash
-pip install crawl4ai
-crawl4ai-setup # Setup the browser
-```
-
-By default, this will install the asynchronous version of Crawl4AI, using Playwright for web crawling.
-
-👉 **Note**: When you install Crawl4AI, the `crawl4ai-setup` should automatically install and set up Playwright. However, if you encounter any Playwright-related errors, you can manually install it using one of these methods:
-
-1. Through the command line:
-
- ```bash
- playwright install
- ```
-
-2. If the above doesn't work, try this more specific command:
-
- ```bash
- python -m playwright install chromium
- ```
-
-This second method has proven to be more reliable in some cases.
-
----
-
-### Installation with Synchronous Version
-
-The sync version is deprecated and will be removed in future versions. If you need the synchronous version using Selenium:
-
-```bash
-pip install crawl4ai[sync]
-```
-
----
-
-### Development Installation
-
-For contributors who plan to modify the source code:
-
-```bash
-git clone https://github.com/unclecode/crawl4ai.git
-cd crawl4ai
-pip install -e . # Basic installation in editable mode
-```
-
-Install optional features:
-
-```bash
-pip install -e ".[torch]" # With PyTorch features
-pip install -e ".[transformer]" # With Transformer features
-pip install -e ".[cosine]" # With cosine similarity features
-pip install -e ".[sync]" # With synchronous crawling (Selenium)
-pip install -e ".[all]" # Install all optional features
-```
-
-</details>
-
-<details>
-<summary>🐳 <strong>Docker Deployment</strong></summary>
-
-> 🚀 **Now Available!** Our completely redesigned Docker implementation is here! This new solution makes deployment more efficient and seamless than ever.
-
-### New Docker Features
-
-The new Docker implementation includes:
-- **Browser pooling** with page pre-warming for faster response times
-- **Interactive playground** to test and generate request code
-- **MCP integration** for direct connection to AI tools like Claude Code
-- **Comprehensive API endpoints** including HTML extraction, screenshots, PDF generation, and JavaScript execution
-- **Multi-architecture support** with automatic detection (AMD64/ARM64)
-- **Optimized resources** with improved memory management
-
-### Getting Started
-
-```bash
-# Pull and run the latest release candidate
-docker pull unclecode/crawl4ai:0.7.0
-docker run -d -p 11235:11235 --name crawl4ai --shm-size=1g unclecode/crawl4ai:0.7.0
-
-# Visit the playground at http://localhost:11235/playground
-```
-
-For complete documentation, see our [Docker Deployment Guide](https://docs.crawl4ai.com/core/docker-deployment/).
-
-</details>
-
----
-
-### Quick Test
-
-Run a quick test (works for both Docker options):
-
-```python
-import requests
-
-# Submit a crawl job
-response = requests.post(
- "http://localhost:11235/crawl",
- json={"urls": ["https://example.com"], "priority": 10}
-)
-if response.status_code == 200:
- print("Crawl job submitted successfully.")
-
-if "results" in response.json():
- results = response.json()["results"]
- print("Crawl job completed. Results:")
- for result in results:
- print(result)
-else:
- task_id = response.json()["task_id"]
- print(f"Crawl job submitted. Task ID:: {task_id}")
- result = requests.get(f"http://localhost:11235/task/{task_id}")
-```
-
-For more examples, see our [Docker Examples](https://github.com/unclecode/crawl4ai/blob/main/docs/examples/docker_example.py). For advanced configuration, environment variables, and usage examples, see our [Docker Deployment Guide](https://docs.crawl4ai.com/basic/docker-deployment/).
-
-</details>
-
-
-## 🔬 Advanced Usage Examples 🔬
-
-You can check the project structure in the directory [docs/examples](https://github.com/unclecode/crawl4ai/tree/main/docs/examples). Over there, you can find a variety of examples; here, some popular examples are shared.
-
-<details>
-<summary>📝 <strong>Heuristic Markdown Generation with Clean and Fit Markdown</strong></summary>
-
-```python
-import asyncio
-from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, CacheMode
-from crawl4ai.content_filter_strategy import PruningContentFilter, BM25ContentFilter
-from crawl4ai.markdown_generation_strategy import DefaultMarkdownGenerator
-
-async def main():
- browser_config = BrowserConfig(
- headless=True,
- verbose=True,
- )
- run_config = CrawlerRunConfig(
- cache_mode=CacheMode.ENABLED,
- markdown_generator=DefaultMarkdownGenerator(
- content_filter=PruningContentFilter(threshold=0.48, threshold_type="fixed", min_word_threshold=0)
- ),
- # markdown_generator=DefaultMarkdownGenerator(
- # content_filter=BM25ContentFilter(user_query="WHEN_WE_FOCUS_BASED_ON_A_USER_QUERY", bm25_threshold=1.0)
- # ),
- )
-
- async with AsyncWebCrawler(config=browser_config) as crawler:
- result = await crawler.arun(
- url="https://docs.micronaut.io/4.7.6/guide/",
- config=run_config
- )
- print(len(result.markdown.raw_markdown))
- print(len(result.markdown.fit_markdown))
-
-if __name__ == "__main__":
- asyncio.run(main())
-```
-
-</details>
-
-<details>
-<summary>🖥️ <strong>Executing JavaScript & Extract Structured Data without LLMs</strong></summary>
-
-```python
-import asyncio
-from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, CacheMode
-from crawl4ai import JsonCssExtractionStrategy
-import json
-
-async def main():
- schema = {
- "name": "KidoCode Courses",
- "baseSelector": "section.charge-methodology .w-tab-content > div",
- "fields": [
- {
- "name": "section_title",
- "selector": "h3.heading-50",
- "type": "text",
- },
- {
- "name": "section_description",
- "selector": ".charge-content",
- "type": "text",
- },
- {
- "name": "course_name",
- "selector": ".text-block-93",
- "type": "text",
- },
- {
- "name": "course_description",
- "selector": ".course-content-text",
- "type": "text",
- },
- {
- "name": "course_icon",
- "selector": ".image-92",
- "type": "attribute",
- "attribute": "src"
- }
- }
-}
-
- extraction_strategy = JsonCssExtractionStrategy(schema, verbose=True)
-
- browser_config = BrowserConfig(
- headless=False,
- verbose=True
- )
- run_config = CrawlerRunConfig(
- extraction_strategy=extraction_strategy,
- js_code=["""(async () => {const tabs = document.querySelectorAll("section.charge-methodology .tabs-menu-3 > div");for(let tab of tabs) {tab.scrollIntoView();tab.click();await new Promise(r => setTimeout(r, 500));}})();"""],
- cache_mode=CacheMode.BYPASS
- )
-
- async with AsyncWebCrawler(config=browser_config) as crawler:
-
- result = await crawler.arun(
- url="https://www.kidocode.com/degrees/technology",
- config=run_config
- )
-
- companies = json.loads(result.extracted_content)
- print(f"Successfully extracted {len(companies)} companies")
- print(json.dumps(companies[0], indent=2))
-
-
-if __name__ == "__main__":
- asyncio.run(main())
-```
-
-</details>
-
-<details>
-<summary>📚 <strong>Extracting Structured Data with LLMs</strong></summary>
-
-```python
-import os
-import asyncio
-from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, CacheMode, LLMConfig
-from crawl4ai import LLMExtractionStrategy
-from pydantic import BaseModel, Field
-
-class OpenAIModelFee(BaseModel):
- model_name: str = Field(..., description="Name of the OpenAI model.")
- input_fee: str = Field(..., description="Fee for input token for the OpenAI model.")
- output_fee: str = Field(..., description="Fee for output token for the OpenAI model.")
-
-async def main():
- browser_config = BrowserConfig(verbose=True)
- run_config = CrawlerRunConfig(
- word_count_threshold=1,
- extraction_strategy=LLMExtractionStrategy(
- # Here you can use any provider that Litellm library supports, for instance: ollama/qwen2
- # provider="ollama/qwen2", api_token="no-token",
- llm_config = LLMConfig(provider="openai/gpt-4o", api_token=os.getenv('OPENAI_API_KEY')),
- schema=OpenAIModelFee.schema(),
- extraction_type="schema",
- instruction="""From the crawled content, extract all mentioned model names along with their fees for input and output tokens.
- Do not miss any models in the entire content. One extracted model JSON format should look like this:
- {"model_name": "GPT-4", "input_fee": "US$10.00 / 1M tokens", "output_fee": "US$30.00 / 1M tokens"}."""
- ),
- cache_mode=CacheMode.BYPASS,
- )
-
- async with AsyncWebCrawler(config=browser_config) as crawler:
- result = await crawler.arun(
- url='https://openai.com/api/pricing/',
- config=run_config
- )
- print(result.extracted_content)
-
-if __name__ == "__main__":
- asyncio.run(main())
-```
-
-</details>
-
-<details>
-<summary>🤖 <strong>Using Your own Browser with Custom User Profile</strong></summary>
-
-```python
-import os, sys
-from pathlib import Path
-import asyncio, time
-from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, CacheMode
-
-async def test_news_crawl():
- # Create a persistent user data directory
- user_data_dir = os.path.join(Path.home(), ".crawl4ai", "browser_profile")
- os.makedirs(user_data_dir, exist_ok=True)
-
- browser_config = BrowserConfig(
- verbose=True,
- headless=True,
- user_data_dir=user_data_dir,
- use_persistent_context=True,
- )
- run_config = CrawlerRunConfig(
- cache_mode=CacheMode.BYPASS
- )
-
- async with AsyncWebCrawler(config=browser_config) as crawler:
- url = "ADDRESS_OF_A_CHALLENGING_WEBSITE"
-
- result = await crawler.arun(
- url,
- config=run_config,
- magic=True,
- )
-
- print(f"Successfully crawled {url}")
- print(f"Content length: {len(result.markdown)}")
-```
-
-</details>
-
-## ✨ Recent Updates
-
-### Version 0.7.0 Release Highlights - The Adaptive Intelligence Update
-
-- **🧠 Adaptive Crawling**: Your crawler now learns and adapts to website patterns automatically:
- ```python
- config = AdaptiveConfig(
- confidence_threshold=0.7, # Min confidence to stop crawling
- max_depth=5, # Maximum crawl depth
- max_pages=20, # Maximum number of pages to crawl
- strategy="statistical"
- )
-
- async with AsyncWebCrawler() as crawler:
- adaptive_crawler = AdaptiveCrawler(crawler, config)
- state = await adaptive_crawler.digest(
- start_url="https://news.example.com",
- query="latest news content"
- )
- # Crawler learns patterns and improves extraction over time
- ```
-
-- **🌊 Virtual Scroll Support**: Complete content extraction from infinite scroll pages:
- ```python
- scroll_config = VirtualScrollConfig(
- container_selector="[data-testid='feed']",
- scroll_count=20,
- scroll_by="container_height",
- wait_after_scroll=1.0
- )
-
- result = await crawler.arun(url, config=CrawlerRunConfig(
- virtual_scroll_config=scroll_config
- ))
- ```
-
-- **🔗 Intelligent Link Analysis**: 3-layer scoring system for smart link prioritization:
- ```python
- link_config = LinkPreviewConfig(
- query="machine learning tutorials",
- score_threshold=0.3,
- concurrent_requests=10
- )
-
- result = await crawler.arun(url, config=CrawlerRunConfig(
- link_preview_config=link_config,
- score_links=True
- ))
- # Links ranked by relevance and quality
- ```
-
-- **🎣 Async URL Seeder**: Discover thousands of URLs in seconds:
- ```python
- seeder = AsyncUrlSeeder(SeedingConfig(
- source="sitemap+cc",
- pattern="*/blog/*",
- query="python tutorials",
- score_threshold=0.4
- ))
-
- urls = await seeder.discover("https://example.com")
- ```
-
-- **⚡ Performance Boost**: Up to 3x faster with optimized resource handling and memory efficiency
-
-Read the full details in our [0.7.0 Release Notes](https://docs.crawl4ai.com/blog/release-v0.7.0) or check the [CHANGELOG](https://github.com/unclecode/crawl4ai/blob/main/CHANGELOG.md).
-
-## Version Numbering in Crawl4AI
-
-Crawl4AI follows standard Python version numbering conventions (PEP 440) to help users understand the stability and features of each release.
-
-### Version Numbers Explained
-
-Our version numbers follow this pattern: `MAJOR.MINOR.PATCH` (e.g., 0.4.3)
-
-#### Pre-release Versions
-We use different suffixes to indicate development stages:
-
-- `dev` (0.4.3dev1): Development versions, unstable
-- `a` (0.4.3a1): Alpha releases, experimental features
-- `b` (0.4.3b1): Beta releases, feature complete but needs testing
-- `rc` (0.4.3): Release candidates, potential final version
-
-#### Installation
-- Regular installation (stable version):
- ```bash
- pip install -U crawl4ai
- ```
-
-- Install pre-release versions:
- ```bash
- pip install crawl4ai --pre
- ```
-
-- Install specific version:
- ```bash
- pip install crawl4ai==0.4.3b1
- ```
-
-#### Why Pre-releases?
-We use pre-releases to:
-- Test new features in real-world scenarios
-- Gather feedback before final releases
-- Ensure stability for production users
-- Allow early adopters to try new features
-
-For production environments, we recommend using the stable version. For testing new features, you can opt-in to pre-releases using the `--pre` flag.
-
-## 📖 Documentation & Roadmap
-
-> 🚨 **Documentation Update Alert**: We're undertaking a major documentation overhaul next week to reflect recent updates and improvements. Stay tuned for a more comprehensive and up-to-date guide!
-
-For current documentation, including installation instructions, advanced features, and API reference, visit our [Documentation Website](https://docs.crawl4ai.com/).
-
-To check our development plans and upcoming features, visit our [Roadmap](https://github.com/unclecode/crawl4ai/blob/main/ROADMAP.md).
-
-<details>
-<summary>📈 <strong>Development TODOs</strong></summary>
-
-- [x] 0. Graph Crawler: Smart website traversal using graph search algorithms for comprehensive nested page extraction
-- [ ] 1. Question-Based Crawler: Natural language driven web discovery and content extraction
-- [ ] 2. Knowledge-Optimal Crawler: Smart crawling that maximizes knowledge while minimizing data extraction
-- [ ] 3. Agentic Crawler: Autonomous system for complex multi-step crawling operations
-- [ ] 4. Automated Schema Generator: Convert natural language to extraction schemas
-- [ ] 5. Domain-Specific Scrapers: Pre-configured extractors for common platforms (academic, e-commerce)
-- [ ] 6. Web Embedding Index: Semantic search infrastructure for crawled content
-- [ ] 7. Interactive Playground: Web UI for testing, comparing strategies with AI assistance
-- [ ] 8. Performance Monitor: Real-time insights into crawler operations
-- [ ] 9. Cloud Integration: One-click deployment solutions across cloud providers
-- [ ] 10. Sponsorship Program: Structured support system with tiered benefits
-- [ ] 11. Educational Content: "How to Crawl" video series and interactive tutorials
-
-</details>
-
-## 🤝 Contributing
-
-We welcome contributions from the open-source community. Check out our [contribution guidelines](https://github.com/unclecode/crawl4ai/blob/main/CONTRIBUTORS.md) for more information.
-
-I'll help modify the license section with badges. For the halftone effect, here's a version with it:
-
-Here's the updated license section:
-
-## 📄 License & Attribution
-
-This project is licensed under the Apache License 2.0, attribution is recommended via the badges below. See the [Apache 2.0 License](https://github.com/unclecode/crawl4ai/blob/main/LICENSE) file for details.
-
-### Attribution Requirements
-When using Crawl4AI, you must include one of the following attribution methods:
-
-#### 1. Badge Attribution (Recommended)
-Add one of these badges to your README, documentation, or website:
-
-| Theme | Badge |
-|-------|-------|
-| **Disco Theme (Animated)** | <a href="https://github.com/unclecode/crawl4ai"><img src="./docs/assets/powered-by-disco.svg" alt="Powered by Crawl4AI" width="200"/></a> |
-| **Night Theme (Dark with Neon)** | <a href="https://github.com/unclecode/crawl4ai"><img src="./docs/assets/powered-by-night.svg" alt="Powered by Crawl4AI" width="200"/></a> |
-| **Dark Theme (Classic)** | <a href="https://github.com/unclecode/crawl4ai"><img src="./docs/assets/powered-by-dark.svg" alt="Powered by Crawl4AI" width="200"/></a> |
-| **Light Theme (Classic)** | <a href="https://github.com/unclecode/crawl4ai"><img src="./docs/assets/powered-by-light.svg" alt="Powered by Crawl4AI" width="200"/></a> |
-
-
-HTML code for adding the badges:
-```html
-<!-- Disco Theme (Animated) -->
-<a href="https://github.com/unclecode/crawl4ai">
- <img src="https://raw.githubusercontent.com/unclecode/crawl4ai/main/docs/assets/powered-by-disco.svg" alt="Powered by Crawl4AI" width="200"/>
-</a>
-
-<!-- Night Theme (Dark with Neon) -->
-<a href="https://github.com/unclecode/crawl4ai">
- <img src="https://raw.githubusercontent.com/unclecode/crawl4ai/main/docs/assets/powered-by-night.svg" alt="Powered by Crawl4AI" width="200"/>
-</a>
-
-<!-- Dark Theme (Classic) -->
-<a href="https://github.com/unclecode/crawl4ai">
- <img src="https://raw.githubusercontent.com/unclecode/crawl4ai/main/docs/assets/powered-by-dark.svg" alt="Powered by Crawl4AI" width="200"/>
-</a>
-
-<!-- Light Theme (Classic) -->
-<a href="https://github.com/unclecode/crawl4ai">
- <img src="https://raw.githubusercontent.com/unclecode/crawl4ai/main/docs/assets/powered-by-light.svg" alt="Powered by Crawl4AI" width="200"/>
-</a>
-
-<!-- Simple Shield Badge -->
-<a href="https://github.com/unclecode/crawl4ai">
- <img src="https://img.shields.io/badge/Powered%20by-Crawl4AI-blue?style=flat-square" alt="Powered by Crawl4AI"/>
-</a>
-```
-
-#### 2. Text Attribution
-Add this line to your documentation:
-```
-This project uses Crawl4AI (https://github.com/unclecode/crawl4ai) for web data extraction.
-```
-
-## 📚 Citation
-
-If you use Crawl4AI in your research or project, please cite:
-
-```bibtex
-@software{crawl4ai2024,
- author = {UncleCode},
- title = {Crawl4AI: Open-source LLM Friendly Web Crawler & Scraper},
- year = {2024},
- publisher = {GitHub},
- journal = {GitHub Repository},
- howpublished = {\url{https://github.com/unclecode/crawl4ai}},
- commit = {Please use the commit hash you're working with}
-}
-```
-
-Text citation format:
-```
-UncleCode. (2024). Crawl4AI: Open-source LLM Friendly Web Crawler & Scraper [Computer software].
-GitHub. https://github.com/unclecode/crawl4ai
-```
-
-## 📧 Contact
-
-For questions, suggestions, or feedback, feel free to reach out:
-
-- GitHub: [unclecode](https://github.com/unclecode)
-- Twitter: [@unclecode](https://twitter.com/unclecode)
-- Website: [crawl4ai.com](https://crawl4ai.com)
-
-Happy Crawling! 🕸️🚀
-
-## 💖 Support Crawl4AI
-
-> 🎉 **Sponsorship Program Just Launched!** Be among the first 50 **Founding Sponsors** and get permanent recognition in our Hall of Fame!
-
-Crawl4AI is the #1 trending open-source web crawler with 51K+ stars. Your support ensures we stay independent, innovative, and free forever.
-
-<div align="center">
-
-[![Become a Sponsor](https://img.shields.io/badge/Become%20a%20Sponsor-pink?style=for-the-badge&logo=github-sponsors&logoColor=white)](https://github.com/sponsors/unclecode)
-[![Current Sponsors](https://img.shields.io/github/sponsors/unclecode?style=for-the-badge&logo=github&label=Current%20Sponsors&color=green)](https://github.com/sponsors/unclecode)
-
-</div>
-
-### 🤝 Sponsorship Tiers
-
-- **🌱 Believer ($5/mo)**: Join the movement for data democratization
-- **🚀 Builder ($50/mo)**: Get priority support and early feature access
-- **💼 Growing Team ($500/mo)**: Bi-weekly syncs and optimization help
-- **🏢 Data Infrastructure Partner ($2000/mo)**: Full partnership with dedicated support
-
-**Why sponsor?** Every tier includes real benefits. No more rate-limited APIs. Own your data pipeline. Build data sovereignty together.
-
-[View All Tiers & Benefits →](https://github.com/sponsors/unclecode)
-
-### 🏆 Our Sponsors
-
-#### 👑 Founding Sponsors (First 50)
-*Be part of history - [Become a Founding Sponsor](https://github.com/sponsors/unclecode)*
-
-<!-- Founding sponsors will be permanently recognized here -->
-
-#### Current Sponsors
-Thank you to all our sponsors who make this project possible!
-
-<!-- Sponsors will be automatically added here -->
-
-## 🗾 Mission
-
-Our mission is to unlock the value of personal and enterprise data by transforming digital footprints into structured, tradeable assets. Crawl4AI empowers individuals and organizations with open-source tools to extract and structure data, fostering a shared data economy.
-
-We envision a future where AI is powered by real human knowledge, ensuring data creators directly benefit from their contributions. By democratizing data and enabling ethical sharing, we are laying the foundation for authentic AI advancement.
-
-<details>
-<summary>🔑 <strong>Key Opportunities</strong></summary>
-
-- **Data Capitalization**: Transform digital footprints into measurable, valuable assets.
-- **Authentic AI Data**: Provide AI systems with real human insights.
-- **Shared Economy**: Create a fair data marketplace that benefits data creators.
-
-</details>
-
-<details>
-<summary>🚀 <strong>Development Pathway</strong></summary>
-
-1. **Open-Source Tools**: Community-driven platforms for transparent data extraction.
-2. **Digital Asset Structuring**: Tools to organize and value digital knowledge.
-3. **Ethical Data Marketplace**: A secure, fair platform for exchanging structured data.
-
-For more details, see our [full mission statement](./MISSION.md).
-</details>
-
-## Star History
-
-[![Star History Chart](https://api.star-history.com/svg?repos=unclecode/crawl4ai&type=Date)](https://star-history.com/#unclecode/crawl4ai&Date)
diff --git a/README.md b/README.md
index 01bd9900..bde3faf5 100644
--- a/README.md
+++ b/README.md
@@ -1,1163 +1,374 @@
-# 🚀🤖 Crawl4AI: Open-source LLM Friendly Web Crawler & Scraper.
+# 🚀🤖 Crawl4AI: the open-source web crawler for LLMs and AI agents
<div align="center">
<a href="https://trendshift.io/repositories/11716" target="_blank"><img src="https://trendshift.io/api/badge/repositories/11716" alt="unclecode%2Fcrawl4ai | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
[![GitHub Stars](https://img.shields.io/github/stars/unclecode/crawl4ai?style=social)](https://github.com/unclecode/crawl4ai/stargazers)
-[![GitHub Forks](https://img.shields.io/github/forks/unclecode/crawl4ai?style=social)](https://github.com/unclecode/crawl4ai/network/members)
-
[![PyPI version](https://badge.fury.io/py/crawl4ai.svg)](https://badge.fury.io/py/crawl4ai)
-[![Python Version](https://img.shields.io/pypi/pyversions/crawl4ai)](https://pypi.org/project/crawl4ai/)
[![Downloads](https://static.pepy.tech/badge/crawl4ai/month)](https://pepy.tech/project/crawl4ai)
-[![GitHub Sponsors](https://img.shields.io/github/sponsors/unclecode?style=flat&logo=GitHub-Sponsors&label=Sponsors&color=pink)](https://github.com/sponsors/unclecode)
-
----
-#### ☁️ Crawl4AI Cloud is live — the same crawler, hosted
-No browsers to run, no proxies to buy, no cookies to babysit. One key with **your first $10 pack on us** (until 31 December 2026, then $5 to start; no card), and your AI agent can search, scrape, crawl and extract the web through the engine you already use. Works in Claude Code, Codex, OpenCode and Cursor with one pasted line.
+[![Discord](https://img.shields.io/badge/Discord-join%20us-5865F2?logo=discord&logoColor=white)](https://discord.gg/jP8KfhDhyN)
+[![Crawl4AI Cloud](https://img.shields.io/badge/Crawl4AI_Cloud-try_it_free-f5a300?style=flat&labelColor=0d0d10)](https://crawl4ai.com/?ref=readme-badge)
-👉 **[Get a key in 10 seconds](https://crawl4ai.com/?ref=readme)** · [Cloud docs](https://crawl4ai.com/docs?ref=readme)
-_The library stays open source, forever. The cloud is for the days you want to build fast and let us run the infrastructure._
+**Latest: [v0.9.4](https://github.com/unclecode/crawl4ai/releases/tag/v0.9.4) (23 Sep 2026)** · [all releases →](https://github.com/unclecode/crawl4ai/releases)
----
+<a href="https://crawl4ai.com/?ref=readme-banner">
+ <picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/unclecode/crawl4ai/main/docs/assets/cloud-launch-banner-dark.svg">
+ <img alt="Crawl4AI Cloud is live. Soft launch: your first $10 is on us until 31 December 2026, no card. Get your key." src="https://raw.githubusercontent.com/unclecode/crawl4ai/main/docs/assets/cloud-launch-banner-light.svg" width="960">
+ </picture>
+</a>
-<p align="center">
- <a href="https://x.com/crawl4ai">
- <img src="https://img.shields.io/badge/Follow%20on%20X-000000?style=for-the-badge&logo=x&logoColor=white" alt="Follow on X" />
- </a>
- <a href="https://www.linkedin.com/company/crawl4ai">
- <img src="https://img.shields.io/badge/Follow%20on%20LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" alt="Follow on LinkedIn" />
- </a>
- <a href="https://discord.gg/jP8KfhDhyN">
- <img src="https://img.shields.io/badge/Join%20our%20Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join our Discord" />
- </a>
- </p>
</div>
-Crawl4AI turns the web into clean, LLM ready Markdown for RAG, agents, and data pipelines. Fast, controllable, battle tested by a 50k+ star community.
-
-[✨ Check out latest update v0.9.4](#-recent-updates)
-
-✨ **New in v0.9.4**: Security release. Closes three coordinated-disclosure advisories: two SSRF paths (robots.txt and link preview) that bypassed the Docker server's egress controls, and a config trust-boundary bypass that leaked server environment variables. Also adds `PruningContentFilterLXML`, about 10x faster pruning, now the default. No breaking changes. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.4.md)
-
-✨ Recent v0.9.3: Security release. Closes five coordinated-disclosure advisories: arbitrary file write, SSRF, and denial of service in the PDF processing path, plus two XSS issues in the Docker Playground. Also ships 33 bug fixes across the Docker server, crawler, and PDF handling. No new features, no breaking changes. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.3.md)
-
-✨ Recent v0.9.2: Maintenance patch release. Fixes a `MemoryAdaptiveDispatcher` task/page leak when a streaming crawl is closed, Docker Playground "Advanced Config" and Monitor WebSocket auth, Playwright headless-shell packaging, and GPU (`ENABLE_GPU=true`) Docker builds. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.2.md)
-
-✨ Recent v0.9.0: Major secure-by-default release of the Docker API server. Auth is on by default, the server binds loopback unless given a token, and the request body is now an untrusted trust boundary. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.0.md)
-
-✨ Recent v0.8.7: Security-hardening release. Fixes critical Docker API vulnerabilities (RCE, SSRF, auth bypass, file write, XSS, hardcoded JWT secret), adds DomainMapper, and ships scraping, deep-crawl, and LLM fixes. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.7.md)
-
-✨ 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)
-
-✨ Previous v0.7.8: Stability & Bug Fix Release! 11 bug fixes addressing Docker API issues, LLM extraction improvements, URL handling fixes, and dependency updates. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.8.md)
-
-<details>
- <summary>🤓 <strong>My Personal Story</strong></summary>
-
-I grew up on an Amstrad, thanks to my dad, and never stopped building. In grad school I specialized in NLP and built crawlers for research. That’s where I learned how much extraction matters.
-
-In 2023, I needed web-to-Markdown. The “open source” option wanted an account, API token, and $16, and still under-delivered. I went turbo anger mode, built Crawl4AI in days, and it went viral. Now it’s the most-starred crawler on GitHub.
-
-I made it open source for **availability**, anyone can use it without a gate. Now I’m building the platform for **affordability**, anyone can run serious crawls without breaking the bank. If that resonates, join in, send feedback, or just crawl something amazing.
-</details>
-
+Crawl4AI turns any website into clean, LLM-ready Markdown for RAG, AI agents and data pipelines. Run the open-source web crawler and scraper yourself, free forever, or use it hosted with one key: scrape, search and extract through one API, with MCP for your agent.
-<details>
- <summary>Why developers pick Crawl4AI</summary>
-
-- **LLM ready output**, smart Markdown with headings, tables, code, citation hints
-- **Fast in practice**, async browser pool, caching, minimal hops
-- **Full control**, sessions, proxies, cookies, user scripts, hooks
-- **Adaptive intelligence**, learns site patterns, explores only what matters
-- **Deploy anywhere**, zero keys, CLI and Docker, cloud friendly
-</details>
+## Two ways to use Crawl4AI
+### 🐍 Run it yourself: open source, forever
-## 🚀 Quick Start
-
-1. Install Crawl4AI:
```bash
-# Install the package
pip install -U crawl4ai
-
-# For pre release versions
-pip install crawl4ai --pre
-
-# Run post-installation setup
-crawl4ai-setup
-
-# Verify your installation
-crawl4ai-doctor
+crawl4ai-setup # installs the browser, once
```
-If you encounter any browser-related issues, you can install them manually:
-```bash
-python -m playwright install --with-deps chromium
-```
-
-2. Run a simple web crawl with Python:
```python
import asyncio
-from crawl4ai import *
+from crawl4ai import AsyncWebCrawler
async def main():
async with AsyncWebCrawler() as crawler:
- result = await crawler.arun(
- url="https://www.nbcnews.com/business",
- )
+ result = await crawler.arun(url="https://news.ycombinator.com")
print(result.markdown)
-if __name__ == "__main__":
- asyncio.run(main())
+asyncio.run(main())
```
-3. Or use the new command-line interface:
-```bash
-# Basic crawl with markdown output
-crwl https://www.nbcnews.com/business -o markdown
+Docker server, CLI and every option: [Installation](#installation) · [docs.crawl4ai.com](https://docs.crawl4ai.com)
-# Deep crawl with BFS strategy, max 10 pages
-crwl https://docs.crawl4ai.com --deep-crawl bfs --max-pages 10
+### ☁️ Or use the cloud: no browsers, no proxies
-# Use LLM extraction with a specific question
-crwl https://www.example.com/products -q "Extract all product prices"
-```
-
-## 💖 Support Crawl4AI
+1. [![Get a key in 10 seconds](https://img.shields.io/badge/Get_a_key_in_10_seconds-%241_pass%2C_no_signup-f5a300?style=for-the-badge&labelColor=0d0d10)](https://crawl4ai.com/?ref=readme)
+ Verify your email and your first $10 pack is on us (until 31 December 2026, then $5 to start). No card.
+2. Get any page as Markdown:
-> 🎉 **Sponsorship Program Now Open!** After powering 51K+ developers and 1 year of growth, Crawl4AI is launching dedicated support for **startups** and **enterprises**. Be among the first 50 **Founding Sponsors** for permanent recognition in our Hall of Fame.
+ ```bash
+ curl -s https://api.crawl4ai.com/scrape \
+ -H "Authorization: Bearer $CRAWL4AI_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{"url": "https://news.ycombinator.com"}' | jq -r .markdown
+ ```
-Crawl4AI is the #1 trending open-source web crawler on GitHub. Your support keeps it independent, innovative, and free for the community — while giving you direct access to premium benefits.
+ The same key works for `/search`, `/answer`, `/extract` and many URLs at once (`/scrape/batch`, `/scrape/jobs`). Pay as you go: [live prices](https://crawl4ai.com/docs?ref=readme#pricing).
+3. Give it to your AI agent. Claude Code shown; [Codex, Cursor and OpenCode →](https://crawl4ai.com/docs?ref=readme#mcp)
-<div align="">
-
-[![Become a Sponsor](https://img.shields.io/badge/Become%20a%20Sponsor-pink?style=for-the-badge&logo=github-sponsors&logoColor=white)](https://github.com/sponsors/unclecode)
-[![Current Sponsors](https://img.shields.io/github/sponsors/unclecode?style=for-the-badge&logo=github&label=Current%20Sponsors&color=green)](https://github.com/sponsors/unclecode)
+ ```bash
+ claude mcp add --transport http crawl4ai https://api.crawl4ai.com/mcp \
+ --header "Authorization: Bearer $CRAWL4AI_KEY"
+ ```
-</div>
+### Which one?
-### 🤝 Sponsorship Tiers
+| | 🐍 Library | 🐳 Your own server | ☁️ Crawl4AI Cloud |
+|---|---|---|---|
+| **Runs the browsers** | you, in your Python process | you, in Docker on your machine | we do |
+| **JS-heavy pages and bot walls** | your settings, your proxies | your settings, your proxies | handled for you, automatically |
+| **Web search** | – | – | `/search` and `/answer` |
+| **Price** | free, forever | free (your hosting) | pay as you go; your first $10 is on us |
-- **🌱 Believer ($5/mo)** — Join the movement for data democratization
-- **🚀 Builder ($50/mo)** — Priority support & early access to features
-- **💼 Growing Team ($500/mo)** — Bi-weekly syncs & optimization help
-- **🏢 Data Infrastructure Partner ($2000/mo)** — Full partnership with dedicated support
- *Custom arrangements available - see [SPONSORS.md](SPONSORS.md) for details & contact*
+<details>
+ <summary>🤓 <strong>My Personal Story</strong></summary>
-**Why sponsor?**
-No rate-limited APIs. No lock-in. Build and own your data pipeline with direct guidance from the creator of Crawl4AI.
+I grew up on an Amstrad, thanks to my dad, and never stopped building. In grad school I specialized in NLP and built crawlers for research. That’s where I learned how much extraction matters.
-[See All Tiers & Benefits →](https://github.com/sponsors/unclecode)
+In 2023, I needed web-to-Markdown. The “open source” option wanted an account, API token, and $16, and still under-delivered. I went turbo anger mode, built Crawl4AI in days, and it went viral. Now it’s the most-starred crawler on GitHub.
+I made it open source for **availability**, anyone can use it without a gate. Now I’m building the platform for **affordability**, anyone can run serious crawls without breaking the bank. If that resonates, join in, send feedback, or just crawl something amazing.
-## ✨ Features
+That platform is live now: [Crawl4AI Cloud](https://crawl4ai.com/?ref=readme).
+</details>
<details>
-<summary>📝 <strong>Markdown Generation</strong></summary>
+ <summary>Why developers pick Crawl4AI</summary>
-- 🧹 **Clean Markdown**: Generates clean, structured Markdown with accurate formatting.
-- 🎯 **Fit Markdown**: Heuristic-based filtering to remove noise and irrelevant parts for AI-friendly processing.
-- 🔗 **Citations and References**: Converts page links into a numbered reference list with clean citations.
-- 🛠️ **Custom Strategies**: Users can create their own Markdown generation strategies tailored to specific needs.
-- 📚 **BM25 Algorithm**: Employs BM25-based filtering for extracting core information and removing irrelevant content.
+- **LLM-ready output**: smart Markdown with headings, tables, code and citation hints
+- **Fast in practice**: async browser pool, caching, minimal hops
+- **Full control**: sessions, proxies, cookies, user scripts, hooks
+- **Adaptive intelligence**: learns site patterns, explores only what matters
+- **Deploy anywhere**: no keys needed, CLI and Docker, or the hosted cloud
</details>
+## ✨ Features
+
<details>
-<summary>📊 <strong>Structured Data Extraction</strong></summary>
+<summary>📝 <strong>Markdown generation</strong></summary>
-- 🤖 **LLM-Driven Extraction**: Supports all LLMs (open-source and proprietary) for structured data extraction.
-- 🧱 **Chunking Strategies**: Implements chunking (topic-based, regex, sentence-level) for targeted content processing.
-- 🌌 **Cosine Similarity**: Find relevant content chunks based on user queries for semantic extraction.
-- 🔎 **CSS-Based Extraction**: Fast schema-based data extraction using XPath and CSS selectors.
-- 🔧 **Schema Definition**: Define custom schemas for extracting structured JSON from repetitive patterns.
+- 🧹 **Clean Markdown**: headings, lists, tables and code blocks, in a structure an LLM reads well.
+- 🎯 **Fit Markdown**: filters remove menus, footers and boilerplate: `PruningContentFilterLXML`, `BM25ContentFilter` (for a query) and `LLMContentFilter`.
+- 🔗 **Citations**: page links become a numbered reference list.
+- 🛠️ **Your own strategy**: plug in a custom Markdown generator.
+☁️ Same in the cloud: `POST /scrape` returns this Markdown, with no browser to run. [Docs →](https://crawl4ai.com/docs?ref=readme#scrape)
</details>
<details>
-<summary>🌐 <strong>Browser Integration</strong></summary>
+<summary>📊 <strong>Structured data extraction</strong></summary>
-- 🖥️ **Managed Browser**: Use user-owned browsers with full control, avoiding bot detection.
-- 🔄 **Remote Browser Control**: Connect to Chrome Developer Tools Protocol for remote, large-scale data extraction.
-- 👤 **Browser Profiler**: Create and manage persistent profiles with saved authentication states, cookies, and settings.
-- 🔒 **Session Management**: Preserve browser states and reuse them for multi-step crawling.
-- 🧩 **Proxy Support**: Seamlessly connect to proxies with authentication for secure access.
-- ⚙️ **Full Browser Control**: Modify headers, cookies, user agents, and more for tailored crawling setups.
-- 🌍 **Multi-Browser Support**: Compatible with Chromium, Firefox, and WebKit.
-- 📐 **Dynamic Viewport Adjustment**: Automatically adjusts the browser viewport to match page content, ensuring complete rendering and capturing of all elements.
+- 🔎 **CSS and XPath schemas**: fast extraction with no LLM (`JsonCssExtractionStrategy`, `JsonXPathExtractionStrategy`, `RegexExtractionStrategy`).
+- 🪄 **Schema generator**: describe what you want once; `generate_schema` writes a reusable schema.
+- 🤖 **LLM extraction**: any LLM provider, open-source or hosted, into a typed JSON schema (`LLMExtractionStrategy`).
+- 🧱 **Chunking**: topic, regex and sentence chunking for long pages.
+- 🌌 **Cosine similarity**: find the chunks that match a query (`CosineStrategy`).
+☁️ Same in the cloud: `POST /extract`, with no LLM key of your own. [Docs →](https://crawl4ai.com/docs?ref=readme#extract)
</details>
<details>
-<summary>🔎 <strong>Crawling & Scraping</strong></summary>
-
-- 🖼️ **Media Support**: Extract images, audio, videos, and responsive image formats like `srcset` and `picture`.
-- 🚀 **Dynamic Crawling**: Execute JS and wait for async or sync for dynamic content extraction.
-- 📸 **Screenshots**: Capture page screenshots during crawling for debugging or analysis.
-- 📂 **Raw Data Crawling**: Directly process raw HTML (`raw:`) or local files (`file://`).
-- 🔗 **Comprehensive Link Extraction**: Extracts internal, external links, and embedded iframe content.
-- 🛠️ **Customizable Hooks**: Define hooks at every step to customize crawling behavior (supports both string and function-based APIs).
-- 💾 **Caching**: Cache data for improved speed and to avoid redundant fetches.
-- 📄 **Metadata Extraction**: Retrieve structured metadata from web pages.
-- 📡 **IFrame Content Extraction**: Seamless extraction from embedded iframe content.
-- 🕵️ **Lazy Load Handling**: Waits for images to fully load, ensuring no content is missed due to lazy loading.
-- 🔄 **Full-Page Scanning**: Simulates scrolling to load and capture all dynamic content, perfect for infinite scroll pages.
+<summary>🌐 <strong>Browser control</strong></summary>
+- 🖥️ **Your own browser**: persistent profiles with saved logins, cookies and settings.
+- 🔄 **Remote browsers**: connect over the Chrome DevTools Protocol (CDP).
+- 🔒 **Sessions**: keep a browser state across multi-step crawls.
+- 🧩 **Proxies**: with authentication and rotation.
+- 🕶️ **Stealth mode**: `enable_stealth`, and an undetected-browser adapter for sites that detect automation.
+- ⚙️ **Full control**: headers, cookies, user agents, viewport.
+- 🌍 **Chromium, Firefox and WebKit**.
</details>
<details>
-<summary>🚀 <strong>Deployment</strong></summary>
+<summary>🔎 <strong>Crawling and scraping</strong></summary>
-- 🐳 **Dockerized Setup**: Optimized Docker image with FastAPI server for easy deployment.
-- 🔑 **Secure Authentication**: Built-in JWT token authentication for API security.
-- 🔄 **API Gateway**: One-click deployment with secure token authentication for API-based workflows.
-- 🌐 **Scalable Architecture**: Designed for mass-scale production and optimized server performance.
-- ☁️ **Cloud Deployment**: Ready-to-deploy configurations for major cloud platforms.
+- 🕸️ **Deep crawl**: BFS, DFS and best-first strategies, with crash recovery (`resume_state`) for long crawls.
+- 🧠 **Adaptive crawling**: `AdaptiveCrawler` stops when it has learned enough to answer your query.
+- 🌱 **URL discovery**: `AsyncUrlSeeder` (sitemaps, Common Crawl) and `DomainMapper`; `prefetch=True` finds URLs 5 to 10 times faster.
+- 🚀 **Dynamic pages**: run JavaScript, wait for elements, scroll the full page (`scan_full_page`) for infinite scroll and lazy images.
+- 📸 **Screenshots and PDFs** of any page.
+- 🖼️ **Media and links**: images, audio, video, `srcset`, internal and external links, iframes, metadata.
+- 📂 **Raw HTML and local files**: `raw:` and `file://`.
+- 🛠️ **Hooks** at every step of a crawl.
+- 💾 **Caching** to skip repeated fetches.
+- ⚡ **Many URLs at once**: `arun_many` with a memory-adaptive dispatcher.
+☁️ Same in the cloud: up to 50 URLs in one streamed call, or 10,000 in a background job. [Docs →](https://crawl4ai.com/docs?ref=readme#batch)
</details>
<details>
-<summary>🎯 <strong>Additional Features</strong></summary>
+<summary>🐳 <strong>Self-hosting (Docker)</strong></summary>
-- 🕶️ **Stealth Mode**: Avoid bot detection by mimicking real users.
-- 🏷️ **Tag-Based Content Extraction**: Refine crawling based on custom tags, headers, or metadata.
-- 🔗 **Link Analysis**: Extract and analyze all links for detailed data exploration.
-- 🛡️ **Error Handling**: Robust error management for seamless execution.
-- 🔐 **CORS & Static Serving**: Supports filesystem-based caching and cross-origin requests.
-- 📖 **Clear Documentation**: Simplified and updated guides for onboarding and advanced usage.
-- 🙌 **Community Recognition**: Acknowledges contributors and pull requests for transparency.
+- 🔐 **Secure by default**: every endpoint needs your `CRAWL4AI_API_TOKEN`.
+- 🧰 **REST API**: `/md`, `/html`, `/crawl`, `/crawl/stream`, `/screenshot`, `/pdf`, `/execute_js`.
+- 🤖 **MCP**: connect Claude Code and other agents to your own server.
+- 📊 **Monitoring dashboard and playground**, a browser pool with pre-warmed pages.
+- 🏗️ **AMD64 and ARM64** images.
+☁️ Rather not run a server? The cloud is the same idea, hosted. [Get a key →](https://crawl4ai.com/?ref=readme)
</details>
-## Try it Now!
-
-✨ Play around with this [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1SgRPrByQLzjRfwoRNq1wSGE9nYY_EE8C?usp=sharing)
+<details>
+<summary>☁️ <strong>What the cloud adds</strong></summary>
-✨ Visit our [Documentation Website](https://docs.crawl4ai.com/)
+- 🔍 **Web search API**: `GET /search`, browser-free, ranked and cleaned. [Docs →](https://crawl4ai.com/docs?ref=readme#search)
+- 💬 **Answers**: `GET /answer` gives a direct answer to a question (experimental). [Docs →](https://crawl4ai.com/docs?ref=readme#answer)
+- 🧪 **Extraction without your own LLM key**: `POST /extract`. [Docs →](https://crawl4ai.com/docs?ref=readme#extract)
+- 🧗 **JS-heavy pages and bot walls**: handled automatically; you never pick an engine. [Docs →](https://crawl4ai.com/docs?ref=readme#scrape)
+- 🤝 **MCP for your agent**: one line in Claude Code, Codex, Cursor or OpenCode. [Docs →](https://crawl4ai.com/docs?ref=readme#mcp)
+</details>
-## Installation 🛠️
+<a id="installation"></a>
-Crawl4AI offers flexible installation options to suit various use cases. You can install it as a Python package or use Docker.
+## 🛠️ Installation
<details>
-<summary>🐍 <strong>Using pip</strong></summary>
-
-Choose the installation option that best fits your needs:
-
-### Basic Installation
-
-For basic web crawling and scraping tasks:
+<summary>🐍 <strong>pip</strong></summary>
```bash
-pip install crawl4ai
-crawl4ai-setup # Setup the browser
+pip install -U crawl4ai
+crawl4ai-setup # installs and sets up the browser
+crawl4ai-doctor # checks the installation
```
-By default, this will install the asynchronous version of Crawl4AI, using Playwright for web crawling.
-
-👉 **Note**: When you install Crawl4AI, the `crawl4ai-setup` should automatically install and set up Playwright. However, if you encounter any Playwright-related errors, you can manually install it using one of these methods:
-
-1. Through the command line:
-
- ```bash
- playwright install
- ```
-
-2. If the above doesn't work, try this more specific command:
-
- ```bash
- python -m playwright install chromium
- ```
-
-This second method has proven to be more reliable in some cases.
-
----
-
-### Installation with Synchronous Version
-
-The sync version is deprecated and will be removed in future versions. If you need the synchronous version using Selenium:
+If the browser setup fails, install it by hand:
```bash
-pip install crawl4ai[sync]
+python -m playwright install --with-deps chromium
```
----
-
-### Development Installation
+Pre-release versions: `pip install crawl4ai --pre`
-For contributors who plan to modify the source code:
+**Development install**, for contributors:
```bash
git clone https://github.com/unclecode/crawl4ai.git
cd crawl4ai
-pip install -e . # Basic installation in editable mode
+pip install -e ".[all]" # or: pip install -e . (the core only)
```
-
-Install optional features:
-
-```bash
-pip install -e ".[torch]" # With PyTorch features
-pip install -e ".[transformer]" # With Transformer features
-pip install -e ".[cosine]" # With cosine similarity features
-pip install -e ".[sync]" # With synchronous crawling (Selenium)
-pip install -e ".[all]" # Install all optional features
-```
-
</details>
<details>
-<summary>🐳 <strong>Docker Deployment</strong></summary>
+<summary>🐳 <strong>Docker server</strong></summary>
-> 🚀 **Now Available!** Our completely redesigned Docker implementation is here! This new solution makes deployment more efficient and seamless than ever.
+The server needs a token. Without one it answers only inside its container.
-### New Docker Features
-
-The new Docker implementation includes:
-- **Real-time Monitoring Dashboard** with live system metrics and browser pool visibility
-- **Browser pooling** with page pre-warming for faster response times
-- **Interactive playground** to test and generate request code
-- **MCP integration** for direct connection to AI tools like Claude Code
-- **Comprehensive API endpoints** including HTML extraction, screenshots, PDF generation, and JavaScript execution
-- **Multi-architecture support** with automatic detection (AMD64/ARM64)
-- **Optimized resources** with improved memory management
+```bash
+export CRAWL4AI_API_TOKEN="$(openssl rand -hex 32)"
+docker run -d -p 11235:11235 --name crawl4ai --shm-size=1g \
+ -e CRAWL4AI_API_TOKEN="$CRAWL4AI_API_TOKEN" \
+ unclecode/crawl4ai:latest
+```
-### Getting Started
+Test it (allow about 10 seconds for the start):
```bash
-# Pull and run the latest release
-docker pull unclecode/crawl4ai:latest
-docker run -d -p 11235:11235 --name crawl4ai --shm-size=1g unclecode/crawl4ai:latest
-
-# Visit the monitoring dashboard at http://localhost:11235/dashboard
-# Or the playground at http://localhost:11235/playground
+curl -s http://localhost:11235/md \
+ -H "Authorization: Bearer $CRAWL4AI_API_TOKEN" \
+ -H "Content-Type: application/json" \
+ -d '{"url": "https://news.ycombinator.com"}' | jq -r .markdown
```
-### Quick Test
+The dashboard is at `http://localhost:11235/dashboard`, the playground at `http://localhost:11235/playground`. LLM keys, MCP and every setting: [Self-hosting guide](https://docs.crawl4ai.com/core/self-hosting/).
+</details>
-Run a quick test (works for both Docker options):
+<details>
+<summary>⌨️ <strong>Command line (`crwl`)</strong></summary>
-```python
-import requests
-
-# Submit a crawl job
-response = requests.post(
- "http://localhost:11235/crawl",
- json={"urls": ["https://example.com"], "priority": 10}
-)
-if response.status_code == 200:
- print("Crawl job submitted successfully.")
-
-if "results" in response.json():
- results = response.json()["results"]
- print("Crawl job completed. Results:")
- for result in results:
- print(result)
-else:
- task_id = response.json()["task_id"]
- print(f"Crawl job submitted. Task ID:: {task_id}")
- result = requests.get(f"http://localhost:11235/task/{task_id}")
-```
+```bash
+# A page as Markdown
+crwl https://news.ycombinator.com -o markdown
-For more examples, see our [Docker Examples](https://github.com/unclecode/crawl4ai/blob/main/docs/examples/docker_example.py). For advanced configuration, monitoring features, and production deployment, see our [Self-Hosting Guide](https://docs.crawl4ai.com/core/self-hosting/).
+# Deep crawl, breadth first, at most 10 pages
+crwl https://docs.crawl4ai.com --deep-crawl bfs --max-pages 10
+# Ask a question about a page (needs an LLM key: crwl config)
+crwl https://www.example.com/products -q "Extract all product prices"
+```
</details>
----
-
-## 🔬 Advanced Usage Examples 🔬
+## 🔬 Advanced usage examples
-You can check the project structure in the directory [docs/examples](https://github.com/unclecode/crawl4ai/tree/main/docs/examples). Over there, you can find a variety of examples; here, some popular examples are shared.
+More in [docs/examples](https://github.com/unclecode/crawl4ai/tree/main/docs/examples).
<details>
-<summary>📝 <strong>Heuristic Markdown Generation with Clean and Fit Markdown</strong></summary>
+<summary>📝 <strong>Clean and fit Markdown</strong></summary>
```python
import asyncio
from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, CacheMode
-from crawl4ai.content_filter_strategy import PruningContentFilter, BM25ContentFilter
+from crawl4ai.content_filter_strategy import PruningContentFilterLXML
from crawl4ai.markdown_generation_strategy import DefaultMarkdownGenerator
async def main():
- browser_config = BrowserConfig(
- headless=True,
- verbose=True,
- )
run_config = CrawlerRunConfig(
- cache_mode=CacheMode.ENABLED,
+ cache_mode=CacheMode.BYPASS,
markdown_generator=DefaultMarkdownGenerator(
- content_filter=PruningContentFilter(threshold=0.48, threshold_type="fixed", min_word_threshold=0)
+ content_filter=PruningContentFilterLXML(threshold=0.48, threshold_type="fixed", min_word_threshold=0)
),
- # markdown_generator=DefaultMarkdownGenerator(
- # content_filter=BM25ContentFilter(user_query="WHEN_WE_FOCUS_BASED_ON_A_USER_QUERY", bm25_threshold=1.0)
- # ),
)
-
- async with AsyncWebCrawler(config=browser_config) as crawler:
- result = await crawler.arun(
- url="https://docs.micronaut.io/4.9.9/guide/",
- config=run_config
- )
- print(len(result.markdown.raw_markdown))
- print(len(result.markdown.fit_markdown))
-
-if __name__ == "__main__":
- asyncio.run(main())
-```
+ async with AsyncWebCrawler(config=BrowserConfig(headless=True)) as crawler:
+ result = await crawler.arun(url="https://en.wikipedia.org/wiki/Web_crawler", config=run_config)
+ print(len(result.markdown.raw_markdown), "characters of raw Markdown")
+ print(len(result.markdown.fit_markdown), "characters after the filter")
+asyncio.run(main())
+```
</details>
<details>
-<summary>🖥️ <strong>Executing JavaScript & Extract Structured Data without LLMs</strong></summary>
+<summary>🖥️ <strong>A JavaScript page and structured data, without an LLM</strong></summary>
```python
-import asyncio
-from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, CacheMode
-from crawl4ai import JsonCssExtractionStrategy
-import json
+import asyncio, json
+from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, CacheMode, JsonCssExtractionStrategy
-async def main():
- schema = {
- "name": "KidoCode Courses",
- "baseSelector": "section.charge-methodology .w-tab-content > div",
+schema = {
+ "name": "Quotes",
+ "baseSelector": "div.quote",
"fields": [
- {
- "name": "section_title",
- "selector": "h3.heading-50",
- "type": "text",
- },
- {
- "name": "section_description",
- "selector": ".charge-content",
- "type": "text",
- },
- {
- "name": "course_name",
- "selector": ".text-block-93",
- "type": "text",
- },
- {
- "name": "course_description",
- "selector": ".course-content-text",
- "type": "text",
- },
- {
- "name": "course_icon",
- "selector": ".image-92",
- "type": "attribute",
- "attribute": "src"
- }
- ]
+ {"name": "text", "selector": "span.text", "type": "text"},
+ {"name": "author", "selector": "small.author", "type": "text"},
+ {"name": "tags", "selector": "a.tag", "type": "list", "fields": [{"name": "tag", "type": "text"}]},
+ ],
}
- extraction_strategy = JsonCssExtractionStrategy(schema, verbose=True)
-
- browser_config = BrowserConfig(
- headless=False,
- verbose=True
- )
+async def main():
run_config = CrawlerRunConfig(
- extraction_strategy=extraction_strategy,
- js_code=["""(async () => {const tabs = document.querySelectorAll("section.charge-methodology .tabs-menu-3 > div");for(let tab of tabs) {tab.scrollIntoView();tab.click();await new Promise(r => setTimeout(r, 500));}})();"""],
- cache_mode=CacheMode.BYPASS
+ extraction_strategy=JsonCssExtractionStrategy(schema),
+ scan_full_page=True, # scroll to the end, so the page loads every quote
+ scroll_delay=0.5,
+ cache_mode=CacheMode.BYPASS,
)
-
- async with AsyncWebCrawler(config=browser_config) as crawler:
-
- result = await crawler.arun(
- url="https://www.kidocode.com/degrees/technology",
- config=run_config
- )
-
- companies = json.loads(result.extracted_content)
- print(f"Successfully extracted {len(companies)} companies")
- print(json.dumps(companies[0], indent=2))
+ async with AsyncWebCrawler(config=BrowserConfig(headless=True)) as crawler:
+ result = await crawler.arun(url="https://quotes.toscrape.com/scroll", config=run_config)
+ quotes = json.loads(result.extracted_content)
+ print(f"Extracted {len(quotes)} quotes")
+ print(json.dumps(quotes[0], indent=2))
-
-if __name__ == "__main__":
- asyncio.run(main())
+asyncio.run(main())
```
-
</details>
<details>
-<summary>📚 <strong>Extracting Structured Data with LLMs</strong></summary>
+<summary>📚 <strong>Structured data with an LLM</strong></summary>
```python
-import os
-import asyncio
-from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, CacheMode, LLMConfig
-from crawl4ai import LLMExtractionStrategy
+import os, asyncio
from pydantic import BaseModel, Field
+from crawl4ai import AsyncWebCrawler, CrawlerRunConfig, CacheMode, LLMConfig, LLMExtractionStrategy
-class OpenAIModelFee(BaseModel):
- model_name: str = Field(..., description="Name of the OpenAI model.")
- input_fee: str = Field(..., description="Fee for input token for the OpenAI model.")
- output_fee: str = Field(..., description="Fee for output token for the OpenAI model.")
+class ModelFee(BaseModel):
+ model_name: str = Field(..., description="Name of the model.")
+ input_fee: str = Field(..., description="Fee for input tokens.")
+ output_fee: str = Field(..., description="Fee for output tokens.")
async def main():
- browser_config = BrowserConfig(verbose=True)
run_config = CrawlerRunConfig(
- word_count_threshold=1,
+ cache_mode=CacheMode.BYPASS,
extraction_strategy=LLMExtractionStrategy(
- # Here you can use any provider that Litellm library supports, for instance: ollama/qwen2
- # provider="ollama/qwen2", api_token="no-token",
- llm_config = LLMConfig(provider="openai/gpt-4o", api_token=os.getenv('OPENAI_API_KEY')),
- schema=OpenAIModelFee.schema(),
+ # any provider LiteLLM supports, e.g. "ollama/llama3.3" with api_token="no-token"
+ llm_config=LLMConfig(provider="openai/gpt-4o-mini", api_token=os.getenv("OPENAI_API_KEY")),
+ schema=ModelFee.model_json_schema(),
extraction_type="schema",
- instruction="""From the crawled content, extract all mentioned model names along with their fees for input and output tokens.
- Do not miss any models in the entire content. One extracted model JSON format should look like this:
- {"model_name": "GPT-4", "input_fee": "US$10.00 / 1M tokens", "output_fee": "US$30.00 / 1M tokens"}."""
- ),
- cache_mode=CacheMode.BYPASS,
+ instruction="Extract every model name with its input and output token fee.",
+ ),
)
-
- async with AsyncWebCrawler(config=browser_config) as crawler:
- result = await crawler.arun(
- url='https://openai.com/api/pricing/',
- config=run_config
- )
+ async with AsyncWebCrawler() as crawler:
+ result = await crawler.arun(url="https://openai.com/api/pricing/", config=run_config)
print(result.extracted_content)
-if __name__ == "__main__":
- asyncio.run(main())
+asyncio.run(main())
```
-
</details>
<details>
-<summary>🤖 <strong>Using Your own Browser with Custom User Profile</strong></summary>
+<summary>🤖 <strong>Your own browser with a saved profile</strong></summary>
```python
-import os, sys
+import os, asyncio
from pathlib import Path
-import asyncio, time
from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, CacheMode
-async def test_news_crawl():
- # Create a persistent user data directory
+async def main():
user_data_dir = os.path.join(Path.home(), ".crawl4ai", "browser_profile")
os.makedirs(user_data_dir, exist_ok=True)
-
- browser_config = BrowserConfig(
- verbose=True,
- headless=True,
- user_data_dir=user_data_dir,
- use_persistent_context=True,
- )
- run_config = CrawlerRunConfig(
- cache_mode=CacheMode.BYPASS
- )
-
+ browser_config = BrowserConfig(headless=True, user_data_dir=user_data_dir, use_persistent_context=True)
+ run_config = CrawlerRunConfig(cache_mode=CacheMode.BYPASS, magic=True)
async with AsyncWebCrawler(config=browser_config) as crawler:
- url = "ADDRESS_OF_A_CHALLENGING_WEBSITE"
-
- result = await crawler.arun(
- url,
- config=run_config,
- magic=True,
- )
-
- print(f"Successfully crawled {url}")
- print(f"Content length: {len(result.markdown)}")
-```
-
-</details>
-
----
+ result = await crawler.arun(url="ADDRESS_OF_A_CHALLENGING_WEBSITE", config=run_config)
+ print(result.success, len(result.markdown))
-## ✨ Recent Updates
-
-<details open>
-<summary><strong>Version 0.9.4 Release Highlights - Security Release and Faster Pruning</strong></summary>
-
-A security release closing three coordinated-disclosure advisories. Two are SSRF paths that did not go through the Docker server's egress rule: the robots.txt fetch behind `check_robots_txt`, and the URL seeder behind `link_preview_config`, which also returned the fetched `<head>` to the caller. Both now go through the server's pinning egress proxy. The third is a bypass of the untrusted-config gate: a `{"type": "dict"}` wrapper let a forbidden `LLMConfig` through, so a non-admin client could read server environment variables.
-
-It also adds `PruningContentFilterLXML`, an lxml-native pruning filter that is about 10x faster and gives byte-identical output. It is now the default, and `PruningContentFilter` is deprecated. Bug fixes cover deep-crawl speed, tables with `rowspan`/`colspan`, robots.txt rules, pooled browser recycling, and the Docker Playground.
-
-No breaking changes.
-
-```bash
-pip install -U crawl4ai
+asyncio.run(main())
```
-
-[Full v0.9.4 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.4.md)
-
</details>
-<details>
-<summary><strong>Version 0.9.3 Release Highlights - Security Release</strong></summary>
-
-A security release closing five coordinated-disclosure advisories. Four are in the PDF processing path: an arbitrary file write through `PDFContentScrapingStrategy` image-write fields, an SSRF where the PDF download followed redirects into internal addresses, a denial of service from unbounded PDF size and page count, and an XSS from unescaped PDF text in `cleaned_html`. The fifth is a DOM-based XSS in the Docker Playground that could expose the operator's API token.
-
-It also carries 33 bug fixes that accumulated since 0.9.2: PDF scraping now works out of the box on the Docker server, the egress proxy chains through an upstream proxy, failed crawl results are reported instead of dropped, a Playwright driver leak on failed browser launch is fixed, and PDF crawls are no longer wrongly flagged as anti-bot blocks.
+## 📖 Documentation
-No new features, no breaking changes. Two defaults changed: PDF downloads now cap at 100 MiB and 2000 pages, and the Docker `limits.wall_clock_s` is now 300 seconds instead of 0.
+- Library docs, guides and API reference: [docs.crawl4ai.com](https://docs.crawl4ai.com/)
+- Cloud docs: [crawl4ai.com/docs](https://crawl4ai.com/docs?ref=readme)
+- Release notes: [releases](https://github.com/unclecode/crawl4ai/releases) · Roadmap: [ROADMAP.md](https://github.com/unclecode/crawl4ai/blob/main/ROADMAP.md)
-```bash
-pip install -U crawl4ai
-```
-
-[Full v0.9.3 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.3.md)
-
-</details>
-
-<details>
-<summary><strong>Version 0.9.2 Release Highlights - Maintenance Bug Fixes</strong></summary>
-
-A maintenance patch release with bug fixes across the dispatcher, Docker, and GPU builds. `MemoryAdaptiveDispatcher` no longer leaks crawl tasks and browser pages when a streaming crawl is closed. Docker fixes cover the Playground "Advanced Config" 400, the Monitor WebSocket 500 under JWT auth, and Playwright headless-shell packaging. `ENABLE_GPU=true` Docker builds no longer fail on the CUDA toolkit.
-
-No new features, no breaking changes.
-
-```bash
-pip install -U crawl4ai
-```
-
-[Full v0.9.2 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.2.md)
-
-</details>
-
-<details>
-<summary><strong>Version 0.9.1 Release Highlights - Bug Fixes & PruningContentFilter Whitelist</strong></summary>
-
-A patch release with 12 bug fixes and one new feature. The new `preserve_classes` / `preserve_tags` parameters for `PruningContentFilter` let you whitelist CSS classes or HTML tags that should never be pruned — useful for protecting short metadata elements like author names and timestamps.
-
-Bug fixes span Docker (auth gate UI, supervisord/redis dirs, FastAPI compatibility, redis auth), browser (Windows channel crash, context snapshot leak), core (HTTP timeout unit mismatch, best-first ordering), and extraction (html2text table attributes).
-
-```bash
-pip install -U crawl4ai
-```
-
-[Full v0.9.1 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.1.md)
-
-</details>
-
-<details>
-<summary><strong>Version 0.9.0 Release Highlights - Secure-by-Default Docker Server</strong></summary>
-
-A major, secure-by-default release of the Docker API server. The out-of-the-box deployment is hardened with defense in depth: authentication is on by default, the server binds loopback unless you give it a token, and the network request body is treated as an untrusted trust boundary.
-
-```bash
-pip install -U crawl4ai
-```
-
-[Migration Guide →](https://github.com/unclecode/crawl4ai/blob/main/deploy/docker/MIGRATION.md) · [Full v0.9.0 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.0.md)
-
-</details>
-
-<details>
-<summary><strong>Version 0.8.7 Release Highlights - Security Hardening, DomainMapper & Community Fixes</strong></summary>
-
-A security-hardening release. Fixes critical Docker API vulnerabilities (AST sandbox escape RCE, hook sandbox RCE, hardcoded JWT secret, SSRF on webhook and crawl endpoints, arbitrary file write, monitor auth bypass, stored XSS, and unauthenticated JS execution), adds the DomainMapper feature, and ships a batch of scraping, deep-crawl, and LLM fixes. If you self-host the Docker API, upgrade immediately.
-
-```bash
-pip install -U crawl4ai
-```
-
-[Full v0.8.7 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.7.md)
-
-</details>
-
-<details>
-<summary><strong>Version 0.8.6 - Security Hotfix: litellm Supply Chain Fix</strong></summary>
-
-Replaced `litellm` dependency with `unclecode-litellm` due to a PyPI supply chain compromise affecting the original package. If you're on v0.8.5 or earlier, upgrade immediately.
-
-```bash
-pip install -U crawl4ai
-```
-
-</details>
-
-<details>
-<summary><strong>Version 0.8.5 Release Highlights - Anti-Bot Detection, Shadow DOM & 60+ Bug Fixes</strong></summary>
-
-Our biggest release since v0.8.0. Anti-bot detection with proxy escalation, Shadow DOM flattening, deep crawl cancellation, and over 60 bug fixes.
-
-- **🛡️ Anti-Bot Detection & Proxy Escalation**:
- - 3-tier detection: known vendors, generic block indicators, structural integrity checks
- - Automatic retry with proxy chain and fallback fetch function
- ```python
- from crawl4ai import CrawlerRunConfig
- from crawl4ai.async_configs import ProxyConfig
-
- config = CrawlerRunConfig(
- proxy_config=[ProxyConfig.DIRECT, ProxyConfig(server="http://my-proxy:8080")],
- max_retries=2,
- fallback_fetch_function=my_web_unlocker,
- )
- ```
-
-- **🌑 Shadow DOM Flattening**:
- - Extract content hidden inside shadow DOM components
- ```python
- config = CrawlerRunConfig(flatten_shadow_dom=True)
- ```
-
-- **🛑 Deep Crawl Cancellation**:
- - Stop long crawls gracefully with `cancel()` or `should_cancel` callback
- - Works with BFS, DFS, and BestFirst strategies
-
-- **⚙️ Config Defaults API**:
- - `set_defaults()` / `get_defaults()` / `reset_defaults()` on BrowserConfig and CrawlerRunConfig
-
-- **🔒 Critical Security Fixes**:
- - RCE via deserialization in Docker `/crawl` endpoint — removed `eval()`, added allowlist
- - Redis CVE-2025-49844 (CVSS 10.0) — upgraded to 7.2.7
-
-- **60+ Bug Fixes** across browser management, proxy, deep crawling, extraction, CLI, and Docker
-
-[Full v0.8.5 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.5.md)
-
-</details>
-
-<details>
-<summary><strong>Version 0.8.0 Release Highlights - Crash Recovery & Prefetch Mode</strong></summary>
-
-This release introduces crash recovery for deep crawls, a new prefetch mode for fast URL discovery, and critical security fixes for Docker deployments.
-
-- **🔄 Deep Crawl Crash Recovery**:
- - `on_state_change` callback fires after each URL for real-time state persistence
- - `resume_state` parameter to continue from a saved checkpoint
- - JSON-serializable state for Redis/database storage
- - Works with BFS, DFS, and Best-First strategies
- ```python
- from crawl4ai.deep_crawling import BFSDeepCrawlStrategy
-
- strategy = BFSDeepCrawlStrategy(
- max_depth=3,
- resume_state=saved_state, # Continue from checkpoint
- on_state_change=save_to_redis, # Called after each URL
- )
- ```
-
-- **⚡ Prefetch Mode for Fast URL Discovery**:
- - `prefetch=True` skips markdown, extraction, and media processing
- - 5-10x faster than full processing
- - Perfect for two-phase crawling: discover first, process selectively
- ```python
- config = CrawlerRunConfig(prefetch=True)
- result = await crawler.arun("https://example.com", config=config)
- # Returns HTML and links only - no markdown generation
- ```
-
-- **🔒 Security Fixes (Docker API)**:
- - Hooks disabled by default (`CRAWL4AI_HOOKS_ENABLED=false`)
- - `file://` URLs blocked on API endpoints to prevent LFI
- - `__import__` removed from hook execution sandbox
-
-[Full v0.8.0 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.0.md)
-
-</details>
-
-<details>
-<summary><strong>Version 0.7.8 Release Highlights - Stability & Bug Fix Release</strong></summary>
-
-This release focuses on stability with 11 bug fixes addressing issues reported by the community. No new features, but significant improvements to reliability.
-
-- **🐳 Docker API Fixes**:
- - Fixed `ContentRelevanceFilter` deserialization in deep crawl requests (#1642)
- - Fixed `ProxyConfig` JSON serialization in `BrowserConfig.to_dict()` (#1629)
- - Fixed `.cache` folder permissions in Docker image (#1638)
-
-- **🤖 LLM Extraction Improvements**:
- - Configurable rate limiter backoff with new `LLMConfig` parameters (#1269):
- ```python
- from crawl4ai import LLMConfig
-
- config = LLMConfig(
- provider="openai/gpt-4o-mini",
- backoff_base_delay=5, # Wait 5s on first retry
- backoff_max_attempts=5, # Try up to 5 times
- backoff_exponential_factor=3 # Multiply delay by 3 each attempt
- )
- ```
- - HTML input format support for `LLMExtractionStrategy` (#1178):
- ```python
- from crawl4ai import LLMExtractionStrategy
-
- strategy = LLMExtractionStrategy(
- llm_config=config,
- instruction="Extract table data",
- input_format="html" # Now supports: "html", "markdown", "fit_markdown"
- )
- ```
- - Fixed raw HTML URL variable - extraction strategies now receive `"Raw HTML"` instead of HTML blob (#1116)
-
-- **🔗 URL Handling**:
- - Fixed relative URL resolution after JavaScript redirects (#1268)
- - Fixed import statement formatting in extracted code (#1181)
-
-- **📦 Dependency Updates**:
- - Replaced deprecated PyPDF2 with pypdf (#1412)
- - Pydantic v2 ConfigDict compatibility - no more deprecation warnings (#678)
-
-- **🧠 AdaptiveCrawler**:
- - Fixed query expansion to actually use LLM instead of hardcoded mock data (#1621)
-
-[Full v0.7.8 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.8.md)
-
-</details>
-
-<details>
-<summary><strong>Version 0.7.7 Release Highlights - The Self-Hosting & Monitoring Update</strong></summary>
-
-- **📊 Real-time Monitoring Dashboard**: Interactive web UI with live system metrics and browser pool visibility
- ```python
- # Access the monitoring dashboard
- # Visit: http://localhost:11235/dashboard
-
- # Real-time metrics include:
- # - System health (CPU, memory, network, uptime)
- # - Active and completed request tracking
- # - Browser pool management (permanent/hot/cold)
- # - Janitor cleanup events
- # - Error monitoring with full context
- ```
-
-- **🔌 Comprehensive Monitor API**: Complete REST API for programmatic access to all monitoring data
- ```python
- import httpx
-
- async with httpx.AsyncClient() as client:
- # System health
- health = await client.get("http://localhost:11235/monitor/health")
-
- # Request tracking
- requests = await client.get("http://localhost:11235/monitor/requests")
-
- # Browser pool status
- browsers = await client.get("http://localhost:11235/monitor/browsers")
-
- # Endpoint statistics
- stats = await client.get("http://localhost:11235/monitor/endpoints/stats")
- ```
-
-- **⚡ WebSocket Streaming**: Real-time updates every 2 seconds for custom dashboards
-- **🔥 Smart Browser Pool**: 3-tier architecture (permanent/hot/cold) with automatic promotion and cleanup
-- **🧹 Janitor System**: Automatic resource management with event logging
-- **🎮 Control Actions**: Manual browser management (kill, restart, cleanup) via API
-- **📈 Production Metrics**: 6 critical metrics for operational excellence with Prometheus integration
-- **🐛 Critical Bug Fixes**:
- - Fixed async LLM extraction blocking issue (#1055)
- - Enhanced DFS deep crawl strategy (#1607)
- - Fixed sitemap parsing in AsyncUrlSeeder (#1598)
- - Resolved browser viewport configuration (#1495)
- - Fixed CDP timing with exponential backoff (#1528)
- - Security update for pyOpenSSL (>=25.3.0)
-
-[Full v0.7.7 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.7.md)
-
-</details>
-
-<details>
-<summary><strong>Version 0.7.5 Release Highlights - The Docker Hooks & Security Update</strong></summary>
-
-- **🔧 Docker Hooks System**: Complete pipeline customization with user-provided Python functions at 8 key points
-- **✨ Function-Based Hooks API (NEW)**: Write hooks as regular Python functions with full IDE support:
- ```python
- from crawl4ai import hooks_to_string
- from crawl4ai.docker_client import Crawl4aiDockerClient
-
- # Define hooks as regular Python functions
- async def on_page_context_created(page, context, **kwargs):
- """Block images to speed up crawling"""
- await context.route("**/*.{png,jpg,jpeg,gif,webp}", lambda route: route.abort())
- await page.set_viewport_size({"width": 1920, "height": 1080})
- return page
-
- async def before_goto(page, context, url, **kwargs):
- """Add custom headers"""
- await page.set_extra_http_headers({'X-Crawl4AI': 'v0.7.5'})
- return page
-
- # Option 1: Use hooks_to_string() utility for REST API
- hooks_code = hooks_to_string({
- "on_page_context_created": on_page_context_created,
- "before_goto": before_goto
- })
-
- # Option 2: Docker client with automatic conversion (Recommended)
- client = Crawl4aiDockerClient(base_url="http://localhost:11235")
- results = await client.crawl(
- urls=["https://httpbin.org/html"],
- hooks={
- "on_page_context_created": on_page_context_created,
- "before_goto": before_goto
- }
- )
- # ✓ Full IDE support, type checking, and reusability!
- ```
-
-- **🤖 Enhanced LLM Integration**: Custom providers with temperature control and base_url configuration
-- **🔒 HTTPS Preservation**: Secure internal link handling with `preserve_https_for_internal_links=True`
-- **🐍 Python 3.10+ Support**: Modern language features and enhanced performance
-- **🛠️ Bug Fixes**: Resolved multiple community-reported issues including URL processing, JWT authentication, and proxy configuration
-
-[Full v0.7.5 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.5.md)
-
-</details>
-
-<details>
-<summary><strong>Version 0.7.4 Release Highlights - The Intelligent Table Extraction & Performance Update</strong></summary>
-
-- **🚀 LLMTableExtraction**: Revolutionary table extraction with intelligent chunking for massive tables:
- ```python
- from crawl4ai import LLMTableExtraction, LLMConfig
-
- # Configure intelligent table extraction
- table_strategy = LLMTableExtraction(
- llm_config=LLMConfig(provider="openai/gpt-4.1-mini"),
- enable_chunking=True, # Handle massive tables
- chunk_token_threshold=5000, # Smart chunking threshold
- overlap_threshold=100, # Maintain context between chunks
- extraction_type="structured" # Get structured data output
- )
-
- config = CrawlerRunConfig(table_extraction_strategy=table_strategy)
- result = await crawler.arun("https://complex-tables-site.com", config=config)
-
- # Tables are automatically chunked, processed, and merged
- for table in result.tables:
- print(f"Extracted table: {len(table['data'])} rows")
- ```
-
-- **⚡ Dispatcher Bug Fix**: Fixed sequential processing bottleneck in arun_many for fast-completing tasks
-- **🧹 Memory Management Refactor**: Consolidated memory utilities into main utils module for cleaner architecture
-- **🔧 Browser Manager Fixes**: Resolved race conditions in concurrent page creation with thread-safe locking
-- **🔗 Advanced URL Processing**: Better handling of raw:// URLs and base tag link resolution
-- **🛡️ Enhanced Proxy Support**: Flexible proxy configuration supporting both dict and string formats
-
-[Full v0.7.4 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.4.md)
-
-</details>
-
-<details>
-<summary><strong>Version 0.7.3 Release Highlights - The Multi-Config Intelligence Update</strong></summary>
-
-- **🕵️ Undetected Browser Support**: Bypass sophisticated bot detection systems:
- ```python
- from crawl4ai import AsyncWebCrawler, BrowserConfig
-
- browser_config = BrowserConfig(
- browser_type="undetected", # Use undetected Chrome
- headless=True, # Can run headless with stealth
- extra_args=[
- "--disable-blink-features=AutomationControlled",
- "--disable-web-security"
- ]
- )
-
- async with AsyncWebCrawler(config=browser_config) as crawler:
- result = await crawler.arun("https://protected-site.com")
- # Successfully bypass Cloudflare, Akamai, and custom bot detection
- ```
-
-- **🎨 Multi-URL Configuration**: Different strategies for different URL patterns in one batch:
-```python
-from crawl4ai import CrawlerRunConfig, MatchMode, CacheMode
-
- configs = [
- # Documentation sites - aggressive caching
- CrawlerRunConfig(
- url_matcher=["*docs*", "*documentation*"],
- cache_mode=CacheMode.WRITE_ONLY,
- markdown_generator_options={"include_links": True}
- ),
-
- # News/blog sites - fresh content
- CrawlerRunConfig(
- url_matcher=lambda url: 'blog' in url or 'news' in url,
- cache_mode=CacheMode.BYPASS
- ),
-
- # Fallback for everything else
- CrawlerRunConfig()
- ]
-
- results = await crawler.arun_many(urls, config=configs)
- # Each URL gets the perfect configuration automatically
- ```
-
-- **🧠 Memory Monitoring**: Track and optimize memory usage during crawling:
- ```python
- from crawl4ai.memory_utils import MemoryMonitor
-
- monitor = MemoryMonitor()
- monitor.start_monitoring()
-
- results = await crawler.arun_many(large_url_list)
-
- report = monitor.get_report()
- print(f"Peak memory: {report['peak_mb']:.1f} MB")
- print(f"Efficiency: {report['efficiency']:.1f}%")
- # Get optimization recommendations
- ```
-
-- **📊 Enhanced Table Extraction**: Direct DataFrame conversion from web tables:
- ```python
- result = await crawler.arun("https://site-with-tables.com")
-
- # New way - direct table access
- if result.tables:
- import pandas as pd
- for table in result.tables:
- df = pd.DataFrame(table['data'])
- print(f"Table: {df.shape[0]} rows × {df.shape[1]} columns")
- ```
-
-- **💰 GitHub Sponsors**: 4-tier sponsorship system for project sustainability
-- **🐳 Docker LLM Flexibility**: Configure providers via environment variables
-
-[Full v0.7.3 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.3.md)
-
-</details>
-
-<details>
-<summary><strong>Version 0.7.0 Release Highlights - The Adaptive Intelligence Update</strong></summary>
-
-- **🧠 Adaptive Crawling**: Your crawler now learns and adapts to website patterns automatically:
- ```python
- config = AdaptiveConfig(
- confidence_threshold=0.7, # Min confidence to stop crawling
- max_depth=5, # Maximum crawl depth
- max_pages=20, # Maximum number of pages to crawl
- strategy="statistical"
- )
-
- async with AsyncWebCrawler() as crawler:
- adaptive_crawler = AdaptiveCrawler(crawler, config)
- state = await adaptive_crawler.digest(
- start_url="https://news.example.com",
- query="latest news content"
- )
- # Crawler learns patterns and improves extraction over time
- ```
-
-- **🌊 Virtual Scroll Support**: Complete content extraction from infinite scroll pages:
- ```python
- scroll_config = VirtualScrollConfig(
- container_selector="[data-testid='feed']",
- scroll_count=20,
- scroll_by="container_height",
- wait_after_scroll=1.0
- )
-
- result = await crawler.arun(url, config=CrawlerRunConfig(
- virtual_scroll_config=scroll_config
- ))
- ```
-
-- **🔗 Intelligent Link Analysis**: 3-layer scoring system for smart link prioritization:
- ```python
- link_config = LinkPreviewConfig(
- query="machine learning tutorials",
- score_threshold=0.3,
- concurrent_requests=10
- )
-
- result = await crawler.arun(url, config=CrawlerRunConfig(
- link_preview_config=link_config,
- score_links=True
- ))
- # Links ranked by relevance and quality
- ```
-
-- **🎣 Async URL Seeder**: Discover thousands of URLs in seconds:
- ```python
- seeder = AsyncUrlSeeder(SeedingConfig(
- source="sitemap+cc",
- pattern="*/blog/*",
- query="python tutorials",
- score_threshold=0.4
- ))
-
- urls = await seeder.discover("https://example.com")
- ```
-
-- **⚡ Performance Boost**: Up to 3x faster with optimized resource handling and memory efficiency
-
-Read the full details in our [0.7.0 Release Notes](https://docs.crawl4ai.com/blog/release-v0.7.0) or check the [CHANGELOG](https://github.com/unclecode/crawl4ai/blob/main/CHANGELOG.md).
-
-</details>
-
-## Version Numbering in Crawl4AI
-
-Crawl4AI follows standard Python version numbering conventions (PEP 440) to help users understand the stability and features of each release.
-
-<details>
-<summary>📈 <strong>Version Numbers Explained</strong></summary>
-
-Our version numbers follow this pattern: `MAJOR.MINOR.PATCH` (e.g., 0.4.3)
-
-#### Pre-release Versions
-We use different suffixes to indicate development stages:
-
-- `dev` (0.4.3dev1): Development versions, unstable
-- `a` (0.4.3a1): Alpha releases, experimental features
-- `b` (0.4.3b1): Beta releases, feature complete but needs testing
-- `rc` (0.4.3): Release candidates, potential final version
-
-#### Installation
-- Regular installation (stable version):
- ```bash
- pip install -U crawl4ai
- ```
-
-- Install pre-release versions:
- ```bash
- pip install crawl4ai --pre
- ```
-
-- Install specific version:
- ```bash
- pip install crawl4ai==0.4.3b1
- ```
-
-#### Why Pre-releases?
-We use pre-releases to:
-- Test new features in real-world scenarios
-- Gather feedback before final releases
-- Ensure stability for production users
-- Allow early adopters to try new features
-
-For production environments, we recommend using the stable version. For testing new features, you can opt-in to pre-releases using the `--pre` flag.
-
-</details>
-
-## 📖 Documentation & Roadmap
-
-> 🚨 **Documentation Update Alert**: We're undertaking a major documentation overhaul next week to reflect recent updates and improvements. Stay tuned for a more comprehensive and up-to-date guide!
-
-For current documentation, including installation instructions, advanced features, and API reference, visit our [Documentation Website](https://docs.crawl4ai.com/).
-
-To check our development plans and upcoming features, visit our [Roadmap](https://github.com/unclecode/crawl4ai/blob/main/ROADMAP.md).
-
-<details>
-<summary>📈 <strong>Development TODOs</strong></summary>
-
-- [x] 0. Graph Crawler: Smart website traversal using graph search algorithms for comprehensive nested page extraction
-- [x] 1. Question-Based Crawler: Natural language driven web discovery and content extraction
-- [x] 2. Knowledge-Optimal Crawler: Smart crawling that maximizes knowledge while minimizing data extraction
-- [x] 3. Agentic Crawler: Autonomous system for complex multi-step crawling operations
-- [x] 4. Automated Schema Generator: Convert natural language to extraction schemas
-- [x] 5. Domain-Specific Scrapers: Pre-configured extractors for common platforms (academic, e-commerce)
-- [x] 6. Web Embedding Index: Semantic search infrastructure for crawled content
-- [x] 7. Interactive Playground: Web UI for testing, comparing strategies with AI assistance
-- [x] 8. Performance Monitor: Real-time insights into crawler operations
-- [ ] 9. Cloud Integration: One-click deployment solutions across cloud providers
-- [x] 10. Sponsorship Program: Structured support system with tiered benefits
-- [ ] 11. Educational Content: "How to Crawl" video series and interactive tutorials
-
-</details>
-
-## 🤝 Contributing
+## 🤝 Contributing
We welcome contributions from the open-source community. Check out our [contribution guidelines](https://github.com/unclecode/crawl4ai/blob/main/CONTRIBUTORS.md) for more information.
-I'll help modify the license section with badges. For the halftone effect, here's a version with it:
-
-Here's the updated license section:
-
## 📄 License & Attribution
This project is licensed under the Apache License 2.0, attribution is recommended via the badges below. See the [Apache 2.0 License](https://github.com/unclecode/crawl4ai/blob/main/LICENSE) file for details.
@@ -1237,40 +448,16 @@ UncleCode. (2024). Crawl4AI: Open-source LLM Friendly Web Crawler & Scraper [Com
GitHub. https://github.com/unclecode/crawl4ai
```
-## 📧 Contact
-
-For questions, suggestions, or feedback, feel free to reach out:
-
-- GitHub: [unclecode](https://github.com/unclecode)
-- Twitter: [@unclecode](https://twitter.com/unclecode)
-- Website: [crawl4ai.com](https://crawl4ai.com)
-
-Happy Crawling! 🕸️🚀
-
## 🗾 Mission
-Our mission is to unlock the value of personal and enterprise data by transforming digital footprints into structured, tradeable assets. Crawl4AI empowers individuals and organizations with open-source tools to extract and structure data, fostering a shared data economy.
-
-We envision a future where AI is powered by real human knowledge, ensuring data creators directly benefit from their contributions. By democratizing data and enabling ethical sharing, we are laying the foundation for authentic AI advancement.
-
-<details>
-<summary>🔑 <strong>Key Opportunities</strong></summary>
-
-- **Data Capitalization**: Transform digital footprints into measurable, valuable assets.
-- **Authentic AI Data**: Provide AI systems with real human insights.
-- **Shared Economy**: Create a fair data marketplace that benefits data creators.
-
-</details>
-
-<details>
-<summary>🚀 <strong>Development Pathway</strong></summary>
+Our mission is to unlock the value of personal and enterprise data by turning digital footprints into structured, useful assets. Crawl4AI gives individuals and organizations open-source tools to extract and structure data, and a fair way to benefit from it. [Full mission statement →](./MISSION.md)
-1. **Open-Source Tools**: Community-driven platforms for transparent data extraction.
-2. **Digital Asset Structuring**: Tools to organize and value digital knowledge.
-3. **Ethical Data Marketplace**: A secure, fair platform for exchanging structured data.
+## 💖 Support Crawl4AI
-For more details, see our [full mission statement](./MISSION.md).
-</details>
+1. ⭐ **Star the repo**: it helps more people find it.
+2. ☁️ **Use the cloud**: [crawl4ai.com](https://crawl4ai.com/?ref=readme). It funds the library.
+3. 💝 **Sponsor on GitHub**: [github.com/sponsors/unclecode](https://github.com/sponsors/unclecode)
+4. 🏢 **Companies**: the sponsor tiers and benefits are in [SPONSORS.md](SPONSORS.md).
## 🌟 Current Sponsors
@@ -1321,6 +508,23 @@ A heartfelt thanks to our individual supporters! Every contribution helps us kee
> Want to join them? [Sponsor Crawl4AI →](https://github.com/sponsors/unclecode)
+## 📧 Contact
+
+[Discord](https://discord.gg/jP8KfhDhyN) · [X @unclecode](https://x.com/unclecode) · [GitHub @unclecode](https://github.com/unclecode) · [email protected]
+
+- **Building crawlers or AI agents for a living?** DM me on X. I want to work with people like you, and we are hiring.
+- **From a company?** We have an enterprise offer and we tailor it to your business. SOC 2 Type I is done, Type II is in progress. Write to [email protected].
+
+<p align="center">
+ <a href="https://github.com/unclecode/crawl4ai/network/members"><img src="https://img.shields.io/github/forks/unclecode/crawl4ai?style=social" alt="GitHub Forks"/></a>
+ <a href="https://pypi.org/project/crawl4ai/"><img src="https://img.shields.io/pypi/pyversions/crawl4ai" alt="Python Version"/></a>
+ <a href="https://github.com/sponsors/unclecode"><img src="https://img.shields.io/github/sponsors/unclecode?style=flat&logo=GitHub-Sponsors&label=Sponsors&color=pink" alt="GitHub Sponsors"/></a>
+ <a href="https://x.com/crawl4ai"><img src="https://img.shields.io/badge/Follow%20on%20X-000000?style=flat&logo=x&logoColor=white" alt="Follow on X"/></a>
+ <a href="https://www.linkedin.com/company/crawl4ai"><img src="https://img.shields.io/badge/LinkedIn-0077B5?style=flat&logo=linkedin&logoColor=white" alt="Follow on LinkedIn"/></a>
+</p>
+
+Happy crawling! 🕸️🚀
+
## Star History
<a href="https://www.star-history.com/?type=date&repos=unclecode%2Fcrawl4ai">
diff --git a/crawl4ai/cloud_notice.py b/crawl4ai/cloud_notice.py
index add59ebd..0805ddc2 100644
--- a/crawl4ai/cloud_notice.py
+++ b/crawl4ai/cloud_notice.py
@@ -1,18 +1,24 @@
-"""The Crawl4AI Cloud notice: short lines that tell a user the hosted version exists.
+"""The Crawl4AI Cloud notice: a short yellow banner that tells a user the hosted version exists.
It prints in four places:
- at the end of ``crawl4ai-setup``, every time (``show_at_install``);
-- once per minor release per machine, when the first ``AsyncWebCrawler`` starts or the ``crwl`` CLI runs
- (``show_once``; a marker file in the crawl4ai home folder holds the last minor version shown);
+- when the first ``AsyncWebCrawler`` starts or the ``crwl`` CLI runs (``show_once``): once a day per
+ machine while the launch offer runs (before ``DAILY_UNTIL``), then once per version per machine, a
+ patch release included. A marker file in the crawl4ai home folder holds the day, or the version, last shown;
- when a crawl is blocked by anti-bot protection, at most once a day (``show_blocked``);
- when ``crawl4ai-setup`` could not install the browser (``show_setup_failed``).
+The banner goes to the logger's console (stderr by default), never to stdout, so a piped ``crwl`` output
+or an MCP stdio transport stays clean. Rich drops the color when the output is not a terminal and honours
+``NO_COLOR``. Only ASCII characters, so every console can print it.
+
Each link carries its own ``ref`` so the cloud can tell which moment brought a user.
``CRAWL4AI_NO_CLOUD_NOTICE=1`` turns every line off, for operators who run the library in production logs.
"""
import os
+import sys
import time
from pathlib import Path
@@ -23,19 +29,25 @@ _ENV_OFF = "CRAWL4AI_NO_CLOUD_NOTICE"
_MARKER = ".cloud-notice-shown"
_BLOCKED_MARKER = ".cloud-notice-blocked"
+# The first day the banner stops returning daily: the launch offer ends on 31 December 2026.
+DAILY_UNTIL = "2027-01-01"
+_RULE = "=" * 72
+
LINES = (
- "Crawl4AI Cloud is live: the same crawler, hosted. Your first $10 pack is on us until 31 Dec 2026 (then $5 to start). No card.",
- f"Get a key in 10 seconds: {CLOUD_URL} (the library stays open source, forever)",
- f"Hide this notice: {_ENV_OFF}=1",
+ "Crawl4AI Cloud is live: the same crawler, hosted.",
+ "Your first $10 pack is on us until 31 Dec 2026 (then $5 to start). No card.",
+ f"Get a key in 10 seconds: {CLOUD_URL}",
+ f"The library stays open source, forever. Hide this banner: {_ENV_OFF}=1",
)
BLOCKED_LINES = (
- f"Blocked? Crawl4AI Cloud gets through the hard sites, free credit to start: {BLOCKED_URL}",
- f"Hide this notice: {_ENV_OFF}=1",
+ "Blocked? Crawl4AI Cloud gets through the hard sites, free credit to start.",
+ f"{BLOCKED_URL} Hide this banner: {_ENV_OFF}=1",
)
SETUP_LINES = (
- f"Browser setup failed? Skip it: the same crawler, hosted, nothing to install, free credit to start: {SETUP_URL}",
+ "Browser setup failed? Skip it: the same crawler, hosted, nothing to install, free credit to start.",
+ SETUP_URL,
)
@@ -48,32 +60,43 @@ def _home() -> Path:
return Path.home() / ".crawl4ai"
-def _minor_version() -> str:
- """This release's minor version, "0.9" for 0.9.3: the notice returns once per minor release."""
+def _version() -> str:
+ """This release's full version, "0.9.4": after the offer the banner returns once per version."""
try:
from .__version__ import __version__
- return ".".join(__version__.split(".")[:2])
+ return __version__
except Exception:
return ""
+def _today() -> str:
+ """Today's date in UTC, "2026-09-25": the daily markers compare this string."""
+ return time.strftime("%Y-%m-%d", time.gmtime())
+
+
def is_off() -> bool:
"""True when the operator turned the notice off with the environment variable."""
return os.environ.get(_ENV_OFF, "").strip().lower() in ("1", "true", "yes")
-def text() -> str:
- """The notice as one block of text."""
- return "\n".join(LINES)
+def text(lines=LINES) -> str:
+ """The banner as plain text: a rule, the lines indented by two spaces, a rule."""
+ return "\n".join([_RULE, *(f" {line}" for line in lines), _RULE])
def _print(lines, logger=None) -> None:
- if logger is not None:
- for line in lines:
- logger.info(line, tag="CLOUD")
- else:
- print("\n".join(lines))
+ """Print the banner in yellow, the first line bold, through the logger's console; without a logger,
+ through a console on stderr. Rich keeps the text plain when the output is not a terminal."""
+ from rich.console import Console
+ from rich.text import Text
+
+ console = getattr(logger, "console", None) or Console(stderr=True, width=200)
+ banner = Text(_RULE + "\n", style="yellow")
+ for i, line in enumerate(lines):
+ banner.append(f" {line}\n", style="bold yellow" if i == 0 else "yellow")
+ banner.append(_RULE, style="yellow")
+ console.print(banner, highlight=False, soft_wrap=True)
def _claim(name: str, value: str) -> bool:
@@ -91,32 +114,36 @@ def _claim(name: str, value: str) -> bool:
def show_at_install(logger=None) -> None:
- """Print the notice at the end of ``crawl4ai-setup``. Every run; nothing is remembered."""
+ """Print the banner at the end of ``crawl4ai-setup``. Every run; nothing is remembered."""
if is_off():
return
_print(LINES, logger)
def show_once(logger=None) -> bool:
- """Print the notice the first time the library or the CLI runs on this machine after a new minor
- release. Returns True when it printed."""
- if is_off() or not _claim(_MARKER, _minor_version() or "shown"):
+ """Print the banner when the library or the CLI runs: once a day per machine while the offer runs,
+ then once per version per machine. Returns True when it printed."""
+ if is_off():
+ return False
+ today = _today()
+ value = today if today < DAILY_UNTIL else (_version() or "shown")
+ if not _claim(_MARKER, value):
return False
_print(LINES, logger)
return True
def show_blocked(logger=None) -> bool:
- """Print the blocked line when a crawl hit anti-bot protection: the moment the cloud helps most.
+ """Print the blocked banner when a crawl hit anti-bot protection: the moment the cloud helps most.
At most once a day per machine. Returns True when it printed."""
- if is_off() or not _claim(_BLOCKED_MARKER, time.strftime("%Y-%m-%d", time.gmtime())):
+ if is_off() or not _claim(_BLOCKED_MARKER, _today()):
return False
_print(BLOCKED_LINES, logger)
return True
def show_setup_failed(logger=None) -> None:
- """Print the setup line when ``crawl4ai-setup`` could not install the browser."""
+ """Print the setup banner when ``crawl4ai-setup`` could not install the browser."""
if is_off():
return
_print(SETUP_LINES, logger)
diff --git a/docs/assets/cloud-launch-banner-dark.svg b/docs/assets/cloud-launch-banner-dark.svg
new file mode 100644
index 00000000..6f87b084
--- /dev/null
+++ b/docs/assets/cloud-launch-banner-dark.svg
@@ -0,0 +1,20 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 200" width="960" height="200" role="img" aria-label="Crawl4AI Cloud is live. Soft launch: your first $10 is on us until 31 December 2026, no card. Get your key.">
+ <defs>
+ <clipPath id="card"><rect x="0.5" y="0.5" width="959" height="199" rx="12"/></clipPath>
+ <linearGradient id="bar" x1="0" x2="1" y1="0" y2="0"><stop offset="0" stop-color="#f5a300"/><stop offset="1" stop-color="#4ae6e5"/></linearGradient>
+ </defs>
+ <rect x="0.5" y="0.5" width="959" height="199" rx="12" fill="#0d0d10" stroke="#2b2b33"/>
+ <g clip-path="url(#card)">
+ <rect x="0" y="0" width="960" height="4" fill="url(#bar)"/>
+ <path transform="translate(748 30) scale(9.5)" fill="#4ae6e5" fill-opacity="0.07" d="M19.35 10.04A7.49 7.49 0 0 0 12 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 0 0 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"/>
+ </g>
+ <g font-family="-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif">
+ <rect x="40" y="30" width="116" height="22" rx="11" fill="none" stroke="#4ae6e5" stroke-width="1.2"/>
+ <text x="98" y="45.5" text-anchor="middle" font-size="11" font-weight="700" letter-spacing="1.6" fill="#4ae6e5">SOFT LAUNCH</text>
+ <text x="40" y="92" font-size="30" font-weight="700" fill="#f0f6fc">Crawl4AI Cloud is live.</text>
+ <text x="40" y="129" font-size="30" font-weight="700" fill="#f5a300">Your first $10 is on us.</text>
+ <text x="40" y="164" font-size="14" fill="#9198a1">Until 31 December 2026 · no card · the library stays open source, forever.</text>
+ <rect x="720" y="76" width="200" height="48" rx="8" fill="#f5a300"/>
+ <text x="820" y="106" text-anchor="middle" font-size="18" font-weight="700" fill="#0d0d10">Get your key →</text>
+ </g>
+</svg>
diff --git a/docs/assets/cloud-launch-banner-light.svg b/docs/assets/cloud-launch-banner-light.svg
new file mode 100644
index 00000000..ac93a98c
--- /dev/null
+++ b/docs/assets/cloud-launch-banner-light.svg
@@ -0,0 +1,20 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 200" width="960" height="200" role="img" aria-label="Crawl4AI Cloud is live. Soft launch: your first $10 is on us until 31 December 2026, no card. Get your key.">
+ <defs>
+ <clipPath id="card"><rect x="0.5" y="0.5" width="959" height="199" rx="12"/></clipPath>
+ <linearGradient id="bar" x1="0" x2="1" y1="0" y2="0"><stop offset="0" stop-color="#f5a300"/><stop offset="1" stop-color="#0e7c86"/></linearGradient>
+ </defs>
+ <rect x="0.5" y="0.5" width="959" height="199" rx="12" fill="#ffffff" stroke="#d1d9e0"/>
+ <g clip-path="url(#card)">
+ <rect x="0" y="0" width="960" height="4" fill="url(#bar)"/>
+ <path transform="translate(748 30) scale(9.5)" fill="#0e7c86" fill-opacity="0.06" d="M19.35 10.04A7.49 7.49 0 0 0 12 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 0 0 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"/>
+ </g>
+ <g font-family="-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif">
+ <rect x="40" y="30" width="116" height="22" rx="11" fill="none" stroke="#0e7c86" stroke-width="1.2"/>
+ <text x="98" y="45.5" text-anchor="middle" font-size="11" font-weight="700" letter-spacing="1.6" fill="#0e7c86">SOFT LAUNCH</text>
+ <text x="40" y="92" font-size="30" font-weight="700" fill="#1f2328">Crawl4AI Cloud is live.</text>
+ <text x="40" y="129" font-size="30" font-weight="700" fill="#9a6700">Your first $10 is on us.</text>
+ <text x="40" y="164" font-size="14" fill="#59636e">Until 31 December 2026 · no card · the library stays open source, forever.</text>
+ <rect x="720" y="76" width="200" height="48" rx="8" fill="#f5a300"/>
+ <text x="820" y="106" text-anchor="middle" font-size="18" font-weight="700" fill="#0d0d10">Get your key →</text>
+ </g>
+</svg>
diff --git a/docs/assets/cloud-launch-social.png b/docs/assets/cloud-launch-social.png
new file mode 100644
index 00000000..fc7be88d
Binary files /dev/null and b/docs/assets/cloud-launch-social.png differ
diff --git a/docs/md_v2/core/installation.md b/docs/md_v2/core/installation.md
index 6cd44068..2226671e 100644
--- a/docs/md_v2/core/installation.md
+++ b/docs/md_v2/core/installation.md
@@ -126,4 +126,14 @@ Some older docs mention running Crawl4AI as a local server. This approach has be
5. **Docker** is **experimental**—use at your own risk until the stable version is released.
6. **Local server** references in older docs are largely deprecated; a new solution is in progress.
-**Got questions?** Check [GitHub issues](https://github.com/unclecode/crawl4ai/issues) for updates or ask the community!
\ No newline at end of file
+**Got questions?** Check [GitHub issues](https://github.com/unclecode/crawl4ai/issues) for updates or ask the community!
+
+## Version numbering
+
+Crawl4AI follows PEP 440: `MAJOR.MINOR.PATCH`, for example `0.9.4`. A pre-release carries a suffix: `dev` (unstable), `a` (alpha), `b` (beta), `rc` (release candidate).
+
+- The stable version: `pip install -U crawl4ai`
+- The latest pre-release: `pip install crawl4ai --pre`
+- One exact version: `pip install crawl4ai==0.9.4`
+
+Use the stable version in production. Pre-releases exist to test new features with real users before the final release.
diff --git a/docs/md_v2/index.md b/docs/md_v2/index.md
index 0229aff5..8eeb7361 100644
--- a/docs/md_v2/index.md
+++ b/docs/md_v2/index.md
@@ -1,4 +1,4 @@
-# 🚀🤖 Crawl4AI: Open-Source LLM-Friendly Web Crawler & Scraper
+# 🚀🤖 Crawl4AI: the open-source web crawler for LLMs and AI agents
<div class = "badges" align="center">
@@ -55,19 +55,60 @@
</div>
----
-#### 🚀 Crawl4AI Cloud API — Closed Beta (Launching Soon)
-Reliable, large-scale web extraction, now built to be _**drastically more cost-effective**_ than any of the existing solutions.
+Crawl4AI turns any website into clean, LLM-ready Markdown for RAG, AI agents and data pipelines. Run the open-source web crawler and scraper yourself, free forever, or use it hosted with one key: scrape, search and extract through one API, with MCP for your agent.
-👉 **Apply [here](https://forms.gle/E9MyPaNXACnAMaqG7) for early access**
-_We’ll be onboarding in phases and working closely with early users.
-Limited slots._
+## Two ways to use Crawl4AI
----
+### 🐍 Run it yourself: open source, forever
+
+```bash
+pip install -U crawl4ai
+crawl4ai-setup # installs the browser, once
+```
+
+```python
+import asyncio
+from crawl4ai import AsyncWebCrawler
+
+async def main():
+ async with AsyncWebCrawler() as crawler:
+ result = await crawler.arun(url="https://news.ycombinator.com")
+ print(result.markdown)
+
+asyncio.run(main())
+```
+
+Docker server, CLI and every option: [Installation](core/installation.md) · [Self-hosting](core/self-hosting.md)
+
+### ☁️ Or use the cloud: no browsers, no proxies
+
+1. [![Get a key in 10 seconds](https://img.shields.io/badge/Get_a_key_in_10_seconds-%241_pass%2C_no_signup-f5a300?style=for-the-badge&labelColor=0d0d10)](https://crawl4ai.com/?ref=docs)
+ Verify your email and your first $10 pack is on us (until 31 December 2026, then $5 to start). No card.
+2. Get any page as Markdown:
+
+ ```bash
+ curl -s https://api.crawl4ai.com/scrape \
+ -H "Authorization: Bearer $CRAWL4AI_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{"url": "https://news.ycombinator.com"}' | jq -r .markdown
+ ```
-Crawl4AI is the #1 trending GitHub repository, actively maintained by a vibrant community. It delivers blazing-fast, AI-ready web crawling tailored for large language models, AI agents, and data pipelines. Fully open source, flexible, and built for real-time performance, **Crawl4AI** empowers developers with unmatched speed, precision, and deployment ease.
+ The same key works for `/search`, `/answer`, `/extract` and many URLs at once (`/scrape/batch`, `/scrape/jobs`). Pay as you go: [live prices](https://crawl4ai.com/docs?ref=docs#pricing).
+3. Give it to your AI agent. Claude Code shown; [Codex, Cursor and OpenCode →](https://crawl4ai.com/docs?ref=docs#mcp)
-> Enjoy using Crawl4AI? Consider **[becoming a sponsor](https://github.com/sponsors/unclecode)** to support ongoing development and community growth!
+ ```bash
+ claude mcp add --transport http crawl4ai https://api.crawl4ai.com/mcp \
+ --header "Authorization: Bearer $CRAWL4AI_KEY"
+ ```
+
+### Which one?
+
+| | 🐍 Library | 🐳 Your own server | ☁️ Crawl4AI Cloud |
+|---|---|---|---|
+| **Runs the browsers** | you, in your Python process | you, in Docker on your machine | we do |
+| **JS-heavy pages and bot walls** | your settings, your proxies | your settings, your proxies | handled for you, automatically |
+| **Web search** | – | – | `/search` and `/answer` |
+| **Price** | free, forever | free (your hosting) | pay as you go; your first $10 is on us |
## 🆕 AI Assistant Skill Now Available!
@@ -97,29 +138,6 @@ Crawl4AI now features intelligent adaptive crawling that knows when to stop! Usi
[Learn more about Adaptive Crawling →](core/adaptive-crawling.md)
-## Quick Start
-
-Here's a quick example to show you how easy it is to use Crawl4AI with its asynchronous capabilities:
-
-```python
-import asyncio
-from crawl4ai import AsyncWebCrawler
-
-async def main():
- # Create an instance of AsyncWebCrawler
- async with AsyncWebCrawler() as crawler:
- # Run the crawler on a URL
- result = await crawler.arun(url="https://crawl4ai.com")
-
- # Print the extracted content
- print(result.markdown)
-
-# Run the async main function
-asyncio.run(main())
-```
-
----
-
## Video Tutorial
<div align="center">
diff --git a/tests/unit/test_cloud_notice.py b/tests/unit/test_cloud_notice.py
new file mode 100644
index 00000000..555f30f9
--- /dev/null
+++ b/tests/unit/test_cloud_notice.py
@@ -0,0 +1,70 @@
+"""The cloud notice: when it prints, and what it prints."""
+
+import io
+
+import pytest
+from rich.console import Console
+
+from crawl4ai import cloud_notice
+
+
+def home(tmp_path, monkeypatch):
+ """The marker files go to a temporary home folder; the notice is on."""
+ monkeypatch.setattr(cloud_notice, "_home", lambda: tmp_path)
+ monkeypatch.delenv(cloud_notice._ENV_OFF, raising=False)
+ return tmp_path
+
+
+def _render(lines) -> str:
+ """The banner as a terminal without colour would show it."""
+ out = io.StringIO()
+ console = Console(file=out, width=200, force_terminal=False, color_system=None)
+ cloud_notice._print(lines, logger=type("L", (), {"console": console})())
+ return out.getvalue()
+
+
+def test_the_environment_variable_turns_every_banner_off(home, monkeypatch):
+ monkeypatch.setenv(cloud_notice._ENV_OFF, "1")
+ assert cloud_notice.show_once() is False
+ assert cloud_notice.show_blocked() is False
+ assert not (home / cloud_notice._MARKER).exists()
+
+
+def test_daily_while_the_offer_runs_then_once_per_version(home, monkeypatch):
+ printed = []
+ monkeypatch.setattr(cloud_notice, "_print", lambda lines, logger=None: printed.append(lines))
+ monkeypatch.setattr(cloud_notice, "_version", lambda: "0.9.4")
+
+ monkeypatch.setattr(cloud_notice, "_today", lambda: "2026-10-01")
+ assert cloud_notice.show_once() is True
+ assert cloud_notice.show_once() is False, "the same day prints once"
+ monkeypatch.setattr(cloud_notice, "_today", lambda: "2026-10-02")
+ assert cloud_notice.show_once() is True, "the next day prints again"
+
+ monkeypatch.setattr(cloud_notice, "_today", lambda: "2027-01-01")
+ assert cloud_notice.show_once() is True, "the first run after the offer prints once per version"
+ monkeypatch.setattr(cloud_notice, "_today", lambda: "2027-01-02")
+ assert cloud_notice.show_once() is False, "the next day, same version: quiet"
+ monkeypatch.setattr(cloud_notice, "_version", lambda: "0.9.5")
+ assert cloud_notice.show_once() is True, "a new version, a patch included, prints again"
+ assert len(printed) == 4
+
+
+def test_the_blocked_banner_prints_once_a_day(home, monkeypatch):
+ monkeypatch.setattr(cloud_notice, "_print", lambda lines, logger=None: None)
+ monkeypatch.setattr(cloud_notice, "_today", lambda: "2026-10-01")
+ assert cloud_notice.show_blocked() is True
+ assert cloud_notice.show_blocked() is False
+ monkeypatch.setattr(cloud_notice, "_today", lambda: "2026-10-02")
+ assert cloud_notice.show_blocked() is True
+
+
+def test_the_banner_is_ascii_with_the_link_and_the_off_switch():
+ for lines in (cloud_notice.LINES, cloud_notice.BLOCKED_LINES, cloud_notice.SETUP_LINES):
+ shown = _render(lines)
+ assert shown.isascii(), "every console can print it"
+ assert shown.startswith(cloud_notice._RULE) and shown.rstrip().endswith(cloud_notice._RULE)
+ assert "https://crawl4ai.com/?ref=" in shown
+ assert cloud_notice._ENV_OFF in _render(cloud_notice.LINES)
+ assert cloud_notice.text() == _render(cloud_notice.LINES).rstrip("\n")