Crawl4AI

Welcome to the official documentation for Crawl4AI! πŸ•·οΈπŸ€– Crawl4AI is an open-source Python library designed to simplify web crawling and extract useful information from web pages. This documentation will guide you through the features, usage, and customization of Crawl4AI.

Introduction

Crawl4AI has one clear task: to make crawling and data extraction from web pages easy and efficient, especially for large language models (LLMs) and AI applications. Whether you are using it as a REST API or a Python library, Crawl4AI offers a robust and flexible solution with full asynchronous support.

Quick Start

Here's a quick example to show you how easy it is to use Crawl4AI with its asynchronous capabilities:

import asyncio
from crawl4ai import AsyncWebCrawler

async def main():
    # Create an instance of AsyncWebCrawler
    async with AsyncWebCrawler(verbose=True) as crawler:
        # Run the crawler on a URL
        result = await crawler.arun(url="https://www.nbcnews.com/business")

        # Print the extracted content
        print(result.markdown)

# Run the async main function
asyncio.run(main())

Key Features ✨

  • πŸ†“ Completely free and open-source
  • πŸš€ Blazing fast performance, outperforming many paid services
  • πŸ€– LLM-friendly output formats (JSON, cleaned HTML, markdown)
  • πŸ“„ Fit markdown generation for extracting main article content.
  • 🌐 Multi-browser support (Chromium, Firefox, WebKit)
  • 🌍 Supports crawling multiple URLs simultaneously
  • 🎨 Extracts and returns all media tags (Images, Audio, and Video)
  • πŸ”— Extracts all external and internal links
  • πŸ“š Extracts metadata from the page
  • πŸ”„ Custom hooks for authentication, headers, and page modifications
  • πŸ•΅οΈ User-agent customization
  • πŸ–ΌοΈ Takes screenshots of pages with enhanced error handling
  • πŸ“œ Executes multiple custom JavaScripts before crawling
  • πŸ“Š Generates structured output without LLM using JsonCssExtractionStrategy
  • πŸ“š Various chunking strategies: topic-based, regex, sentence, and more
  • 🧠 Advanced extraction strategies: cosine clustering, LLM, and more
  • 🎯 CSS selector support for precise data extraction
  • πŸ“ Passes instructions/keywords to refine extraction
  • πŸ”’ Proxy support with authentication for enhanced access
  • πŸ”„ Session management for complex multi-page crawling
  • 🌐 Asynchronous architecture for improved performance
  • πŸ–ΌοΈ Improved image processing with lazy-loading detection
  • πŸ•°οΈ Enhanced handling of delayed content loading
  • πŸ”‘ Custom headers support for LLM interactions
  • πŸ–ΌοΈ iframe content extraction for comprehensive analysis
  • ⏱️ Flexible timeout and delayed content retrieval options

Documentation Structure

Our documentation is organized into several sections:

Basic Usage

Advanced Features

Extraction & Processing

API Reference

Examples

  • Coming soon!

Getting Started

  1. Install Crawl4AI:

    pip install crawl4ai
    

  2. Check out our Quick Start Guide to begin crawling web pages.

  3. Explore our examples to see Crawl4AI in action.

Support

For questions, suggestions, or issues: - GitHub Issues: Report a Bug - Twitter: @unclecode - Website: crawl4ai.com

Happy Crawling! πŸ•ΈοΈπŸš€