-
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
ManagedBrowser
class 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_elements
parameter
- Enhanced screenshot capabilities:
- Added
screenshot_wait_for
parameter to control timing - Improved screenshot handling with existing page context
- Better error handling with fallback error images
- Added
- New URL normalization utilities:
normalize_url
function for consistent URL formattingis_external_url
function for better link classification
- Custom base directory support for cache storage:
- New
base_directory
parameter in AsyncWebCrawler - Allows specifying alternative locations for
.crawl4ai
folder
- 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_base
parameter - 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
ContentCleaningStrategy
class:- 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_config
option 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
ContentCleaningStrategy
uses 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 WebScrappingStrategy
- 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
CosineStrategy
with a more genericload_HF_embedding_model
function
- 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.py
file for external content handling - The
WebScrappingStrategy
class 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_THRESHOLD
in 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_model
function, allowing for easier swapping of embedding models.
- Now uses a more generic
- Updated
JsonCssExtractionStrategy
andJsonXPATHExtractionStrategy
for 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.py
for 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_close
option to AsyncPlaywrightCrawlerStrategy for delayed browser closure. - Improved context creation with additional options:
- Enabled
accept_downloads
andjava_script_enabled
. - Added a cookie to enable cookies by default.
- Enabled
- Added
-
Error Handling Improvements:
- Enhanced error messages in AsyncWebCrawler's
arun
method. - 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
crawl
method 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_stealth
for improved bot detection avoidance. - Added
StealthConfig
for fine-tuned control over stealth parameters.
- Implemented
-
User Simulation:
- New
simulate_user
option to mimic human-like interactions (mouse movements, clicks, keyboard presses).
- New
-
Navigator Override:
- Added
override_navigator
option to modify navigator properties, further improving bot detection evasion.
- Added
-
Improved iframe Handling:
- New
process_iframes
parameter 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_markdown
incrawl
method.
- Added support for including links in Markdown content, by definin g a new flag
-
Better Error Handling:
- Enhanced error reporting in WebScrappingStrategy 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_html
parameter.
-
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_html
hook inAsyncPlaywrightCrawlerStrategy
. - Delayed HTML Retrieval: Introduced
delay_before_return_html
parameter to allow waiting before retrieving HTML content.- Useful for pages with delayed content loading.
- Flexible Timeout:
smart_wait
function 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=True
when 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_args
parameter. - 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=True
in the crawl method.
- Introduced
get_delayed_content
method 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 WebScrappingStrategy.
- 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_backoff
function 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.py
with 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.py
andcrawler_strategy.py
to improve code readability - ๐ Removed
.test_pads/
directory from.gitignore
to 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.py
to handle exceptions and provide better error messages, making it more robust and reliable. - ๐ป Optimized the
get_content_of_website_optimized
function inutils.py
for improved performance, reducing potential bottlenecks. - ๐ป Updated
utils.py
with the latest changes, ensuring consistency and accuracy. - ๐ซ Migrated to
ChromeDriverManager
to 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.py
in 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