All notable changes to Crawl4AI will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- 🔒 CRITICAL: Remote Code Execution Fix: Removed
__import__from hook allowed builtins- Prevents arbitrary module imports in user-provided hook code
- Hooks now disabled by default via
CRAWL4AI_HOOKS_ENABLEDenvironment variable - Credit: Neo by ProjectDiscovery
- 🔒 HIGH: Local File Inclusion Fix: Added URL scheme validation to Docker API endpoints
- Blocks
file://,javascript:,data:URLs on/execute_js,/screenshot,/pdf,/html - Only allows
http://,https://, andraw:URLs - Credit: Neo by ProjectDiscovery
- Blocks
- Docker API: Hooks disabled by default: Set
CRAWL4AI_HOOKS_ENABLED=trueto enable - Docker API: file:// URLs blocked: Use Python library directly for local file processing
- 🚀 init_scripts for BrowserConfig: Pre-page-load JavaScript injection for stealth evasions
- 🔄 CDP Connection Improvements: WebSocket URL support, proper cleanup, browser reuse
- 💾 Crash Recovery for Deep Crawl:
resume_stateandon_state_changefor BFS/DFS/Best-First strategies - 📄 PDF/MHTML for raw:/file:// URLs: Generate PDFs and MHTML from cached HTML content
- 📸 Screenshots for raw:/file:// URLs: Render cached HTML and capture screenshots
- 🔗 base_url Parameter: Proper URL resolution for raw: HTML processing
- ⚡ Prefetch Mode: Two-phase deep crawling with fast link extraction
- 🔀 Enhanced Proxy Support: Improved proxy rotation and sticky sessions
- 🌐 HTTP Strategy Proxy Support: Non-browser crawler now supports proxies
- 🖥️ Browser Pipeline for raw:/file://: New
process_in_browserparameter - 📋 Smart TTL Cache for Sitemap Seeder:
cache_ttl_hoursandvalidate_sitemap_lastmodparameters - 📚 Security Documentation: Added SECURITY.md with vulnerability reporting guidelines
- raw: URL Parsing: Fixed truncation at
#character (CSS color codes like#eee) - Caching System: Various improvements to cache validation and persistence
- Multi-sample schema generation section
- URL seeder smart TTL cache parameters
- v0.8.0 migration guide
- Security policy and disclosure process
- 🔒 HTTPS Preservation for Internal Links: New
preserve_https_for_internal_linksconfiguration flag- Maintains HTTPS scheme for internal links even when servers redirect to HTTP
- Prevents security downgrades during deep crawling
- Useful for security-conscious crawling and sites supporting both protocols
- Fully backward compatible with opt-in flag (default:
False) - Fixes issue #1410 where HTTPS URLs were being downgraded to HTTP
-
🕵️ Undetected Browser Support: New browser adapter pattern with stealth capabilities
browser_adapter.pywith undetected Chrome integration- Bypass sophisticated bot detection systems (Cloudflare, Akamai, custom solutions)
- Support for headless stealth mode with anti-detection techniques
- Human-like behavior simulation with random mouse movements and scrolling
- Comprehensive examples for anti-bot strategies and stealth crawling
- Full documentation guide for undetected browser usage
-
🎨 Multi-URL Configuration System: URL-specific crawler configurations for batch processing
- Different crawling strategies for different URL patterns in a single batch
- Support for string patterns with wildcards (
"*.pdf","*/blog/*") - Lambda function matchers for complex URL logic
- Mixed matchers combining strings and functions with AND/OR logic
- Fallback configuration support when no patterns match
- First-match-wins configuration selection with optional fallback
-
🧠 Memory Monitoring & Optimization: Comprehensive memory usage tracking
- New
memory_utils.pymodule for memory monitoring and optimization - Real-time memory usage tracking during crawl sessions
- Memory leak detection and reporting
- Performance optimization recommendations
- Peak memory usage analysis and efficiency metrics
- Automatic cleanup suggestions for memory-intensive operations
- New
-
📊 Enhanced Table Extraction: Improved table access and DataFrame conversion
- Direct
result.tablesinterface replacing genericresult.mediaapproach - Instant pandas DataFrame conversion with
pd.DataFrame(table['data']) - Enhanced table detection algorithms for better accuracy
- Table metadata including source XPath and headers
- Improved table structure preservation during extraction
- Direct
-
💰 GitHub Sponsors Integration: 4-tier sponsorship system
- Supporter ($5/month): Community support + early feature previews
- Professional ($25/month): Priority support + beta access
- Business ($100/month): Direct consultation + custom integrations
- Enterprise ($500/month): Dedicated support + feature development
- Custom arrangement options for larger organizations
-
🐳 Docker LLM Provider Flexibility: Environment-based LLM configuration
LLM_PROVIDERenvironment variable support for dynamic provider switching.llm.envfile support for secure configuration management- Per-request provider override capabilities in API endpoints
- Support for OpenAI, Groq, and other providers without rebuilding images
- Enhanced Docker documentation with deployment examples
- URL Matcher Fallback: Resolved edge cases in URL pattern matching logic
- Memory Management: Fixed memory leaks in long-running crawl sessions
- Sitemap Processing: Improved redirect handling in sitemap fetching
- Table Extraction: Enhanced table detection and extraction accuracy
- Error Handling: Better error messages and recovery from network failures
- Architecture Refactoring: Major cleanup and optimization
- Moved 2,450+ lines from main
async_crawler_strategy.pyto backup - Cleaner separation of concerns in crawler architecture
- Better maintainability and code organization
- Preserved backward compatibility while improving performance
- Moved 2,450+ lines from main
- Comprehensive Examples: Added real-world URLs and practical use cases
- API Documentation: Complete CrawlResult field documentation with all available fields
- Migration Guides: Updated table extraction patterns from
result.mediatoresult.tables - Undetected Browser Guide: Full documentation for stealth mode and anti-bot strategies
- Multi-Config Examples: Detailed examples for URL-specific configurations
- Docker Deployment: Enhanced Docker documentation with LLM provider configuration
- Virtual Scroll Support: New
VirtualScrollConfigfor handling virtualized scrolling on modern websites- Automatically detects and handles three scrolling scenarios:
- Content unchanged (continue scrolling)
- Content appended (traditional infinite scroll)
- Content replaced (true virtual scroll - Twitter/Instagram style)
- Captures ALL content from pages that replace DOM elements during scroll
- Intelligent deduplication based on normalized text content
- Configurable scroll amount, count, and wait times
- Seamless integration with existing extraction strategies
- Comprehensive examples including Twitter timeline, Instagram grid, and mixed content scenarios
- Automatically detects and handles three scrolling scenarios:
- Flexible LLM Provider Configuration (Docker):
- Support for
LLM_PROVIDERenvironment variable to override default provider - Per-request provider override via optional
providerparameter in API endpoints - Automatic provider validation with clear error messages
- Updated Docker documentation and examples
- Support for
- WebScrapingStrategy Refactoring: Simplified content scraping architecture
WebScrapingStrategyis now an alias forLXMLWebScrapingStrategyfor backward compatibility- Removed redundant BeautifulSoup-based implementation (~1000 lines of code)
LXMLWebScrapingStrategynow inherits directly fromContentScrapingStrategy- All existing code using
WebScrapingStrategycontinues to work without modification - Default scraping strategy remains
LXMLWebScrapingStrategyfor optimal performance
- AsyncUrlSeeder: High-performance URL discovery system for intelligent crawling at scale
- Discover URLs from sitemaps and Common Crawl index
- Extract and analyze page metadata without full crawling
- BM25 relevance scoring for query-based URL filtering
- Multi-domain parallel discovery with
many_urls()method - Automatic caching with TTL for discovered URLs
- Rate limiting and concurrent request management
- Live URL validation with HEAD requests
- JSON-LD and Open Graph metadata extraction
- SeedingConfig: Configuration class for URL seeding operations
- Support for multiple discovery sources (
sitemap,cc,sitemap+cc) - Pattern-based URL filtering with wildcards
- Configurable concurrency and rate limiting
- Query-based relevance scoring with BM25
- Score threshold filtering for quality control
- Support for multiple discovery sources (
- Comprehensive documentation for URL seeding feature
- Detailed comparison with deep crawling approaches
- Complete API reference with examples
- Integration guide with AsyncWebCrawler
- Performance benchmarks and best practices
- Example scripts demonstrating URL seeding:
url_seeder_demo.py: Interactive Rich-based demonstrationurl_seeder_quick_demo.py: Screenshot-friendly examples
- Test suite for URL seeding with BM25 scoring
- Updated
__init__.pyto export AsyncUrlSeeder and SeedingConfig - Enhanced documentation with URL seeding integration examples
- Corrected examples to properly extract URLs from seeder results before passing to
arun_many() - Fixed logger color compatibility issue (changed
lightblacktobright_black)
- New
RegexExtractionStrategyfor fast pattern-based extraction without requiring LLM- Built-in patterns for emails, URLs, phone numbers, dates, and more
- Support for custom regex patterns
generate_patternutility for LLM-assisted pattern creation (one-time use)
- Added
fit_htmlas a top-level field inCrawlResultfor optimized HTML extraction - Added support for network response body capture in network request tracking
- Updated documentation for no-LLM extraction strategies
- Enhanced API reference to include RegexExtractionStrategy examples and usage
- Improved HTML preprocessing with optimized performance for extraction strategies
- New dedicated
tablesfield inCrawlResultmodel for better table extraction handling - Updated crypto_analysis_example.py to use the new tables field with backward compatibility
- Improved playground UI in Docker deployment with better endpoint handling and UI feedback
- Browser pooling with page pre‑warming and fine‑grained geolocation, locale, and timezone controls
- Crawler pool manager (SDK + Docker API) for smarter resource allocation
- Network & console log capture plus MHTML snapshot export
- Table extractor: turn HTML
<table>s into DataFrames or CSV with one flag - High‑volume stress‑test framework in
tests/memoryand API load scripts - MCP protocol endpoints with socket & SSE support; playground UI scaffold
- Docs v2 revamp: TOC, GitHub badge, copy‑code buttons, Docker API demo
- “Ask AI” helper button (work‑in‑progress, shipping soon)
- New examples: geo‑location usage, network/console capture, Docker API, markdown source selection, crypto analysis
- Expanded automated test suites for browser, Docker, MCP and memory benchmarks
- Consolidated and renamed browser strategies; legacy docker strategy modules removed
ProxyConfigmoved toasync_configs- Server migrated to pool‑based crawler management
- FastAPI validators replace custom query validation
- Docker build now uses Chromium base image
- Large‑scale repo tidy‑up (≈36 k insertions, ≈5 k deletions)
- Async crawler session leak, duplicate‑visit handling, URL normalisation
- Target‑element regressions in scraping strategies
- Logged‑URL readability, encoded‑URL decoding, middle truncation for long URLs
- Closed issues: #701, #733, #756, #774, #804, #822, #839, #841, #842, #843, #867, #902, #911
- Obsolete modules under
crawl4ai/browser/*superseded by the new pooled browser layer
- Old markdown generator names now alias
DefaultMarkdownGeneratorand emit warnings
- Update any direct imports from
crawl4ai/browser/*to the new pooled browser modules - If you override
AsyncPlaywrightCrawlerStrategy.get_page, adopt the new signature - Rebuild Docker images to pull the new Chromium layer
- Switch to
DefaultMarkdownGenerator(or silence the deprecation warning)
121 files changed, ≈36 223 insertions, ≈4 975 deletions :contentReference[oaicite:0]{index=0}:contentReference[oaicite:1]{index=1}
- Implemented MCP protocol for machine-to-machine communication
- Added WebSocket and SSE transport for MCP server
- Exposed server endpoints via MCP protocol
- Created tests for MCP socket and SSE communication
- Enhanced Docker server with file handling and intelligent search
- Added PDF and screenshot endpoints with file saving capability
- Added JavaScript execution endpoint for page interaction
- Implemented advanced context search with BM25 and code chunking
- Added file path output support for generated assets
- Improved server endpoints and API surface
- Added intelligent context search with query filtering
- Added syntax-aware code function chunking
- Implemented efficient HTML processing pipeline
- Added support for controlling browser geolocation via new GeolocationConfig class
- Added locale and timezone configuration options to CrawlerRunConfig
- Added example script demonstrating geolocation and locale usage
- Added documentation for location-based identity features
- Replaced crawler_manager.py with simpler crawler_pool.py implementation
- Added global page semaphore for hard concurrency cap
- Implemented browser pool with idle cleanup
- Added playground UI for testing and stress testing
- Updated API handlers to use pooled crawlers
- Enhanced logging levels and symbols
- Added memory tests and stress test utilities
- Added content source selection feature for markdown generation
- New
content_sourceparameter allows choosing betweencleaned_html,raw_html, andfit_html - Provides flexibility in how HTML content is processed before markdown conversion
- Added examples and documentation for the new feature
- Includes backward compatibility with default
cleaned_htmlbehavior
- New
- (crawler) Add experimental parameters dictionary to CrawlerRunConfig to support beta features
- (tables) Add comprehensive table detection and extraction functionality with scoring system
- (monitor) Add real-time crawler monitoring system with memory management
- (content) Add target_elements parameter for selective content extraction
- (browser) Add standalone CDP browser launch capability
- (schema) Add preprocess_html_for_schema utility for better HTML cleaning
- (api) Add special handling for single URL requests in Docker API
- (filters) Add reverse option to URLPatternFilter for inverting filter logic
- (browser) Make CSP nonce headers optional via experimental config
- (browser) Remove default cookie injection from page initialization
- (crawler) Optimize response handling for single-URL processing
- (api) Refactor crawl request handling to streamline processing
- (config) Update default provider to gpt-4o
- (cache) Change default cache_mode from aggressive to bypass in examples
- (browser) Clean up browser context creation code
- (api) Improve code formatting in API handler
- WebScrapingStrategy no longer returns 'scraped_html' in its output dictionary
- Table extraction logic has been modified to better handle thead/tbody structures
- Default cookie injection has been removed from page initialization
- (profiles) Add BrowserProfiler class for dedicated browser profile management
- (cli) Add interactive profile management to CLI with rich UI
- (profiles) Add ability to crawl directly from profile management interface
- (browser) Support identity-based browsing with persistent profiles
- (deep-crawling) Add max_pages parameter to limit the number of pages crawled in all deep crawling strategies
- (deep-crawling) Add score_threshold parameter to BFS and DFS strategies to filter URLs by score
- (browser) Refactor profile management from ManagedBrowser to BrowserProfiler class
- (cli) Enhance CLI with profile selection and status display for crawling
- (examples) Update identity-based browsing example to use BrowserProfiler class
- (docs) Update identity-based crawling documentation
- (docs) Update deep crawling documentation with max_pages and score_threshold parameters
- (examples) Add example demonstrating the use of max_pages and score_threshold parameters
- (browser) Fix profile detection and management on different platforms
- (cli) Fix CLI command structure for better user experience
- (deep-crawling) Improve BFS and DFS strategies to handle page count limits more efficiently
- (crawler) [breaking] Add memory-adaptive dispatcher with rate limiting
- (scraping) [breaking] Add LXML-based scraping mode for improved performance
- (content-filter) Add LLMContentFilter for intelligent markdown generation
- (dispatcher) [breaking] Add streaming support for URL processing
- (browser) [breaking] Improve browser context management and add shared data support
- (config) [breaking] Add streaming support and config cloning
- (crawler) Add URL redirection tracking
- (extraction) Add LLM-powered schema generation utility
- (proxy) Add proxy configuration support to CrawlerRunConfig
- (robots) Add robots.txt compliance support
- (release) [breaking] Prepare v0.4.3 beta release
- (proxy) Add proxy rotation support and documentation
- (browser) Add CDP URL configuration support
- (demo) Uncomment feature demos and add fake-useragent dependency
- (pdf) Add PDF processing capabilities
- (crawler) [breaking] Enhance JavaScript execution and PDF processing
- (docker) Add Docker deployment configuration and API server
- (docker) Add Docker service integration and config serialization
- (docker) [breaking] Enhance Docker deployment setup and configuration
- (api) Improve cache handling and add API tests
- (crawler) [breaking] Add deep crawling capabilities with BFS strategy
- (proxy) [breaking] Add proxy rotation strategy
- (deep-crawling) Add DFS strategy and update exports; refactor CLI entry point
- (cli) Add command line interface with comprehensive features
- (config) Enhance serialization and add deep crawling exports
- (crawler) Add HTTP crawler strategy for lightweight web scraping
- (docker) [breaking] Implement supervisor and secure API endpoints
- (docker) [breaking] Add JWT authentication and improve server architecture
- (browser) Update browser channel default to 'chromium' in BrowserConfig.from_args method
- (crawler) Optimize response handling and default settings
- (crawler) - Update hello_world example with proper content filtering
-
- Update hello_world.py example
- (docs) [breaking] Reorganize documentation structure and update styles
- (dispatcher) [breaking] Migrate to modular dispatcher system with enhanced monitoring
- (scraping) [breaking] Replace ScrapingMode enum with strategy pattern
- (browser) Improve browser path management
- (models) Rename final_url to redirected_url for consistency
- (core) [breaking] Improve type hints and remove unused file
- (docs) Improve code formatting in features demo
- (user-agent) Improve user agent generation system
- (core) [breaking] Reorganize project structure and remove legacy code
- (docker) Clean up import statements in server.py
- (docker) Remove unused models and utilities for cleaner codebase
- (docker) [breaking] Improve server architecture and configuration
- (deep-crawl) [breaking] Reorganize deep crawling functionality into dedicated module
- (deep-crawling) [breaking] Reorganize deep crawling strategies and add new implementations
- (crawling) [breaking] Improve type hints and code cleanup
- (crawler) [breaking] Improve HTML handling and cleanup codebase
- (crawler) [breaking] Remove content filter functionality
- (examples) Update API usage in features demo
- (config) [breaking] Enhance serialization and config handling
- Add Code of Conduct for the project (#410)
- (extraction) Add clarifying comments for CSS selector behavior
- (readme) Update personal story and project vision
- (urls) [breaking] Update documentation URLs to new domain
- (api) Add streaming mode documentation and examples
- (readme) Update version and feature announcements for v0.4.3b1
- (examples) Update demo scripts and fix output formats
- (examples) Update v0.4.3 features demo to v0.4.3b2
- (readme) Update version references and fix links
- (multi-url) [breaking] Improve documentation clarity and update examples
- (examples) Update proxy rotation demo and disable other demos
- (api) Improve formatting and readability of API documentation
- (examples) Add SERP API project example
- (urls) Update documentation URLs to new domain
- (readme) Resolve merge conflict and update version info
- (browser) Update default browser channel to chromium and simplify channel selection logic
- (browser) [breaking] Default to Chromium channel for new headless mode (#387)
- (browser) Resolve merge conflicts in browser channel configuration
- Prevent memory leaks by ensuring proper closure of Playwright pages
- Not working long page screenshot (#403)
- (extraction) JsonCss selector and crawler improvements
- (models) [breaking] Make model fields optional with default values
- (dispatcher) Adjust memory threshold and fix dispatcher initialization
- (install) Ensure proper exit after running doctor command
- (cleanup) Remove unused files and improve type hints
- Add .gitattributes file
Crawl4AI v0.5.0 updates the license to Apache 2.0 with a required attribution clause. This means you are free to use, modify, and distribute Crawl4AI (even commercially), but you must clearly attribute the project in any public use or distribution. See the updated LICENSE file for the full legal text and specific requirements.
This release introduces several powerful new features, including robots.txt compliance, dynamic proxy support, LLM-powered schema generation, and improved documentation.
-
Robots.txt Compliance:
- Added robots.txt compliance support with efficient SQLite-based caching.
- New
check_robots_txtparameter inCrawlerRunConfigto enable robots.txt checking before crawling a URL. - Automated robots.txt checking is now integrated into
AsyncWebCrawlerwith 403 status codes for blocked URLs.
-
Proxy Configuration:
- Added proxy configuration support to
CrawlerRunConfig, allowing dynamic proxy settings per crawl request. - Updated documentation with examples for using proxy configuration in crawl operations.
- Added proxy configuration support to
-
LLM-Powered Schema Generation:
- Introduced a new utility for automatic CSS and XPath schema generation using OpenAI or Ollama models.
- Added comprehensive documentation and examples for schema generation.
- New prompt templates optimized for HTML schema analysis.
-
URL Redirection Tracking:
- Added URL redirection tracking to capture the final URL after any redirects.
- The final URL is now available in the
redirected_urlfield of theAsyncCrawlResponseobject.
-
Enhanced Streamlined Documentation:
- Refactored and improved the documentation structure for clarity and ease of use.
- Added detailed explanations of new features and updated examples.
-
Improved Browser Context Management:
- Enhanced the management of browser contexts and added shared data support.
- Introduced the
shared_dataparameter inCrawlerRunConfigto pass data between hooks.
-
Memory Dispatcher System:
- Migrated to a memory dispatcher system with enhanced monitoring capabilities.
- Introduced
MemoryAdaptiveDispatcherandSemaphoreDispatcherfor improved resource management. - Added
RateLimiterfor rate limiting support. - New
CrawlerMonitorfor real-time monitoring of crawler operations.
-
Streaming Support:
- Added streaming support for processing crawled URLs as they are processed.
- Enabled streaming mode with the
streamparameter inCrawlerRunConfig.
-
Content Scraping Strategy:
- Introduced a new
LXMLWebScrapingStrategyfor faster content scraping. - Added support for selecting the scraping strategy via the
scraping_strategyparameter inCrawlerRunConfig.
- Introduced a new
-
Browser Path Management:
- Improved browser path management for consistent behavior across different environments.
-
Memory Threshold:
- Adjusted the default memory threshold to improve resource utilization.
-
Pydantic Model Fields:
- Made several model fields optional with default values to improve flexibility.
-
Documentation Structure:
- Reorganized documentation structure to improve navigation and readability.
- Updated styles and added new sections for advanced features.
-
Scraping Mode:
- Replaced the
ScrapingModeenum with a strategy pattern for more flexible content scraping.
- Replaced the
-
Version Update:
- Updated the version to
0.4.248.
- Updated the version to
-
Code Cleanup:
- Removed unused files and improved type hints.
- Applied Ruff corrections for code quality.
-
Updated dependencies:
- Updated dependencies to their latest versions to ensure compatibility and security.
-
Ignored certain patterns and directories:
- Updated
.gitignoreand.codeiumignoreto ignore additional patterns and directories, streamlining the development environment.
- Updated
-
Simplified Personal Story in README:
- Streamlined the personal story and project vision in the
README.mdfor clarity.
- Streamlined the personal story and project vision in the
-
Removed Deprecated Files:
- Deleted several deprecated files and examples that are no longer relevant.
Previous Releases:
- Enhanced SSL & Security: New SSL certificate handling with custom paths and validation options for secure crawling.
- Smart Content Filtering: Advanced filtering system with regex support and efficient chunking strategies.
- Improved JSON Extraction: Support for complex JSONPath, JSON-CSS, and Microdata extraction.
- New Field Types: Added
computed,conditional,aggregate, andtemplatefield types. - Performance Boost: Optimized caching, parallel processing, and memory management.
- Better Error Handling: Enhanced debugging capabilities with detailed error tracking.
- Security Features: Improved input validation and safe expression evaluation.
- Windows Event Loop Configuration: Introduced a utility function
configure_windows_event_loopto resolveNotImplementedErrorfor asyncio subprocesses on Windows. (#utils.py, #tutorials/async-webcrawler-basics.md) page_need_scrollMethod: Added a method to determine if a page requires scrolling before taking actions inAsyncPlaywrightCrawlerStrategy. (#async_crawler_strategy.py)
- Version Bump: Updated the version from
0.4.246to0.4.247. (#version.py) - Improved Scrolling Logic: Enhanced scrolling methods in
AsyncPlaywrightCrawlerStrategyby adding ascroll_delayparameter for better control. (#async_crawler_strategy.py) - Markdown Generation Example: Updated the
hello_world.pyexample to reflect the latest API changes and better illustrate features. (#examples/hello_world.py) - Documentation Update:
- Added Windows-specific instructions for handling asyncio event loops. (#async-webcrawler-basics.md)
- Legacy Markdown Generation Code: Removed outdated and unused code for markdown generation in
content_scraping_strategy.py. (#content_scraping_strategy.py)
- Page Closing to Prevent Memory Leaks:
- Description: Added a
finallyblock to ensure pages are closed when nosession_idis provided. - Impact: Prevents memory leaks caused by lingering pages after a crawl.
- File:
async_crawler_strategy.py - Code:
finally: # If no session_id is given we should close the page if not config.session_id: await page.close()
- Description: Added a
- Multiple Element Selection: Modified
_get_elementsinJsonCssExtractionStrategyto return all matching elements instead of just the first one, ensuring comprehensive extraction. (#extraction_strategy.py) - Error Handling in Scrolling: Added robust error handling to ensure scrolling proceeds safely even if a configuration is missing. (#async_crawler_strategy.py)
- Windows Event Loop Configuration: Introduced a utility function
configure_windows_event_loopto resolveNotImplementedErrorfor asyncio subprocesses on Windows. (#utils.py, #tutorials/async-webcrawler-basics.md) page_need_scrollMethod: Added a method to determine if a page requires scrolling before taking actions inAsyncPlaywrightCrawlerStrategy. (#async_crawler_strategy.py)
-
Browser and SSL Handling
- SSL certificate validation options in extraction strategies
- Custom certificate paths support
- Configurable certificate validation skipping
- Enhanced response status code handling with retry logic
-
Content Processing
- New content filtering system with regex support
- Advanced chunking strategies for large content
- Memory-efficient parallel processing
- Configurable chunk size optimization
-
JSON Extraction
- Complex JSONPath expression support
- JSON-CSS and Microdata extraction
- RDFa parsing capabilities
- Advanced data transformation pipeline
-
Field Types
- New field types:
computed,conditional,aggregate,template - Field inheritance system
- Reusable field definitions
- Custom validation rules
- New field types:
-
Performance
- Optimized selector compilation with caching
- Improved HTML parsing efficiency
- Enhanced memory management for large documents
- Batch processing optimizations
-
Error Handling
- More detailed error messages and categorization
- Enhanced debugging capabilities
- Improved performance metrics tracking
- Better error recovery mechanisms
- Old field computation method using
eval - Direct browser manipulation without proper SSL handling
- Simple text-based content filtering
- Legacy extraction patterns without proper error handling
- Unsafe eval-based field computation
- Direct DOM manipulation without sanitization
- Memory leaks in large document processing
- SSL certificate validation issues
- Incorrect handling of nested JSON structures
- Performance bottlenecks in parallel processing
- Improved input validation and sanitization
- Safe expression evaluation system
- Enhanced resource protection
- Rate limiting implementation
text_mode(boolean): Enables text-only mode, disables images, JavaScript, and GPU-related features for faster, minimal rendering.light_mode(boolean): Optimizes the browser by disabling unnecessary background processes and features for efficiency.viewport_widthandviewport_height: Dynamically adjusts based ontext_modemode (default values: 800x600 fortext_mode, 1920x1080 otherwise).extra_args: Adds browser-specific flags fortext_modemode.adjust_viewport_to_content: Dynamically adjusts the viewport to the content size for accurate rendering.
- Added
viewportadjustments: Dynamically computed based ontext_modeor custom configuration. - Enhanced support for
light_modeandtext_modeby adding specific browser arguments to reduce resource consumption.
- Full Page Scan Feature:
- Scrolls through the entire page while dynamically detecting content changes.
- Ensures scrolling stops when no new dynamic content is loaded.
- Added
create_sessionmethod:- Creates a new browser session and assigns a unique ID.
- Supports persistent and non-persistent contexts with full compatibility for cookies, headers, and proxies.
adjust_viewport_to_content:- Automatically adjusts viewport to match content dimensions.
- Includes scaling via Chrome DevTools Protocol (CDP).
- Enhanced content loading:
- Waits for images to load and ensures network activity is idle before proceeding.
- Improved error handling and detailed logging for:
- Viewport adjustment (
adjust_viewport_to_content). - Full page scanning (
scan_full_page). - Dynamic content loading.
- Viewport adjustment (
- Removed hardcoded viewport dimensions in multiple places, replaced with dynamic values (
self.viewport_width,self.viewport_height). - Removed commented-out and unused code for better readability.
- Added default value for
delay_before_return_htmlparameter.
- Reduced resource usage in
light_modeby disabling unnecessary browser features such as extensions, background timers, and sync. - Improved compatibility for different browser types (
chrome,firefox,webkit).
- Changed schema reference for
LLMExtractionStrategy:- Old:
OpenAIModelFee.schema() - New:
OpenAIModelFee.model_json_schema() - This likely ensures better compatibility with the
OpenAIModelFeeclass and its JSON schema.
- Old:
- Improved extraction instruction for schema-based LLM strategies.
- Text-Only Mode:
- Focuses on minimal resource usage by disabling non-essential browser features.
- Light Mode:
- Optimizes browser for performance by disabling background tasks and unnecessary services.
- Full Page Scanning:
- Ensures the entire content of a page is crawled, including dynamic elements loaded during scrolling.
- Dynamic Viewport Adjustment:
- Automatically resizes the viewport to match content dimensions, improving compatibility and rendering accuracy.
- Session Management:
- Simplifies session handling with better support for persistent and non-persistent contexts.
- Fixed potential viewport mismatches by ensuring consistent use of
self.viewport_widthandself.viewport_heightthroughout the code. - Improved robustness of dynamic content loading to avoid timeouts and failed evaluations.
A new content filtering strategy that removes less relevant nodes based on metrics like text and link density.
Affected Files:
crawl4ai/content_filter_strategy.py: Enhancement of content filtering capabilities.
Implemented effective pruning algorithm with comprehensive scoring.README.md: Improved documentation regarding new features.
Updated to include usage and explanation for the PruningContentFilter.docs/md_v2/basic/content_filtering.md: Expanded documentation for users.
Added detailed section explaining the PruningContentFilter.Comprehensive tests added to ensure correct functionality of PruningContentFilter
Affected Files:
tests/async/test_content_filter_prune.py: Increased test coverage for content filtering strategies.
Created test cases for various scenarios using the PruningContentFilter.Extended testing to cover additional edge cases and performance metrics.
Affected Files:
tests/async/test_content_filter_bm25.py: Improved reliability and performance assurance.
Added tests for new extraction scenarios including malformed HTML.Altered examples in documentation to promote the use of PruningContentFilter alongside existing strategies.
Affected Files:
docs/examples/quickstart_async.py: Enhanced usability and clarity for new users.- Revised example to illustrate usage of PruningContentFilter.
- Enhanced Docker Support (Nov 29, 2024)
- Improved GPU support in Docker images.
- Dockerfile refactored for better platform-specific installations.
- Introduced new Docker commands for different platforms:
basic-amd64,all-amd64,gpu-amd64for AMD64.basic-arm64,all-arm64,gpu-arm64for ARM64.
- Enhanced README.md to improve user guidance and installation instructions.
- Added installation instructions for Playwright setup in README.
- Created and updated examples in
docs/examples/quickstart_async.pyto be more useful and user-friendly. - Updated
requirements.txtwith a newpydanticdependency. - Bumped version number in
crawl4ai/__version__.pyto 0.3.746.
- Streamlined application structure:
- Removed static pages and related code from
main.pywhich might affect existing deployments relying on static content.
- Removed static pages and related code from
- Developed
post_installmethod incrawl4ai/install.pyto streamline post-installation setup tasks. - Refined migration processes in
crawl4ai/migrations.pywith enhanced logging for better error visibility. - Updated
docker-compose.ymlto support local and hub services for different architectures, enhancing build and deploy capabilities. - Refactored example test cases in
docs/examples/docker_example.pyto facilitate comprehensive testing.
Updated README with new docker commands and setup instructions. Enhanced installation instructions and guidance.
Added post-install script functionality.
Introduced post_install method for automation of post-installation tasks.
Improved migration logging. Refined migration processes and added better logging.
Refactored docker-compose for better service management. Updated to define services for different platforms and versions.
Updated dependencies.
Added pydantic to requirements file.
Updated version number. Bumped version number to 0.3.746.
Enhanced example scripts. Uncommented example usage in async guide for user functionality.
Refactored code to improve maintainability. Streamlined app structure by removing static pages code.
Enhance features and documentation
- Updated version to 0.3.743
- Improved ManagedBrowser configuration with dynamic host/port
- Implemented fast HTML formatting in web crawler
- Enhanced markdown generation with a new generator class
- Improved sanitization and utility functions
- Added contributor details and pull request acknowledgments
- Updated documentation for clearer usage scenarios
- Adjusted tests to reflect class name changes
Added new contributors and pull request details. Updated community contributions and acknowledged pull requests.
Version update. Bumped version to 0.3.743.
Improved ManagedBrowser configuration. Enhanced browser initialization with configurable host and debugging port; improved hook execution.
Optimized HTML processing. Implemented 'fast_format_html' for optimized HTML formatting; applied it when 'prettiify' is enabled.
Enhanced markdown generation strategy. Updated to use DefaultMarkdownGenerator and improved markdown generation with filters option.
Refactored markdown generation class. Renamed DefaultMarkdownGenerationStrategy to DefaultMarkdownGenerator; added content filter handling.
Enhanced utility functions. Improved input sanitization and enhanced HTML formatting method.
Improved documentation for hooks. Updated code examples to include cookies in crawler strategy initialization.
Refactored tests to match class renaming. Updated tests to use renamed DefaultMarkdownGenerator class.
This changelog details the updates and changes introduced in Crawl4AI version 0.3.74. It's designed to inform developers about new features, modifications to existing components, removals, and other important information.
- Users can now specify download folders using the
downloads_pathparameter in theAsyncWebCrawlerconstructor or thearunmethod. If not specified, downloads are saved to a "downloads" folder within the.crawl4aidirectory. - File download tracking is integrated into the
CrawlResultobject. Successfully downloaded files are listed in thedownloaded_filesattribute, providing their paths. - Added
accept_downloadsparameter to the crawler strategies (defaults toFalse). If set to True you can add JS code andwait_forparameter for file download.
Example:
import asyncio
import os
from pathlib import Path
from crawl4ai import AsyncWebCrawler
async def download_example():
downloads_path = os.path.join(Path.home(), ".crawl4ai", "downloads")
os.makedirs(downloads_path, exist_ok=True)
async with AsyncWebCrawler(
accept_downloads=True,
downloads_path=downloads_path,
verbose=True
) as crawler:
result = await crawler.arun(
url="https://www.python.org/downloads/",
js_code="""
const downloadLink = document.querySelector('a[href$=".exe"]');
if (downloadLink) { downloadLink.click(); }
""",
wait_for=5 # To ensure download has started
)
if result.downloaded_files:
print("Downloaded files:")
for file in result.downloaded_files:
print(f"- {file}")
asyncio.run(download_example())- Introduced the
RelevanceContentFilterstrategy (and its implementationBM25ContentFilter) for extracting relevant content from web pages, replacing Fit Markdown and other content cleaning strategy. This new strategy leverages the BM25 algorithm to identify chunks of text relevant to the page's title, description, keywords, or a user-provided query. - The
fit_markdownflag in the content scraper is used to filter content based on title, meta description, and keywords.
Example:
from crawl4ai import AsyncWebCrawler
from crawl4ai.content_filter_strategy import BM25ContentFilter
async def filter_content(url, query):
async with AsyncWebCrawler() as crawler:
content_filter = BM25ContentFilter(user_query=query)
result = await crawler.arun(url=url, extraction_strategy=content_filter, fit_markdown=True)
print(result.extracted_content) # Or result.fit_markdown for the markdown version
print(result.fit_html) # Or result.fit_html to show HTML with only the filtered content
asyncio.run(filter_content("https://en.wikipedia.org/wiki/Apple", "fruit nutrition health"))- Added support for crawling local files and raw HTML content directly.
- Use the
file://prefix for local file paths. - Use the
raw:prefix for raw HTML strings.
Example:
async def crawl_local_or_raw(crawler, content, content_type):
prefix = "file://" if content_type == "local" else "raw:"
url = f"{prefix}{content}"
result = await crawler.arun(url=url)
if result.success:
print(f"Markdown Content from {content_type.title()} Source:")
print(result.markdown)
# Example usage with local file and raw HTML
async def main():
async with AsyncWebCrawler() as crawler:
# Local File
await crawl_local_or_raw(
crawler, os.path.abspath('tests/async/sample_wikipedia.html'), "local"
)
# Raw HTML
await crawl_raw_html(crawler, "<h1>Raw Test</h1><p>This is raw HTML.</p>")
asyncio.run(main())- New asynchronous crawler strategy implemented using Playwright.
ManagedBrowserclass introduced for improved browser session handling, offering features like persistent browser sessions between requests (usingsession_idparameter) and browser process monitoring.- Updated to tf-playwright-stealth for enhanced stealth capabilities.
- Added
use_managed_browser,use_persistent_context, andchrome_channelparameters to AsyncPlaywrightCrawlerStrategy.
Example:
async def browser_management_demo():
user_data_dir = os.path.join(Path.home(), ".crawl4ai", "user-data-dir")
os.makedirs(user_data_dir, exist_ok=True) # Ensure directory exists
async with AsyncWebCrawler(
use_managed_browser=True,
user_data_dir=user_data_dir,
use_persistent_context=True,
verbose=True
) as crawler:
result1 = await crawler.arun(
url="https://example.com", session_id="my_session"
)
result2 = await crawler.arun(
url="https://example.com/anotherpage", session_id="my_session"
)
asyncio.run(browser_management_demo())- Added CORS support to API server.
- Implemented static file serving.
- Enhanced root redirect functionality.
- Cache database updated to store response headers and downloaded files information. It utilizes a file system approach to manage large content efficiently.
- New, more efficient caching database built using xxhash and file system approach.
- Introduced
CacheModeenum (ENABLED,DISABLED,READ_ONLY,WRITE_ONLY,BYPASS) andalways_bypass_cacheparameter in AsyncWebCrawler for fine-grained cache control. This replacesbypass_cache,no_cache_read,no_cache_write, andalways_by_pass_cache.
- Removed deprecated:
crawl4ai/content_cleaning_strategy.py. - Removed internal class ContentCleaningStrategy
- Removed legacy cache control flags:
bypass_cache,disable_cache,no_cache_read,no_cache_write, andalways_by_pass_cache. These have been superseded bycache_mode.
- Moved version file to
crawl4ai/__version__.py. - Added
crawl4ai/cache_context.py. - Added
crawl4ai/version_manager.py. - Added
crawl4ai/migrations.py. - Added
crawl4ai-migrateentry point. - Added config
NEED_MIGRATIONandSHOW_DEPRECATION_WARNINGS. - API server now requires an API token for authentication, configurable with the
CRAWL4AI_API_TOKENenvironment variable. This enhances API security. - Added synchronous crawl endpoint
/crawl_syncfor immediate result retrieval, and direct crawl endpoint/crawl_directbypassing the task queue.
- The synchronous version of
WebCrawleris being phased out. While still available viacrawl4ai[sync], it will eventually be removed. Transition toAsyncWebCrawleris strongly recommended. Boolean cache control flags inarunare also deprecated, migrate to using thecache_modeparameter. See examples in the "New Features" section above for correct usage.
- Resolved issue with browser context closing unexpectedly in Docker. This significantly improves stability, particularly within containerized environments.
- Fixed memory leaks associated with incorrect asynchronous cleanup by removing the
__del__method and ensuring the browser context is closed explicitly using context managers. - Improved error handling in
WebScrapingStrategy. More detailed error messages and suggestions for debugging will minimize frustration when running into unexpected issues. - Fixed issue with incorrect text parsing in specific HTML structures.
Old way:
crawler = AsyncWebCrawler(always_by_pass_cache=True)
result = await crawler.arun(url="https://example.com", bypass_cache=True)New way:
from crawl4ai import CacheMode
crawler = AsyncWebCrawler(always_bypass_cache=True)
result = await crawler.arun(url="https://example.com", cache_mode=CacheMode.BYPASS)-
File Download Processing (Nov 14, 2024)
- Added capability for users to specify download folders
- Implemented file download tracking in crowd result object
- Created new file:
tests/async/test_async_doanloader.py
-
Content Filtering Improvements (Nov 14, 2024)
- Introduced Relevance Content Filter as an improvement over Fit Markdown
- Implemented BM25 algorithm for content relevance matching
- Added new file:
crawl4ai/content_filter_strategy.py - Removed deprecated:
crawl4ai/content_cleaning_strategy.py
-
Local File and Raw HTML Support (Nov 13, 2024)
- Added support for processing local files
- Implemented raw HTML input handling in AsyncWebCrawler
- Enhanced
crawl4ai/async_webcrawler.pywith significant performance improvements
-
Browser Management Enhancements (Nov 12, 2024)
- Implemented new async crawler strategy using Playwright
- Introduced ManagedBrowser for better browser session handling
- Added support for persistent browser sessions
- Updated from playwright_stealth to tf-playwright-stealth
-
API Server Component
- Added CORS support
- Implemented static file serving
- Enhanced root redirect functionality
- Support for raw HTML and local file crawling via URL prefixes ('raw:', 'file://')
- Browser process monitoring for managed browser instances
- Screenshot capability for raw HTML and local file content
- Response headers storage in cache database
- New
fit_markdownflag for optional markdown generation
- Switched HTML parser from 'html.parser' to 'lxml' for ~4x performance improvement
- Optimized BeautifulSoup text conversion and element selection
- Pre-compiled regular expressions for better performance
- Improved metadata extraction efficiency
- Response headers now stored alongside HTML in cache
__del__method from AsyncPlaywrightCrawlerStrategy to prevent async cleanup issues
- Issue #256: Added support for crawling raw HTML content
- Issue #253: Implemented file:// protocol handling
- Missing response headers in cached results
- Memory leaks from improper async cleanup
- Fixed: Browser context unexpectedly closing in Docker environment during crawl operations.
- Removed: del method from AsyncPlaywrightCrawlerStrategy to prevent unreliable asynchronous cleanup, ensuring - browser context is closed explicitly within context managers.
- Added: Monitoring for ManagedBrowser subprocess to detect and log unexpected terminations.
- Updated: Dockerfile configurations to expose debugging port (9222) and allocate additional shared memory for improved browser stability.
- Improved: Error handling and resource cleanup processes for browser lifecycle management within the Docker environment.
-
New Doctor Feature
- Added comprehensive system diagnostics tool
- Available through package hub and CLI
- Provides automated troubleshooting and system health checks
- Includes detailed reporting of configuration issues
-
Dockerized API Server
- Released complete Docker implementation for API server
- Added comprehensive documentation for Docker deployment
- Implemented container communication protocols
- Added environment configuration guides
-
Managed Browser Integration
- Added support for user-controlled browser instances
- Implemented
ManagedBrowserclass for better browser lifecycle management - Added ability to connect to existing Chrome DevTools Protocol (CDP) endpoints
- Introduced user data directory support for persistent browser profiles
-
Enhanced HTML Processing
- Added HTML tag preservation feature during markdown conversion
- Introduced configurable tag preservation system
- Improved pre-tag and code block handling
- Added support for nested preserved tags with attribute retention
-
Browser Handling
- Added flag to ignore body visibility for problematic pages
- Improved browser process cleanup and management
- Enhanced temporary directory handling for browser profiles
- Added configurable browser launch arguments
-
Database Management
- Implemented connection pooling for better performance
- Added retry logic for database operations
- Improved error handling and logging
- Enhanced cleanup procedures for database connections
-
Resource Management
- Added memory and CPU monitoring
- Implemented dynamic task slot allocation based on system resources
- Added configurable cleanup intervals
- Code Structure
- Moved version management to dedicated _version.py file
- Improved error handling throughout the codebase
- Enhanced logging system with better error reporting
- Reorganized core components for better maintainability
- Fixed issues with browser process termination
- Improved handling of connection timeouts
- Enhanced error recovery in database operations
- Fixed memory leaks in long-running processes
- Updated Playwright to v1.47
- Updated core dependencies with more flexible version constraints
- Added new development dependencies for testing
- Changed default browser handling behavior
- Modified database connection management approach
- Updated API response structure for better consistency
When upgrading to v0.3.73, be aware of the following changes:
-
Docker Deployment:
- Review Docker documentation for new deployment options
- Update environment configurations as needed
- Check container communication settings
-
If using custom browser management:
- Update browser initialization code to use new ManagedBrowser class
- Review browser cleanup procedures
-
For database operations:
- Check custom database queries for compatibility with new connection pooling
- Update error handling to work with new retry logic
-
Using the Doctor:
- Run doctor command for system diagnostics:
crawl4ai doctor - Review generated reports for potential issues
- Follow recommended fixes for any identified problems
- Run doctor command for system diagnostics:
This commit introduces several key enhancements, including improved error handling and robust database operations in async_database.py, which now features a connection pool and retry logic for better reliability. Updates to the README.md provide clearer instructions and a better user experience with links to documentation sections. The .gitignore file has been refined to include additional directories, while the async web crawler now utilizes a managed browser for more efficient crawling. Furthermore, multiple dependency updates and introduction of the CustomHTML2Text class enhance text extraction capabilities.
- preserve_tags: Added support for preserving specific HTML tags during markdown conversion.
- Smart overlay removal system in AsyncPlaywrightCrawlerStrategy:
- Automatic removal of popups, modals, and cookie notices
- Detection and removal of fixed/sticky position elements
- Cleaning of empty block elements
- Configurable via
remove_overlay_elementsparameter
- Enhanced screenshot capabilities:
- Added
screenshot_wait_forparameter to control timing - Improved screenshot handling with existing page context
- Better error handling with fallback error images
- Added
- New URL normalization utilities:
normalize_urlfunction for consistent URL formattingis_external_urlfunction for better link classification
- Custom base directory support for cache storage:
- New
base_directoryparameter in AsyncWebCrawler - Allows specifying alternative locations for
.crawl4aifolder
- New
- Link handling improvements:
- Better duplicate link detection
- Enhanced internal/external link classification
- Improved handling of special URL protocols
- Support for anchor links and protocol-relative URLs
- Configuration refinements:
- Streamlined social media domain list
- More focused external content filtering
- LLM extraction strategy:
- Added support for separate API base URL via
api_baseparameter - Better handling of base URLs in configuration
- Added support for separate API base URL via
- Screenshot functionality:
- Resolved issues with screenshot timing and context
- Improved error handling and recovery
- Link processing:
- Fixed URL normalization edge cases
- Better handling of invalid URLs
- Improved error messages for link processing failures
- The overlay removal system uses advanced JavaScript injection for better compatibility
- URL normalization handles special cases like mailto:, tel:, and protocol-relative URLs
- Screenshot system now reuses existing page context for better performance
- Link processing maintains separate dictionaries for internal and external links to ensure uniqueness
- New
ContentCleaningStrategyclass:- Smart content extraction based on text density and element scoring
- Automatic removal of boilerplate content
- DOM tree analysis for better content identification
- Configurable thresholds for content detection
- Advanced proxy support:
- Added
proxy_configoption for authenticated proxy connections - Support for username/password in proxy configuration
- Added
- New content output formats:
fit_markdown: Optimized markdown output with main content focusfit_html: Clean HTML with only essential content
- Image source detection:
- Support for multiple image source attributes (
src,data-src,srcset, etc.) - Automatic fallback through potential source attributes
- Smart handling of srcset attribute
- Support for multiple image source attributes (
- External content handling:
- Made external link exclusion optional (disabled by default)
- Improved detection and handling of social media links
- Better control over external image filtering
- Image extraction reliability with multiple source attribute checks
- External link and image handling logic for better accuracy
- The new
ContentCleaningStrategyuses configurable thresholds for customization - Proxy configuration now supports more complex authentication scenarios
- Content extraction process now provides both regular and optimized outputs
- Added support for parsing Base64 encoded images in WebScrapingStrategy
- Forked and integrated a customized version of the html2text library for more control over Markdown generation
- New configuration options for controlling external content:
- Ability to exclude all external links
- Option to specify domains to exclude (default includes major social media platforms)
- Control over excluding external images
- Improved Markdown generation process:
- Added fine-grained control over character escaping in Markdown output
- Enhanced handling of code blocks and pre-formatted text
- Updated
AsyncPlaywrightCrawlerStrategy.close()method to use a shorter sleep time (0.5 seconds instead of 500) - Enhanced flexibility in
CosineStrategywith a more genericload_HF_embedding_modelfunction
- Optimized content scraping and processing for better efficiency
- Enhanced error handling and logging in various components
- The customized html2text library is now located within the crawl4ai package
- New configuration options are available in the
config.pyfile for external content handling - The
WebScrapingStrategyclass has been updated to accommodate new external content exclusion options
- New chunking strategies:
OverlappingWindowChunking: Allows for overlapping chunks of text, useful for maintaining context between chunks.- Enhanced
SlidingWindowChunking: Improved to handle edge cases and last chunks more effectively.
- Updated
CHUNK_TOKEN_THRESHOLDin config to 2048 tokens (2^11) for better compatibility with most LLM models. - Improved
AsyncPlaywrightCrawlerStrategy.close()method to use a shorter sleep time (0.5 seconds instead of 500), significantly reducing wait time when closing the crawler. - Enhanced flexibility in
CosineStrategy:- Now uses a more generic
load_HF_embedding_modelfunction, allowing for easier swapping of embedding models.
- Now uses a more generic
- Updated
JsonCssExtractionStrategyandJsonXPathExtractionStrategyfor better JSON-based extraction.
- Addressed potential issues with the sliding window chunking strategy to ensure all text is properly chunked.
- Added more comprehensive docstrings to chunking strategies for better code documentation.
- Removed hardcoded device setting in
CosineStrategy, now using the automatically detected device. - Added a new example in
quickstart_async.pyfor generating a knowledge graph from crawled content.
These updates aim to provide more flexibility in text processing, improve performance, and enhance the overall capabilities of the crawl4ai library. The new chunking strategies, in particular, offer more options for handling large texts in various scenarios.
-
Version Update:
- Updated version number from 0.3.7 to 0.3.71.
-
Crawler Enhancements:
- Added
sleep_on_closeoption to AsyncPlaywrightCrawlerStrategy for delayed browser closure. - Improved context creation with additional options:
- Enabled
accept_downloadsandjava_script_enabled. - Added a cookie to enable cookies by default.
- Enabled
- Added
-
Error Handling Improvements:
- Enhanced error messages in AsyncWebCrawler's
arunmethod. - Updated error reporting format for better visibility and consistency.
- Enhanced error messages in AsyncWebCrawler's
-
Performance Optimization:
- Commented out automatic page and context closure in
crawlmethod to potentially improve performance in certain scenarios.
- Commented out automatic page and context closure in
- Updated quickstart notebook:
- Changed installation command to use the released package instead of GitHub repository.
- Updated kernel display name.
- Minor code refactoring and cleanup.
-
Enhanced Browser Stealth:
- Implemented
playwright_stealthfor improved bot detection avoidance. - Added
StealthConfigfor fine-tuned control over stealth parameters.
- Implemented
-
User Simulation:
- New
simulate_useroption to mimic human-like interactions (mouse movements, clicks, keyboard presses).
- New
-
Navigator Override:
- Added
override_navigatoroption to modify navigator properties, further improving bot detection evasion.
- Added
-
Improved iframe Handling:
- New
process_iframesparameter to extract and integrate iframe content into the main page.
- New
-
Flexible Browser Selection:
- Support for choosing between Chromium, Firefox, and WebKit browsers.
-
Include Links in Markdown:
- Added support for including links in Markdown content, by definin g a new flag
include_links_on_markdownincrawlmethod.
- Added support for including links in Markdown content, by definin g a new flag
-
Better Error Handling:
- Enhanced error reporting in WebScrapingStrategy with detailed error messages and suggestions.
- Added console message and error logging for better debugging.
-
Image Processing Enhancements:
- Improved image dimension updating and filtering logic.
-
Crawling Flexibility:
- Added support for custom viewport sizes.
- Implemented delayed content retrieval with
delay_before_return_htmlparameter.
-
Performance Optimization:
- Adjusted default semaphore count for parallel crawling.
- Fixed an issue where the HTML content could be empty after processing.
- Added new example
crawl_with_user_simulation()demonstrating the use of user simulation and navigator override features.
- Refactored code for better maintainability and readability.
- Updated browser launch arguments for improved compatibility and performance.
- New Hook: Added
before_retrieve_htmlhook inAsyncPlaywrightCrawlerStrategy. - Delayed HTML Retrieval: Introduced
delay_before_return_htmlparameter to allow waiting before retrieving HTML content.- Useful for pages with delayed content loading.
- Flexible Timeout:
smart_waitfunction now usespage_timeout(default 60 seconds) instead of a fixed 30-second timeout.- Provides better handling for slow-loading pages.
- How to use: Set
page_timeout=your_desired_timeout(in milliseconds) when callingcrawler.arun().
- Added support for different browser types (Chromium, Firefox, WebKit).
- Users can now specify the browser type when initializing AsyncWebCrawler.
- How to use: Set
browser_type="firefox"orbrowser_type="webkit"when initializing AsyncWebCrawler.
- Added ability to capture screenshots during crawling.
- Useful for debugging and content verification.
- How to use: Set
screenshot=Truewhen callingcrawler.arun().
- Added support for multiple LLM providers (OpenAI, Hugging Face, Ollama).
- Custom Arguments: Added support for passing extra arguments to LLM providers via
extra_argsparameter. - Custom Headers: Users can now pass custom headers to the extraction strategy.
- How to use: Specify the desired provider and custom arguments when using
LLMExtractionStrategy.
- New feature to process and extract content from iframes.
- How to use: Set
process_iframes=Truein the crawl method.
- Introduced
get_delayed_contentmethod inAsyncCrawlResponse. - Allows retrieval of content after a specified delay, useful for dynamically loaded content.
- How to use: Access
result.get_delayed_content(delay_in_seconds)after crawling.
- Flexible Initialization: Now accepts arbitrary keyword arguments, passed directly to the crawler strategy.
- Allows for more customized setups.
- Enhanced image handling in WebScrapingStrategy.
- Added filtering for small, invisible, or irrelevant images.
- Improved image scoring system for better content relevance.
- Implemented JavaScript-based image dimension updating for more accurate representation.
- Automatic database schema updates ensure compatibility with the latest version.
- Improved error messages and logging for easier debugging.
- Refined HTML sanitization process.
- Improved handling of base64 encoded images.
- Enhanced Markdown conversion process.
- Optimized content extraction algorithms.
perform_completion_with_backofffunction now supports additional arguments for more customized API calls to LLM providers.
- Fixed an issue where image tags were being prematurely removed during content extraction.
- Updated
quickstart_async.pywith examples of:- Using custom headers in LLM extraction.
- Different LLM provider usage (OpenAI, Hugging Face, Ollama).
- Custom browser type usage.
- Refactored code for better maintainability, flexibility, and performance.
- Enhanced type hinting throughout the codebase for improved development experience.
- Expanded error handling for more robust operation.
These updates significantly enhance the flexibility, accuracy, and robustness of crawl4ai, providing users with more control and options for their web crawling and content extraction tasks.
Enhance AsyncWebCrawler with smart waiting and screenshot capabilities
- Implement smart_wait function in AsyncPlaywrightCrawlerStrategy
- Add screenshot support to AsyncCrawlResponse and AsyncWebCrawler
- Improve error handling and timeout management in crawling process
- Fix typo in CrawlResult model (responser_headers -> response_headers)
Significant improvements in text processing and performance:
- 🚀 Dependency reduction: Removed dependency on spaCy model for text chunk labeling in cosine extraction strategy.
- 🤖 Transformer upgrade: Implemented text sequence classification using a transformer model for labeling text chunks.
- ⚡ Performance enhancement: Improved model loading speed due to removal of spaCy dependency.
- 🔧 Future-proofing: Laid groundwork for potential complete removal of spaCy dependency in future versions.
These changes address issue #68 and provide a foundation for faster, more efficient text processing in Crawl4AI.
Major improvements in functionality, performance, and cross-platform compatibility! 🚀
- 🐳 Docker enhancements: Significantly improved Dockerfile for easy installation on Linux, Mac, and Windows.
- 🌐 Official Docker Hub image: Launched our first official image on Docker Hub for streamlined deployment.
- 🔧 Selenium upgrade: Removed dependency on ChromeDriver, now using Selenium's built-in capabilities for better compatibility.
- 🖼️ Image description: Implemented ability to generate textual descriptions for extracted images from web pages.
- ⚡ Performance boost: Various improvements to enhance overall speed and performance.
A big shoutout to our amazing community contributors:
- @aravindkarnam for developing the textual description extraction feature.
- @FractalMind for creating the first official Docker Hub image and fixing Dockerfile errors.
- @ketonkss4 for identifying Selenium's new capabilities, helping us reduce dependencies.
Your contributions are driving Crawl4AI forward! 🙌
Minor improvements for a more maintainable codebase:
- 🔄 Fixed typos in
chunking_strategy.pyandcrawler_strategy.pyto improve code readability - 🔄 Removed
.test_pads/directory from.gitignoreto keep our repository clean and organized
These changes may seem small, but they contribute to a more stable and sustainable codebase. By fixing typos and updating our .gitignore settings, we're ensuring that our code is easier to maintain and scale in the long run.
A slew of exciting updates to improve the crawler's stability and robustness! 🎉
- 💻 UTF encoding fix: Resolved the Windows "charmap" error by adding UTF encoding.
- 🛡️ Error handling: Implemented MaxRetryError exception handling in LocalSeleniumCrawlerStrategy.
- 🧹 Input sanitization: Improved input sanitization and handled encoding issues in LLMExtractionStrategy.
- 🚮 Database cleanup: Removed existing database file and initialized a new one.
💡 In this release, we've bumped the version to v0.2.73 and refreshed our documentation to ensure you have the best experience with our project.
- Supporting website need "with-head" mode to crawl the website with head.
- Fixing the installation issues for setup.py and dockerfile.
- Resolve multiple issues.
This release brings exciting updates and improvements to our project! 🎉
- 📚 Documentation Updates: Our documentation has been revamped to reflect the latest changes and additions.
- 🚀 New Modes in setup.py: We've added support for three new modes in setup.py: default, torch, and transformers. This enhances the project's flexibility and usability.
- 🐳 Docker File Updates: The Docker file has been updated to ensure seamless compatibility with the new modes and improvements.
- 🕷️ Temporary Solution for Headless Crawling: We've implemented a temporary solution to overcome issues with crawling websites in headless mode.
These changes aim to improve the overall user experience, provide more flexibility, and enhance the project's performance. We're thrilled to share these updates with you and look forward to continuing to evolve and improve our project!
Improved Error Handling and Performance 🚧
- 🚫 Refactored
crawler_strategy.pyto handle exceptions and provide better error messages, making it more robust and reliable. - 💻 Optimized the
get_content_of_website_optimizedfunction inutils.pyfor improved performance, reducing potential bottlenecks. - 💻 Updated
utils.pywith the latest changes, ensuring consistency and accuracy. - 🚫 Migrated to
ChromeDriverManagerto resolve Chrome driver download issues, providing a smoother user experience.
These changes focus on refining the existing codebase, resulting in a more stable, efficient, and user-friendly experience. With these improvements, you can expect fewer errors and better performance in the crawler strategy and utility functions.
- Speed up twice the extraction function.
- Fix issue #19: Update Dockerfile to ensure compatibility across multiple platforms.
- Added five important hooks to the crawler:
- on_driver_created: Called when the driver is ready for initializations.
- before_get_url: Called right before Selenium fetches the URL.
- after_get_url: Called after Selenium fetches the URL.
- before_return_html: Called when the data is parsed and ready.
- on_user_agent_updated: Called when the user changes the user_agent, causing the driver to reinitialize.
- Added an example in
quickstart.pyin the example folder under the docs. - Enhancement issue #24: Replaced inline HTML tags (e.g., DEL, INS, SUB, ABBR) with textual format for better context handling in LLM.
- Maintaining the semantic context of inline tags (e.g., abbreviation, DEL, INS) for improved LLM-friendliness.
- Updated Dockerfile to ensure compatibility across multiple platforms (Hopefully!).
- Fix issue #22: Use MD5 hash for caching HTML files to handle long URLs