diff --git a/README.md b/README.md index 20367f5..de28c1e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ -# 🚀🤖 Crawl4AI: Open-source LLM Friendly Web Crawler & Scraper. + +> [!NOTE] +> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。 +> [English](./README.en.md) · [原始项目](https://github.com/unclecode/crawl4ai) · [上游 README](https://github.com/unclecode/crawl4ai/blob/HEAD/README.md) +> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。 + +# 🚀🤖 Crawl4AI:面向 LLM 的开源友好型网页爬虫与抓取工具
@@ -13,12 +19,12 @@ [![GitHub Sponsors](https://img.shields.io/github/sponsors/unclecode?style=flat&logo=GitHub-Sponsors&label=Sponsors&color=pink)](https://github.com/sponsors/unclecode) --- -#### 🚀 Crawl4AI Cloud API — Closed Beta (Launching Soon) -Reliable, large-scale web extraction, now built to be _**drastically more cost-effective**_ than any of the existing solutions. +#### 🚀 Crawl4AI Cloud API — 封闭测试(即将推出) +可靠、大规模网页提取,现已打造为比现有任何方案都 _**大幅更省钱**_。 -👉 **Apply [here](https://forms.gle/E9MyPaNXACnAMaqG7) for early access** -_We’ll be onboarding in phases and working closely with early users. -Limited slots._ +👉 **在此[申请](https://forms.gle/E9MyPaNXACnAMaqG7) 抢先体验** +_我们将分阶段接入,并与早期用户紧密协作。 +名额有限。_ --- @@ -35,45 +41,45 @@ Limited slots._

-Crawl4AI turns the web into clean, LLM ready Markdown for RAG, agents, and data pipelines. Fast, controllable, battle tested by a 50k+ star community. +Crawl4AI 将网页转化为干净、可供 LLM 使用的 Markdown,适用于 RAG、智能体(agent)与数据流水线。速度快、可控性强,并经过 5 万+ Star 社区的实战检验。 -[✨ Check out latest update v0.9.1](#-recent-updates) +[✨ 查看最新更新 v0.9.1](#-recent-updates) -✨ **New in v0.9.1**: Patch release with 12 bug fixes across Docker, browser, and core. Adds `preserve_classes`/`preserve_tags` whitelist for PruningContentFilter, fixes Windows browser crash, Docker auth gate UI, HTTP timeout unit mismatch, and more. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.1.md) +✨ **v0.9.1 新特性**:补丁版本,修复 Docker、浏览器与核心模块中的 12 个 bug。为 PruningContentFilter 新增 `preserve_classes`/`preserve_tags` 白名单,修复 Windows 浏览器崩溃、Docker 认证门 UI、HTTP 超时单位不一致等问题。[发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.1.md) -✨ Recent v0.9.0: Major secure-by-default release of the Docker API server. Auth is on by default, the server binds loopback unless given a token, and the request body is now an untrusted trust boundary. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.0.md) +✨ 近期 v0.9.0:Docker API 服务器的重大“默认安全”版本。默认开启认证,除非提供 token 否则服务器绑定 loopback,且请求体现在被视为不可信信任边界。[发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.0.md) -✨ Recent v0.8.7: Security-hardening release. Fixes critical Docker API vulnerabilities (RCE, SSRF, auth bypass, file write, XSS, hardcoded JWT secret), adds DomainMapper, and ships scraping, deep-crawl, and LLM fixes. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.7.md) +✨ 近期 v0.8.7:安全加固版本。修复 Docker API 关键漏洞(RCE、SSRF、认证绕过、文件写入、XSS、硬编码 JWT 密钥),新增 DomainMapper,并交付抓取、深度爬取与 LLM 相关修复。[发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.7.md) -✨ Previous v0.8.0: Crash Recovery & Prefetch Mode! Deep crawl crash recovery with `resume_state` and `on_state_change` callbacks for long-running crawls. New `prefetch=True` mode for 5-10x faster URL discovery. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.0.md) +✨ 此前 v0.8.0:崩溃恢复与预取模式!深度爬取崩溃恢复,支持 `resume_state` 与 `on_state_change` 回调,用于长时间运行的爬取任务。全新 `prefetch=True` 模式,URL 发现速度提升 5–10 倍。[发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.0.md) -✨ Previous v0.7.8: Stability & Bug Fix Release! 11 bug fixes addressing Docker API issues, LLM extraction improvements, URL handling fixes, and dependency updates. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.8.md) +✨ 此前 v0.7.8:稳定性与 Bug 修复版本!11 项 bug 修复,涵盖 Docker API 问题、LLM 提取改进、URL 处理修复与依赖更新。[发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.8.md)
- 🤓 My Personal Story + 🤓 我的个人故事 -I grew up on an Amstrad, thanks to my dad, and never stopped building. In grad school I specialized in NLP and built crawlers for research. That’s where I learned how much extraction matters. +我从小就接触 Amstrad,这要感谢我父亲,之后也从未停止动手构建。研究生阶段我专攻 NLP,并为研究项目搭建爬虫——正是在那时,我深刻体会到提取质量有多重要。 -In 2023, I needed web-to-Markdown. The “open source” option wanted an account, API token, and $16, and still under-delivered. I went turbo anger mode, built Crawl4AI in days, and it went viral. Now it’s the most-starred crawler on GitHub. +2023 年,我需要把网页转成 Markdown。当时所谓的“开源”方案却要账号、API token,还要收 16 美元,效果仍不尽人意。我怒而加速开发,几天内做出 Crawl4AI,随后迅速走红。如今它已是 GitHub 上 Star 数最多的爬虫项目。 -I made it open source for **availability**, anyone can use it without a gate. Now I’m building the platform for **affordability**, anyone can run serious crawls without breaking the bank. If that resonates, join in, send feedback, or just crawl something amazing. +我把它开源是为了 **可用性(availability)**——任何人都能无障碍使用。现在我正在打造平台,追求 **可负担性(affordability)**——任何人都能运行严肃规模的爬取,而不必倾家荡产。若你认同这一方向,欢迎加入、反馈,或去爬取一些精彩内容。
- Why developers pick Crawl4AI + 开发者为何选择 Crawl4AI -- **LLM ready output**, smart Markdown with headings, tables, code, citation hints -- **Fast in practice**, async browser pool, caching, minimal hops -- **Full control**, sessions, proxies, cookies, user scripts, hooks -- **Adaptive intelligence**, learns site patterns, explores only what matters -- **Deploy anywhere**, zero keys, CLI and Docker, cloud friendly +- **LLM 就绪输出**,智能 Markdown,含标题、表格、代码与引用提示 +- **实践中很快**,异步浏览器池、缓存、最少跳转 +- **完全可控**,会话、代理、Cookie、用户脚本、钩子 +- **自适应智能**,学习站点模式,只探索真正重要的部分 +- **随处部署**,零密钥、CLI 与 Docker、云友好
-## 🚀 Quick Start +## 🚀 快速开始 -1. Install Crawl4AI: +1. 安装 Crawl4AI: ```bash # Install the package pip install -U crawl4ai @@ -88,12 +94,12 @@ crawl4ai-setup crawl4ai-doctor ``` -If you encounter any browser-related issues, you can install them manually: +如遇到任何与浏览器相关的问题,可手动安装: ```bash python -m playwright install --with-deps chromium ``` -2. Run a simple web crawl with Python: +2. 用 Python 运行一次简单网页爬取: ```python import asyncio from crawl4ai import * @@ -109,7 +115,7 @@ if __name__ == "__main__": asyncio.run(main()) ``` -3. Or use the new command-line interface: +3. 或使用新的命令行界面: ```bash # Basic crawl with markdown output crwl https://www.nbcnews.com/business -o markdown @@ -121,11 +127,11 @@ crwl https://docs.crawl4ai.com --deep-crawl bfs --max-pages 10 crwl https://www.example.com/products -q "Extract all product prices" ``` -## 💖 Support Crawl4AI +## 💖 支持 Crawl4AI -> 🎉 **Sponsorship Program Now Open!** After powering 51K+ developers and 1 year of growth, Crawl4AI is launching dedicated support for **startups** and **enterprises**. Be among the first 50 **Founding Sponsors** for permanent recognition in our Hall of Fame. +> 🎉 **赞助计划现已开放!** 在赋能 51K+ 开发者并经历 1 年成长之后,Crawl4AI 正式为 **初创公司** 与 **企业** 推出专属支持。成为前 50 位 **创始赞助人(Founding Sponsors)**,在我们的名人堂中获得永久展示。 -Crawl4AI is the #1 trending open-source web crawler on GitHub. Your support keeps it independent, innovative, and free for the community — while giving you direct access to premium benefits. +Crawl4AI 是 GitHub 上排名第一的热门开源网页爬虫。你的支持让它保持独立、持续创新,并对社区免费开放——同时你还能直接获得高级权益。
@@ -134,145 +140,145 @@ Crawl4AI is the #1 trending open-source web crawler on GitHub. Your support keep
-### 🤝 Sponsorship Tiers +### 🤝 赞助档位 -- **🌱 Believer ($5/mo)** — Join the movement for data democratization -- **🚀 Builder ($50/mo)** — Priority support & early access to features -- **💼 Growing Team ($500/mo)** — Bi-weekly syncs & optimization help -- **🏢 Data Infrastructure Partner ($2000/mo)** — Full partnership with dedicated support - *Custom arrangements available - see [SPONSORS.md](SPONSORS.md) for details & contact* +- **🌱 Believer($5/月)** — 加入数据民主化运动 +- **🚀 Builder($50/月)** — 优先支持与功能抢先体验 +- **💼 Growing Team($500/月)** — 双周同步与优化协助 +- **🏢 Data Infrastructure Partner($2000/月)** — 全面合作与专属支持 + *可定制合作方案 — 详见 [SPONSORS.md](SPONSORS.md) 了解详情与联系方式* -**Why sponsor?** -No rate-limited APIs. No lock-in. Build and own your data pipeline with direct guidance from the creator of Crawl4AI. +**为何赞助?** +没有限流 API。没有厂商锁定。在 Crawl4AI 创作者直接指导下,构建并拥有自己的数据流水线。 -[See All Tiers & Benefits →](https://github.com/sponsors/unclecode) +[查看全部档位与权益 →](https://github.com/sponsors/unclecode) -## ✨ Features +## ✨ 功能
-📝 Markdown Generation +📝 Markdown 生成 -- 🧹 **Clean Markdown**: Generates clean, structured Markdown with accurate formatting. -- 🎯 **Fit Markdown**: Heuristic-based filtering to remove noise and irrelevant parts for AI-friendly processing. -- 🔗 **Citations and References**: Converts page links into a numbered reference list with clean citations. -- 🛠️ **Custom Strategies**: Users can create their own Markdown generation strategies tailored to specific needs. -- 📚 **BM25 Algorithm**: Employs BM25-based filtering for extracting core information and removing irrelevant content. +- 🧹 **干净 Markdown**:生成干净、结构化的 Markdown,格式准确。 +- 🎯 **适配 Markdown(Fit Markdown)**:基于启发式过滤,去除噪声与无关内容,便于 AI 处理。 +- 🔗 **引用与参考**:将页面链接转换为带整洁引用的编号参考列表。 +- 🛠️ **自定义策略**:用户可针对特定需求创建自己的 Markdown 生成策略。 +- 📚 **BM25 算法**:采用基于 BM25 的过滤,提取核心信息并剔除无关内容。
-📊 Structured Data Extraction +📊 结构化数据提取(Structured Data Extraction) -- 🤖 **LLM-Driven Extraction**: Supports all LLMs (open-source and proprietary) for structured data extraction. -- 🧱 **Chunking Strategies**: Implements chunking (topic-based, regex, sentence-level) for targeted content processing. -- 🌌 **Cosine Similarity**: Find relevant content chunks based on user queries for semantic extraction. -- 🔎 **CSS-Based Extraction**: Fast schema-based data extraction using XPath and CSS selectors. -- 🔧 **Schema Definition**: Define custom schemas for extracting structured JSON from repetitive patterns. +- 🤖 **LLM 驱动提取(LLM-Driven Extraction)**:支持所有 LLM(开源与专有)进行结构化数据提取。 +- 🧱 **分块策略(Chunking Strategies)**:实现分块(基于主题、正则表达式、句子级别)以进行针对性内容处理。 +- 🌌 **余弦相似度(Cosine Similarity)**:根据用户查询查找相关内容块,用于语义提取。 +- 🔎 **基于 CSS 的提取(CSS-Based Extraction)**:使用 XPath 和 CSS 选择器进行快速的基于 schema 的数据提取。 +- 🔧 **Schema 定义(Schema Definition)**:定义自定义 schema,从重复模式中提取结构化 JSON。
-🌐 Browser Integration +🌐 浏览器集成(Browser Integration) -- 🖥️ **Managed Browser**: Use user-owned browsers with full control, avoiding bot detection. -- 🔄 **Remote Browser Control**: Connect to Chrome Developer Tools Protocol for remote, large-scale data extraction. -- 👤 **Browser Profiler**: Create and manage persistent profiles with saved authentication states, cookies, and settings. -- 🔒 **Session Management**: Preserve browser states and reuse them for multi-step crawling. -- 🧩 **Proxy Support**: Seamlessly connect to proxies with authentication for secure access. -- ⚙️ **Full Browser Control**: Modify headers, cookies, user agents, and more for tailored crawling setups. -- 🌍 **Multi-Browser Support**: Compatible with Chromium, Firefox, and WebKit. -- 📐 **Dynamic Viewport Adjustment**: Automatically adjusts the browser viewport to match page content, ensuring complete rendering and capturing of all elements. +- 🖥️ **托管浏览器(Managed Browser)**:使用用户自有浏览器并完全控制,避免机器人检测。 +- 🔄 **远程浏览器控制(Remote Browser Control)**:连接 Chrome Developer Tools Protocol(CDP),实现远程、大规模数据提取。 +- 👤 **浏览器配置文件(Browser Profiler)**:创建并管理持久化配置文件,保存认证状态、Cookie 和设置。 +- 🔒 **会话管理(Session Management)**:保留浏览器状态并在多步骤爬取中复用。 +- 🧩 **代理支持(Proxy Support)**:无缝连接带认证的代理,实现安全访问。 +- ⚙️ **完整浏览器控制(Full Browser Control)**:修改请求头、Cookie、User-Agent 等,定制爬取配置。 +- 🌍 **多浏览器支持(Multi-Browser Support)**:兼容 Chromium、Firefox 和 WebKit。 +- 📐 **动态视口调整(Dynamic Viewport Adjustment)**:自动调整浏览器视口以匹配页面内容,确保完整渲染并捕获所有元素。
-🔎 Crawling & Scraping +🔎 爬取与抓取(Crawling & Scraping) -- 🖼️ **Media Support**: Extract images, audio, videos, and responsive image formats like `srcset` and `picture`. -- 🚀 **Dynamic Crawling**: Execute JS and wait for async or sync for dynamic content extraction. -- 📸 **Screenshots**: Capture page screenshots during crawling for debugging or analysis. -- 📂 **Raw Data Crawling**: Directly process raw HTML (`raw:`) or local files (`file://`). -- 🔗 **Comprehensive Link Extraction**: Extracts internal, external links, and embedded iframe content. -- 🛠️ **Customizable Hooks**: Define hooks at every step to customize crawling behavior (supports both string and function-based APIs). -- 💾 **Caching**: Cache data for improved speed and to avoid redundant fetches. -- 📄 **Metadata Extraction**: Retrieve structured metadata from web pages. -- 📡 **IFrame Content Extraction**: Seamless extraction from embedded iframe content. -- 🕵️ **Lazy Load Handling**: Waits for images to fully load, ensuring no content is missed due to lazy loading. -- 🔄 **Full-Page Scanning**: Simulates scrolling to load and capture all dynamic content, perfect for infinite scroll pages. +- 🖼️ **媒体支持(Media Support)**:提取图片、音频、视频以及 `srcset`、`picture` 等响应式图片格式。 +- 🚀 **动态爬取(Dynamic Crawling)**:执行 JS 并等待异步或同步操作,以提取动态内容。 +- 📸 **截图(Screenshots)**:在爬取过程中捕获页面截图,用于调试或分析。 +- 📂 **原始数据爬取(Raw Data Crawling)**:直接处理原始 HTML(`raw:`)或本地文件(`file://`)。 +- 🔗 **全面链接提取(Comprehensive Link Extraction)**:提取内部链接、外部链接以及嵌入的 iframe 内容。 +- 🛠️ **可定制钩子(Customizable Hooks)**:在每一步定义钩子以自定义爬取行为(支持字符串和基于函数的 API)。 +- 💾 **缓存(Caching)**:缓存数据以提升速度并避免重复请求。 +- 📄 **元数据提取(Metadata Extraction)**:从网页获取结构化元数据。 +- 📡 **IFrame 内容提取(IFrame Content Extraction)**:无缝提取嵌入 iframe 中的内容。 +- 🕵️ **懒加载处理(Lazy Load Handling)**:等待图片完全加载,确保不会因懒加载而遗漏内容。 +- 🔄 **全页扫描(Full-Page Scanning)**:模拟滚动以加载并捕获所有动态内容,非常适合无限滚动页面。
-🚀 Deployment +🚀 部署(Deployment) -- 🐳 **Dockerized Setup**: Optimized Docker image with FastAPI server for easy deployment. -- 🔑 **Secure Authentication**: Built-in JWT token authentication for API security. -- 🔄 **API Gateway**: One-click deployment with secure token authentication for API-based workflows. -- 🌐 **Scalable Architecture**: Designed for mass-scale production and optimized server performance. -- ☁️ **Cloud Deployment**: Ready-to-deploy configurations for major cloud platforms. +- 🐳 **Docker 化部署(Dockerized Setup)**:优化的 Docker 镜像,内置 FastAPI 服务器,便于部署。 +- 🔑 **安全认证(Secure Authentication)**:内置 JWT token 认证,保障 API 安全。 +- 🔄 **API 网关(API Gateway)**:一键部署,配合安全 token 认证,适用于基于 API 的工作流。 +- 🌐 **可扩展架构(Scalable Architecture)**:面向大规模生产环境设计,并优化服务器性能。 +- ☁️ **云部署(Cloud Deployment)**:为主流云平台提供开箱即用的部署配置。
-🎯 Additional Features +🎯 其他功能(Additional Features) -- 🕶️ **Stealth Mode**: Avoid bot detection by mimicking real users. -- 🏷️ **Tag-Based Content Extraction**: Refine crawling based on custom tags, headers, or metadata. -- 🔗 **Link Analysis**: Extract and analyze all links for detailed data exploration. -- 🛡️ **Error Handling**: Robust error management for seamless execution. -- 🔐 **CORS & Static Serving**: Supports filesystem-based caching and cross-origin requests. -- 📖 **Clear Documentation**: Simplified and updated guides for onboarding and advanced usage. -- 🙌 **Community Recognition**: Acknowledges contributors and pull requests for transparency. +- 🕶️ **隐身模式(Stealth Mode)**:通过模拟真实用户来规避机器人检测。 +- 🏷️ **基于标签的内容提取(Tag-Based Content Extraction)**:根据自定义标签、请求头或元数据优化爬取。 +- 🔗 **链接分析(Link Analysis)**:提取并分析所有链接,进行深入数据探索。 +- 🛡️ **错误处理(Error Handling)**:健壮的错误管理,确保流程顺畅执行。 +- 🔐 **CORS 与静态资源服务(CORS & Static Serving)**:支持基于文件系统的缓存与跨域请求。 +- 📖 **清晰文档(Clear Documentation)**:简化且持续更新的指南,便于上手与进阶使用。 +- 🙌 **社区认可(Community Recognition)**:致谢贡献者与 Pull Request,保持透明。
-## Try it Now! +## 立即体验! -✨ Play around with this [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1SgRPrByQLzjRfwoRNq1wSGE9nYY_EE8C?usp=sharing) +✨ 在这里试用 [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1SgRPrByQLzjRfwoRNq1wSGE9nYY_EE8C?usp=sharing) -✨ Visit our [Documentation Website](https://docs.crawl4ai.com/) +✨ 访问我们的 [文档网站](https://docs.crawl4ai.com/) -## Installation 🛠️ +## 安装 🛠️ -Crawl4AI offers flexible installation options to suit various use cases. You can install it as a Python package or use Docker. +Crawl4AI 提供灵活的安装方式,以适应不同使用场景。你可以将其作为 Python 包安装,或使用 Docker。
-🐍 Using pip +🐍 使用 pip -Choose the installation option that best fits your needs: +选择最适合你需求的安装方式: -### Basic Installation +### 基础安装 -For basic web crawling and scraping tasks: +适用于基础网页爬取与抓取任务: ```bash pip install crawl4ai crawl4ai-setup # Setup the browser ``` -By default, this will install the asynchronous version of Crawl4AI, using Playwright for web crawling. +默认情况下,这将安装 Crawl4AI 的异步版本,并使用 Playwright 进行网页爬取。 -👉 **Note**: When you install Crawl4AI, the `crawl4ai-setup` should automatically install and set up Playwright. However, if you encounter any Playwright-related errors, you can manually install it using one of these methods: +👉 **注意**:安装 Crawl4AI 时,`crawl4ai-setup` 应会自动安装并配置 Playwright。不过,若遇到任何与 Playwright 相关的问题,你可以通过以下任一方式手动安装: -1. Through the command line: +1. 通过命令行: ```bash playwright install ``` -2. If the above doesn't work, try this more specific command: +2. 如果上述方法无效,可尝试更具体的命令: ```bash python -m playwright install chromium ``` -This second method has proven to be more reliable in some cases. +在某些情况下,第二种方法已被证明更可靠。 --- -### Installation with Synchronous Version +### 同步版本安装 -The sync version is deprecated and will be removed in future versions. If you need the synchronous version using Selenium: +同步版本已弃用,并将在未来版本中移除。若你需要使用 Selenium 的同步版本: ```bash pip install crawl4ai[sync] @@ -280,9 +286,9 @@ pip install crawl4ai[sync] --- -### Development Installation +### 开发版安装 -For contributors who plan to modify the source code: +适用于计划修改源代码的贡献者: ```bash git clone https://github.com/unclecode/crawl4ai.git @@ -290,7 +296,7 @@ cd crawl4ai pip install -e . # Basic installation in editable mode ``` -Install optional features: +安装可选功能: ```bash pip install -e ".[torch]" # With PyTorch features @@ -303,22 +309,22 @@ pip install -e ".[all]" # Install all optional features
-🐳 Docker Deployment +🐳 Docker 部署(Docker Deployment) -> 🚀 **Now Available!** Our completely redesigned Docker implementation is here! This new solution makes deployment more efficient and seamless than ever. +> 🚀 **现已可用!** 我们全面重构的 Docker 实现已上线!这一新方案让部署比以往更高效、更顺畅。 -### New Docker Features +### 全新 Docker 功能 -The new Docker implementation includes: -- **Real-time Monitoring Dashboard** with live system metrics and browser pool visibility -- **Browser pooling** with page pre-warming for faster response times -- **Interactive playground** to test and generate request code -- **MCP integration** for direct connection to AI tools like Claude Code -- **Comprehensive API endpoints** including HTML extraction, screenshots, PDF generation, and JavaScript execution -- **Multi-architecture support** with automatic detection (AMD64/ARM64) -- **Optimized resources** with improved memory management +新的 Docker 实现包括: +- **实时监控面板(Real-time Monitoring Dashboard)**:实时系统指标与浏览器池可见性 +- **浏览器池(Browser pooling)**:页面预热,加快响应速度 +- **交互式 Playground(Interactive playground)**:测试并生成请求代码 +- **MCP 集成(MCP integration)**:直接连接 Claude Code 等 AI 工具 +- **全面的 API 端点(Comprehensive API endpoints)**:包括 HTML 提取、截图、PDF 生成与 JavaScript 执行 +- **多架构支持(Multi-architecture support)**:自动检测(AMD64/ARM64) +- **资源优化(Optimized resources)**:改进内存管理 -### Getting Started +### 快速开始 ```bash # Pull and run the latest release @@ -329,9 +335,9 @@ docker run -d -p 11235:11235 --name crawl4ai --shm-size=1g unclecode/crawl4ai:la # Or the playground at http://localhost:11235/playground ``` -### Quick Test +### 快速测试 -Run a quick test (works for both Docker options): +运行快速测试(两种 Docker 方式均适用): ```python import requests @@ -355,18 +361,19 @@ else: result = requests.get(f"http://localhost:11235/task/{task_id}") ``` -For more examples, see our [Docker Examples](https://github.com/unclecode/crawl4ai/blob/main/docs/examples/docker_example.py). For advanced configuration, monitoring features, and production deployment, see our [Self-Hosting Guide](https://docs.crawl4ai.com/core/self-hosting/). +更多示例请参阅 [Docker 示例](https://github.com/unclecode/crawl4ai/blob/main/docs/examples/docker_example.py). 高级配置、监控功能与生产部署请参阅 [自托管指南](https://docs.crawl4ai.com/core/self-hosting/). +
--- -## 🔬 Advanced Usage Examples 🔬 +## 🔬 高级用法示例 🔬 -You can check the project structure in the directory [docs/examples](https://github.com/unclecode/crawl4ai/tree/main/docs/examples). Over there, you can find a variety of examples; here, some popular examples are shared. +你可以在 [docs/examples](https://github.com/unclecode/crawl4ai/tree/main/docs/examples). 目录中查看项目结构。在那里你可以找到各种示例;此处分享一些热门示例。
-📝 Heuristic Markdown Generation with Clean and Fit Markdown +📝 使用 Clean and Fit Markdown 进行启发式 Markdown 生成 ```python import asyncio @@ -404,7 +411,7 @@ if __name__ == "__main__":
-🖥️ Executing JavaScript & Extract Structured Data without LLMs +🖥️ 执行 JavaScript 并在无 LLM 的情况下提取结构化数据 ```python import asyncio @@ -477,7 +484,7 @@ if __name__ == "__main__":
-📚 Extracting Structured Data with LLMs +📚 使用 LLM 提取结构化数据 ```python import os @@ -522,7 +529,7 @@ if __name__ == "__main__":
-🤖 Using Your own Browser with Custom User Profile +🤖 使用自定义用户配置文件的自有浏览器 ```python import os, sys @@ -562,53 +569,54 @@ async def test_news_crawl(): --- -## ✨ Recent Updates +## ✨ 最近更新
-Version 0.9.1 Release Highlights - Bug Fixes & PruningContentFilter Whitelist +版本 0.9.1 发布亮点 - 错误修复与 PruningContentFilter 白名单 -A patch release with 12 bug fixes and one new feature. The new `preserve_classes` / `preserve_tags` parameters for `PruningContentFilter` let you whitelist CSS classes or HTML tags that should never be pruned — useful for protecting short metadata elements like author names and timestamps. +这是一个补丁版本,包含 12 项错误修复和一项新功能。`PruningContentFilter` 新增的 `preserve_classes` / `preserve_tags` 参数可让你将绝不应被剪枝的 CSS 类或 HTML 标签加入白名单——适用于保护作者名、时间戳等简短元数据元素。 -Bug fixes span Docker (auth gate UI, supervisord/redis dirs, FastAPI compatibility, redis auth), browser (Windows channel crash, context snapshot leak), core (HTTP timeout unit mismatch, best-first ordering), and extraction (html2text table attributes). +错误修复涵盖 Docker(认证网关 UI、supervisord/redis 目录、FastAPI 兼容性、redis 认证)、browser(Windows channel 崩溃、context snapshot 泄漏)、core(HTTP 超时单位不匹配、best-first 排序)以及 extraction(html2text 表格属性)。 ```bash pip install -U crawl4ai ``` -[Full v0.9.1 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.1.md) +[完整 v0.9.1 发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.1.md)
-Version 0.9.0 Release Highlights - Secure-by-Default Docker Server +版本 0.9.0 发布亮点 - 默认安全的 Docker 服务器 -A major, secure-by-default release of the Docker API server. The out-of-the-box deployment is hardened with defense in depth: authentication is on by default, the server binds loopback unless you give it a token, and the network request body is treated as an untrusted trust boundary. +Docker API 服务器的一次重大、默认安全发布。开箱即用的部署通过纵深防御进行了加固:默认启用认证,除非你提供 token,否则服务器绑定到 loopback,且网络请求体被视为不受信任的信任边界。 ```bash pip install -U crawl4ai ``` -[Migration Guide →](https://github.com/unclecode/crawl4ai/blob/main/deploy/docker/MIGRATION.md) · [Full v0.9.0 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.0.md) +[迁移指南 →](https://github.com/unclecode/crawl4ai/blob/main/deploy/docker/MIGRATION.md) · [完整 v0.9.0 发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.9.0.md) +
-Version 0.8.7 Release Highlights - Security Hardening, DomainMapper & Community Fixes +Version 0.8.7 发布亮点 - 安全加固、DomainMapper 与社区修复 -A security-hardening release. Fixes critical Docker API vulnerabilities (AST sandbox escape RCE, hook sandbox RCE, hardcoded JWT secret, SSRF on webhook and crawl endpoints, arbitrary file write, monitor auth bypass, stored XSS, and unauthenticated JS execution), adds the DomainMapper feature, and ships a batch of scraping, deep-crawl, and LLM fixes. If you self-host the Docker API, upgrade immediately. +一次安全加固版本。修复了 Docker API 中的关键漏洞(AST 沙箱逃逸 RCE、hook 沙箱 RCE、硬编码 JWT 密钥、webhook 与 crawl 端点的 SSRF、任意文件写入、monitor 认证绕过、存储型 XSS,以及未经认证的 JS 执行),新增 DomainMapper 功能,并带来一批抓取、深度爬取与 LLM 相关修复。若你自行托管 Docker API,请立即升级。 ```bash pip install -U crawl4ai ``` -[Full v0.8.7 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.7.md) +[完整 v0.8.7 发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.7.md)
-Version 0.8.6 - Security Hotfix: litellm Supply Chain Fix +Version 0.8.6 - 安全热修复:litellm 供应链修复 -Replaced `litellm` dependency with `unclecode-litellm` due to a PyPI supply chain compromise affecting the original package. If you're on v0.8.5 or earlier, upgrade immediately. +由于 PyPI 供应链攻击影响了原始软件包,已将 `litellm` 依赖替换为 `unclecode-litellm`。若你使用的是 v0.8.5 或更早版本,请立即升级。 ```bash pip install -U crawl4ai @@ -617,13 +625,13 @@ pip install -U crawl4ai
-Version 0.8.5 Release Highlights - Anti-Bot Detection, Shadow DOM & 60+ Bug Fixes +Version 0.8.5 发布亮点 - 反机器人检测、Shadow DOM 与 60+ 项 Bug 修复 -Our biggest release since v0.8.0. Anti-bot detection with proxy escalation, Shadow DOM flattening, deep crawl cancellation, and over 60 bug fixes. +自 v0.8.0 以来最大的一次发布。包含反机器人检测与代理升级、Shadow DOM 扁平化、深度爬取取消,以及超过 60 项 bug 修复。 -- **🛡️ Anti-Bot Detection & Proxy Escalation**: - - 3-tier detection: known vendors, generic block indicators, structural integrity checks - - Automatic retry with proxy chain and fallback fetch function +- **🛡️ 反机器人检测与代理升级(Proxy Escalation)**: + - 三层检测:已知厂商、通用拦截指标、结构完整性检查 + - 通过代理链与备用 fetch 函数自动重试 ```python from crawl4ai import CrawlerRunConfig from crawl4ai.async_configs import ProxyConfig @@ -635,39 +643,39 @@ Our biggest release since v0.8.0. Anti-bot detection with proxy escalation, Shad ) ``` -- **🌑 Shadow DOM Flattening**: - - Extract content hidden inside shadow DOM components +- **🌑 Shadow DOM 扁平化**: + - 提取隐藏在 shadow DOM 组件内的内容 ```python config = CrawlerRunConfig(flatten_shadow_dom=True) ``` -- **🛑 Deep Crawl Cancellation**: - - Stop long crawls gracefully with `cancel()` or `should_cancel` callback - - Works with BFS, DFS, and BestFirst strategies +- **🛑 深度爬取取消**: + - 通过 `cancel()` 或 `should_cancel` 回调优雅停止长时间爬取 + - 支持 BFS、DFS 与 BestFirst 策略 -- **⚙️ Config Defaults API**: - - `set_defaults()` / `get_defaults()` / `reset_defaults()` on BrowserConfig and CrawlerRunConfig +- **⚙️ 配置默认值 API**: + - BrowserConfig 与 CrawlerRunConfig 上的 `set_defaults()` / `get_defaults()` / `reset_defaults()` -- **🔒 Critical Security Fixes**: - - RCE via deserialization in Docker `/crawl` endpoint — removed `eval()`, added allowlist - - Redis CVE-2025-49844 (CVSS 10.0) — upgraded to 7.2.7 +- **🔒 关键安全修复**: + - Docker `/crawl` 端点反序列化导致的 RCE — 已移除 `eval()`,并新增白名单 + - Redis CVE-2025-49844(CVSS 10.0)— 已升级至 7.2.7 -- **60+ Bug Fixes** across browser management, proxy, deep crawling, extraction, CLI, and Docker +- **60+ 项 Bug 修复**,涵盖浏览器管理、代理、深度爬取、提取、CLI 与 Docker -[Full v0.8.5 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.5.md) +[完整 v0.8.5 发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.5.md)
-Version 0.8.0 Release Highlights - Crash Recovery & Prefetch Mode +Version 0.8.0 发布亮点 - 崩溃恢复与预取模式 -This release introduces crash recovery for deep crawls, a new prefetch mode for fast URL discovery, and critical security fixes for Docker deployments. +本版本为深度爬取引入崩溃恢复、用于快速 URL 发现的全新预取模式,以及针对 Docker 部署的关键安全修复。 -- **🔄 Deep Crawl Crash Recovery**: - - `on_state_change` callback fires after each URL for real-time state persistence - - `resume_state` parameter to continue from a saved checkpoint - - JSON-serializable state for Redis/database storage - - Works with BFS, DFS, and Best-First strategies +- **🔄 深度爬取崩溃恢复**: + - `on_state_change` 回调在每个 URL 处理后触发,实现实时状态持久化 + - `resume_state` 参数用于从已保存的检查点继续 + - 可 JSON 序列化的状态,便于 Redis/数据库存储 + - 支持 BFS、DFS 与 Best-First 策略 ```python from crawl4ai.deep_crawling import BFSDeepCrawlStrategy @@ -678,37 +686,37 @@ This release introduces crash recovery for deep crawls, a new prefetch mode for ) ``` -- **⚡ Prefetch Mode for Fast URL Discovery**: - - `prefetch=True` skips markdown, extraction, and media processing - - 5-10x faster than full processing - - Perfect for two-phase crawling: discover first, process selectively +- **⚡ 用于快速 URL 发现的预取模式**: + - `prefetch=True` 跳过 markdown、提取与媒体处理 + - 比完整处理快 5-10 倍 + - 非常适合两阶段爬取:先发现,再选择性处理 ```python config = CrawlerRunConfig(prefetch=True) result = await crawler.arun("https://example.com", config=config) # Returns HTML and links only - no markdown generation ``` -- **🔒 Security Fixes (Docker API)**: - - Hooks disabled by default (`CRAWL4AI_HOOKS_ENABLED=false`) - - `file://` URLs blocked on API endpoints to prevent LFI - - `__import__` removed from hook execution sandbox +- **🔒 安全修复(Docker API)**: + - 默认禁用 hooks(`CRAWL4AI_HOOKS_ENABLED=false`) + - API 端点阻止 `file://` URL,以防 LFI + - 已从 hook 执行沙箱中移除 `__import__` -[Full v0.8.0 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.0.md) +[完整 v0.8.0 发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.0.md)
-Version 0.7.8 Release Highlights - Stability & Bug Fix Release +Version 0.7.8 发布亮点 - 稳定性与 Bug 修复版本 -This release focuses on stability with 11 bug fixes addressing issues reported by the community. No new features, but significant improvements to reliability. +本版本聚焦稳定性,包含 11 项 bug 修复,解决社区反馈的问题。无新功能,但可靠性显著提升。 -- **🐳 Docker API Fixes**: - - Fixed `ContentRelevanceFilter` deserialization in deep crawl requests (#1642) - - Fixed `ProxyConfig` JSON serialization in `BrowserConfig.to_dict()` (#1629) - - Fixed `.cache` folder permissions in Docker image (#1638) +- **🐳 Docker API 修复**: + - 修复深度爬取请求中的 `ContentRelevanceFilter` 反序列化问题(#1642) + - 修复 `BrowserConfig.to_dict()` 中 `ProxyConfig` JSON 序列化问题(#1629) + - 修复 Docker 镜像中 `.cache` 文件夹权限问题(#1638) -- **🤖 LLM Extraction Improvements**: - - Configurable rate limiter backoff with new `LLMConfig` parameters (#1269): +- **🤖 LLM 提取改进**: + - 可通过新的 `LLMConfig` 参数配置速率限制器退避(#1269): ```python from crawl4ai import LLMConfig @@ -719,7 +727,7 @@ This release focuses on stability with 11 bug fixes addressing issues reported b backoff_exponential_factor=3 # Multiply delay by 3 each attempt ) ``` - - HTML input format support for `LLMExtractionStrategy` (#1178): + - `LLMExtractionStrategy` 支持 HTML 输入格式(#1178): ```python from crawl4ai import LLMExtractionStrategy @@ -729,27 +737,27 @@ This release focuses on stability with 11 bug fixes addressing issues reported b input_format="html" # Now supports: "html", "markdown", "fit_markdown" ) ``` - - Fixed raw HTML URL variable - extraction strategies now receive `"Raw HTML"` instead of HTML blob (#1116) + - 修复原始 HTML URL 变量 — 提取策略现在接收 `"Raw HTML"` 而非 HTML blob(#1116) -- **🔗 URL Handling**: - - Fixed relative URL resolution after JavaScript redirects (#1268) - - Fixed import statement formatting in extracted code (#1181) +- **🔗 URL 处理**: + - 修复 JavaScript 重定向后的相对 URL 解析问题(#1268) + - 修复提取代码中 import 语句格式问题(#1181) -- **📦 Dependency Updates**: - - Replaced deprecated PyPDF2 with pypdf (#1412) - - Pydantic v2 ConfigDict compatibility - no more deprecation warnings (#678) +- **📦 依赖更新**: + - 用 pypdf 替换已弃用的 PyPDF2(#1412) + - Pydantic v2 ConfigDict 兼容性 — 不再出现弃用警告(#678) -- **🧠 AdaptiveCrawler**: - - Fixed query expansion to actually use LLM instead of hardcoded mock data (#1621) +- **🧠 AdaptiveCrawler**: + - 修复查询扩展,使其实际使用 LLM 而非硬编码模拟数据(#1621) -[Full v0.7.8 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.8.md) +[完整 v0.7.8 发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.8.md)
-Version 0.7.7 Release Highlights - The Self-Hosting & Monitoring Update +Version 0.7.7 发布亮点 - 自托管与监控更新 -- **📊 Real-time Monitoring Dashboard**: Interactive web UI with live system metrics and browser pool visibility +- **📊 实时监控仪表板**:交互式 Web UI,提供实时系统指标与浏览器池可见性 ```python # Access the monitoring dashboard # Visit: http://localhost:11235/dashboard @@ -762,7 +770,7 @@ This release focuses on stability with 11 bug fixes addressing issues reported b # - Error monitoring with full context ``` -- **🔌 Comprehensive Monitor API**: Complete REST API for programmatic access to all monitoring data +- **🔌 全面的 Monitor API**:完整的 REST API,用于以编程方式访问所有监控数据 ```python import httpx @@ -780,28 +788,25 @@ This release focuses on stability with 11 bug fixes addressing issues reported b stats = await client.get("http://localhost:11235/monitor/endpoints/stats") ``` -- **⚡ WebSocket Streaming**: Real-time updates every 2 seconds for custom dashboards -- **🔥 Smart Browser Pool**: 3-tier architecture (permanent/hot/cold) with automatic promotion and cleanup -- **🧹 Janitor System**: Automatic resource management with event logging -- **🎮 Control Actions**: Manual browser management (kill, restart, cleanup) via API -- **📈 Production Metrics**: 6 critical metrics for operational excellence with Prometheus integration -- **🐛 Critical Bug Fixes**: - - Fixed async LLM extraction blocking issue (#1055) - - Enhanced DFS deep crawl strategy (#1607) - - Fixed sitemap parsing in AsyncUrlSeeder (#1598) - - Resolved browser viewport configuration (#1495) - - Fixed CDP timing with exponential backoff (#1528) - - Security update for pyOpenSSL (>=25.3.0) - -[Full v0.7.7 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.7.md) - +- **⚡ WebSocket 流式传输**:每 2 秒推送实时更新,适用于自定义仪表板 +- **🔥 智能浏览器池**:三层架构(permanent/hot/cold),支持自动晋升与清理 +- **🧹 Janitor 系统**:自动资源管理,并记录事件日志 +- **🎮 控制操作**:通过 API 手动管理浏览器(kill、restart、cleanup) +- **📈 生产指标**:6 项关键运营指标,并集成 Prometheus +- **🐛 关键 Bug 修复**: + - 修复异步 LLM 提取阻塞问题(#1055) + - 增强 DFS 深度爬取策略(#1607) + - 修复 AsyncUrlSeeder 中的 sitemap 解析问题(#1598) + - 解决浏览器视口配置问题(#1495) + - 修复 CDP 时序问题,采用指数退避(#1528) + - pyOpenSSL 安全更新(>=25.3.0)
-Version 0.7.5 Release Highlights - The Docker Hooks & Security Update +Version 0.7.5 发布亮点 - Docker Hooks 与安全更新 -- **🔧 Docker Hooks System**: Complete pipeline customization with user-provided Python functions at 8 key points -- **✨ Function-Based Hooks API (NEW)**: Write hooks as regular Python functions with full IDE support: +- **🔧 Docker Hooks 系统**:在 8 个关键节点通过用户提供的 Python 函数实现完整的流水线自定义 +- **✨ 基于函数的 Hooks API(新增)**:将 hooks 编写为常规 Python 函数,获得完整的 IDE 支持: ```python from crawl4ai import hooks_to_string from crawl4ai.docker_client import Crawl4aiDockerClient @@ -836,19 +841,19 @@ This release focuses on stability with 11 bug fixes addressing issues reported b # ✓ Full IDE support, type checking, and reusability! ``` -- **🤖 Enhanced LLM Integration**: Custom providers with temperature control and base_url configuration -- **🔒 HTTPS Preservation**: Secure internal link handling with `preserve_https_for_internal_links=True` -- **🐍 Python 3.10+ Support**: Modern language features and enhanced performance -- **🛠️ Bug Fixes**: Resolved multiple community-reported issues including URL processing, JWT authentication, and proxy configuration +- **🤖 增强的 LLM 集成**:支持自定义提供商,并提供 temperature 控制与 base_url 配置 +- **🔒 HTTPS 保持**:通过 `preserve_https_for_internal_links=True` 安全处理内部链接 +- **🐍 Python 3.10+ 支持**:现代语言特性与更高性能 +- **🛠️ Bug 修复**:修复了社区反馈的多项问题,包括 URL 处理、JWT 认证与代理配置 -[Full v0.7.5 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.5.md) +[完整 v0.7.5 发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.5.md)
-Version 0.7.4 Release Highlights - The Intelligent Table Extraction & Performance Update +Version 0.7.4 发布亮点 - 智能表格提取与性能更新 -- **🚀 LLMTableExtraction**: Revolutionary table extraction with intelligent chunking for massive tables: +- **🚀 LLMTableExtraction**:革命性的表格提取,通过智能分块处理超大表格: ```python from crawl4ai import LLMTableExtraction, LLMConfig @@ -869,20 +874,20 @@ This release focuses on stability with 11 bug fixes addressing issues reported b print(f"Extracted table: {len(table['data'])} rows") ``` -- **⚡ Dispatcher Bug Fix**: Fixed sequential processing bottleneck in arun_many for fast-completing tasks -- **🧹 Memory Management Refactor**: Consolidated memory utilities into main utils module for cleaner architecture -- **🔧 Browser Manager Fixes**: Resolved race conditions in concurrent page creation with thread-safe locking -- **🔗 Advanced URL Processing**: Better handling of raw:// URLs and base tag link resolution -- **🛡️ Enhanced Proxy Support**: Flexible proxy configuration supporting both dict and string formats +- **⚡ Dispatcher Bug 修复**:修复了 arun_many 中快速完成任务时的顺序处理瓶颈 +- **🧹 内存管理重构**:将内存工具整合到主 utils 模块,架构更清晰 +- **🔧 Browser Manager 修复**:通过线程安全锁解决并发创建页面时的竞态条件 +- **🔗 高级 URL 处理**:更好地处理 raw:// URL 与 base 标签链接解析 +- **🛡️ 增强的代理支持**:灵活的代理配置,同时支持 dict 与 string 格式 -[Full v0.7.4 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.4.md) +[完整 v0.7.4 发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.4.md)
-Version 0.7.3 Release Highlights - The Multi-Config Intelligence Update +Version 0.7.3 发布亮点 - 多配置智能更新 -- **🕵️ Undetected Browser Support**: Bypass sophisticated bot detection systems: +- **🕵️ 反检测浏览器支持**:绕过复杂的机器人检测系统: ```python from crawl4ai import AsyncWebCrawler, BrowserConfig @@ -900,7 +905,7 @@ This release focuses on stability with 11 bug fixes addressing issues reported b # Successfully bypass Cloudflare, Akamai, and custom bot detection ``` -- **🎨 Multi-URL Configuration**: Different strategies for different URL patterns in one batch: +- **🎨 多 URL 配置**:在同一批次中为不同 URL 模式应用不同策略: ```python from crawl4ai import CrawlerRunConfig, MatchMode, CacheMode @@ -926,7 +931,7 @@ from crawl4ai import CrawlerRunConfig, MatchMode, CacheMode # Each URL gets the perfect configuration automatically ``` -- **🧠 Memory Monitoring**: Track and optimize memory usage during crawling: +- **🧠 内存监控**:在爬取过程中跟踪并优化内存使用: ```python from crawl4ai.memory_utils import MemoryMonitor @@ -941,7 +946,7 @@ from crawl4ai import CrawlerRunConfig, MatchMode, CacheMode # Get optimization recommendations ``` -- **📊 Enhanced Table Extraction**: Direct DataFrame conversion from web tables: +- **📊 增强的表格提取**:将网页表格直接转换为 DataFrame: ```python result = await crawler.arun("https://site-with-tables.com") @@ -953,17 +958,17 @@ from crawl4ai import CrawlerRunConfig, MatchMode, CacheMode print(f"Table: {df.shape[0]} rows × {df.shape[1]} columns") ``` -- **💰 GitHub Sponsors**: 4-tier sponsorship system for project sustainability -- **🐳 Docker LLM Flexibility**: Configure providers via environment variables +- **💰 GitHub Sponsors**:四级赞助体系,保障项目可持续发展 +- **🐳 Docker LLM 灵活性**:通过环境变量配置提供商 -[Full v0.7.3 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.3.md) +[完整 v0.7.3 发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.3.md)
-Version 0.7.0 Release Highlights - The Adaptive Intelligence Update +Version 0.7.0 发布亮点 - 自适应智能更新 -- **🧠 Adaptive Crawling**: Your crawler now learns and adapts to website patterns automatically: +- **🧠 自适应爬取(Adaptive Crawling)**:爬虫可自动学习并适应网站模式: ```python config = AdaptiveConfig( confidence_threshold=0.7, # Min confidence to stop crawling @@ -981,7 +986,7 @@ from crawl4ai import CrawlerRunConfig, MatchMode, CacheMode # Crawler learns patterns and improves extraction over time ``` -- **🌊 Virtual Scroll Support**: Complete content extraction from infinite scroll pages: +- **🌊 虚拟滚动支持**:完整提取无限滚动页面的内容: ```python scroll_config = VirtualScrollConfig( container_selector="[data-testid='feed']", @@ -995,7 +1000,7 @@ from crawl4ai import CrawlerRunConfig, MatchMode, CacheMode )) ``` -- **🔗 Intelligent Link Analysis**: 3-layer scoring system for smart link prioritization: +- **🔗 智能链接分析**:三层评分系统,实现智能链接优先级排序: ```python link_config = LinkPreviewConfig( query="machine learning tutorials", @@ -1010,7 +1015,11 @@ from crawl4ai import CrawlerRunConfig, MatchMode, CacheMode # Links ranked by relevance and quality ``` -- **🎣 Async URL Seeder**: Discover thousands of URLs in seconds: +[完整 v0.7.7 发布说明 →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.7.7.md) + +
+ +- **🎣 异步 URL 播种器 (Async URL Seeder)**:数秒内发现数千个 URL: ```python seeder = AsyncUrlSeeder(SeedingConfig( source="sitemap+cc", @@ -1022,110 +1031,110 @@ from crawl4ai import CrawlerRunConfig, MatchMode, CacheMode urls = await seeder.discover("https://example.com") ``` -- **⚡ Performance Boost**: Up to 3x faster with optimized resource handling and memory efficiency +- **⚡ 性能提升**:通过优化资源处理与内存效率,速度最高可达 3 倍 -Read the full details in our [0.7.0 Release Notes](https://docs.crawl4ai.com/blog/release-v0.7.0) or check the [CHANGELOG](https://github.com/unclecode/crawl4ai/blob/main/CHANGELOG.md). +完整详情请参阅我们的 [0.7.0 发行说明](https://docs.crawl4ai.com/blog/release-v0.7.0),或查看 [CHANGELOG](https://github.com/unclecode/crawl4ai/blob/main/CHANGELOG.md). -## Version Numbering in Crawl4AI +## Crawl4AI 中的版本号规则 -Crawl4AI follows standard Python version numbering conventions (PEP 440) to help users understand the stability and features of each release. +Crawl4AI 遵循标准的 Python 版本号约定(PEP 440),帮助用户理解每个版本的稳定性与功能特性。
-📈 Version Numbers Explained +📈 版本号说明 -Our version numbers follow this pattern: `MAJOR.MINOR.PATCH` (e.g., 0.4.3) +我们的版本号遵循以下模式:`MAJOR.MINOR.PATCH`(例如 0.4.3) -#### Pre-release Versions -We use different suffixes to indicate development stages: +#### 预发布版本 +我们使用不同后缀表示开发阶段: -- `dev` (0.4.3dev1): Development versions, unstable -- `a` (0.4.3a1): Alpha releases, experimental features -- `b` (0.4.3b1): Beta releases, feature complete but needs testing -- `rc` (0.4.3): Release candidates, potential final version +- `dev`(0.4.3dev1):开发版本,不稳定 +- `a`(0.4.3a1):Alpha 版本,实验性功能 +- `b`(0.4.3b1):Beta 版本,功能已完整但需测试 +- `rc`(0.4.3):候选发布版本(Release Candidate),可能成为最终版本 -#### Installation -- Regular installation (stable version): +#### 安装 +- 常规安装(稳定版): ```bash pip install -U crawl4ai ``` -- Install pre-release versions: +- 安装预发布版本: ```bash pip install crawl4ai --pre ``` -- Install specific version: +- 安装指定版本: ```bash pip install crawl4ai==0.4.3b1 ``` -#### Why Pre-releases? -We use pre-releases to: -- Test new features in real-world scenarios -- Gather feedback before final releases -- Ensure stability for production users -- Allow early adopters to try new features +#### 为何提供预发布版本? +我们使用预发布版本来: +- 在真实场景中测试新功能 +- 在正式发布前收集反馈 +- 确保生产环境用户的稳定性 +- 让早期采用者试用新功能 -For production environments, we recommend using the stable version. For testing new features, you can opt-in to pre-releases using the `--pre` flag. +对于生产环境,我们建议使用稳定版本。若要测试新功能,可使用 `--pre` 标志选择安装预发布版本。
-## 📖 Documentation & Roadmap +## 📖 文档与路线图 -> 🚨 **Documentation Update Alert**: We're undertaking a major documentation overhaul next week to reflect recent updates and improvements. Stay tuned for a more comprehensive and up-to-date guide! +> 🚨 **文档更新提醒**:我们下周将进行一次大规模文档重构,以反映近期的更新与改进。敬请期待更全面、更及时的指南! -For current documentation, including installation instructions, advanced features, and API reference, visit our [Documentation Website](https://docs.crawl4ai.com/). +当前文档(含安装说明、高级功能与 API 参考)请访问我们的 [文档网站](https://docs.crawl4ai.com/). -To check our development plans and upcoming features, visit our [Roadmap](https://github.com/unclecode/crawl4ai/blob/main/ROADMAP.md). +若要了解开发计划与即将推出的功能,请访问我们的 [路线图](https://github.com/unclecode/crawl4ai/blob/main/ROADMAP.md).
-📈 Development TODOs +📈 开发待办事项 -- [x] 0. Graph Crawler: Smart website traversal using graph search algorithms for comprehensive nested page extraction -- [x] 1. Question-Based Crawler: Natural language driven web discovery and content extraction -- [x] 2. Knowledge-Optimal Crawler: Smart crawling that maximizes knowledge while minimizing data extraction -- [x] 3. Agentic Crawler: Autonomous system for complex multi-step crawling operations -- [x] 4. Automated Schema Generator: Convert natural language to extraction schemas -- [x] 5. Domain-Specific Scrapers: Pre-configured extractors for common platforms (academic, e-commerce) -- [x] 6. Web Embedding Index: Semantic search infrastructure for crawled content -- [x] 7. Interactive Playground: Web UI for testing, comparing strategies with AI assistance -- [x] 8. Performance Monitor: Real-time insights into crawler operations -- [ ] 9. Cloud Integration: One-click deployment solutions across cloud providers -- [x] 10. Sponsorship Program: Structured support system with tiered benefits -- [ ] 11. Educational Content: "How to Crawl" video series and interactive tutorials +- [x] 0. 图爬虫 (Graph Crawler):使用图搜索算法进行智能网站遍历,实现全面的嵌套页面提取 +- [x] 1. 问答式爬虫 (Question-Based Crawler):由自然语言驱动的网页发现与内容提取 +- [x] 2. 知识最优爬虫 (Knowledge-Optimal Crawler):在最大化知识获取的同时最小化数据提取的智能爬取 +- [x] 3. 智能体爬虫 (Agentic Crawler):用于复杂多步爬取操作的自主系统 +- [x] 4. 自动化 Schema 生成器 (Automated Schema Generator):将自然语言转换为提取 Schema +- [x] 5. 领域专用抓取器 (Domain-Specific Scrapers):面向常见平台(学术、电商)的预配置提取器 +- [x] 6. Web 嵌入索引 (Web Embedding Index):面向已爬取内容的语义搜索基础设施 +- [x] 7. 交互式演练场 (Interactive Playground):用于测试、比较策略并提供 AI 辅助的 Web UI +- [x] 8. 性能监控器 (Performance Monitor):爬虫运行状态的实时洞察 +- [ ] 9. 云集成 (Cloud Integration):跨云服务商的一键部署方案 +- [x] 10. 赞助计划 (Sponsorship Program):带分级权益的结构化支持体系 +- [ ] 11. 教育内容 (Educational Content):"如何爬取"视频系列与交互式教程
-## 🤝 Contributing +## 🤝 贡献 -We welcome contributions from the open-source community. Check out our [contribution guidelines](https://github.com/unclecode/crawl4ai/blob/main/CONTRIBUTORS.md) for more information. +我们欢迎开源社区的贡献。更多信息请参阅我们的 [贡献指南](https://github.com/unclecode/crawl4ai/blob/main/CONTRIBUTORS.md)。 -I'll help modify the license section with badges. For the halftone effect, here's a version with it: +我将协助修改带徽章的许可证部分。关于半色调效果,这里是一版包含该效果的内容: -Here's the updated license section: +以下是更新后的许可证部分: -## 📄 License & Attribution +## 📄 许可证与署名 -This project is licensed under the Apache License 2.0, attribution is recommended via the badges below. See the [Apache 2.0 License](https://github.com/unclecode/crawl4ai/blob/main/LICENSE) file for details. +本项目采用 Apache License 2.0 许可,建议通过下方徽章进行署名。详情见 [Apache 2.0 许可证](https://github.com/unclecode/crawl4ai/blob/main/LICENSE) 文件。 -### Attribution Requirements -When using Crawl4AI, you must include one of the following attribution methods: +### 署名要求 +使用 Crawl4AI 时,必须采用以下署名方式之一:
-📈 1. Badge Attribution (Recommended) -Add one of these badges to your README, documentation, or website: +📈 1. 徽章署名(推荐) +在你的 README、文档或网站中添加以下徽章之一: -| Theme | Badge | +| 主题 | 徽章 | |-------|-------| -| **Disco Theme (Animated)** | Powered by Crawl4AI | -| **Night Theme (Dark with Neon)** | Powered by Crawl4AI | -| **Dark Theme (Classic)** | Powered by Crawl4AI | -| **Light Theme (Classic)** | Powered by Crawl4AI | +| **Disco 主题(动画)** | Powered by Crawl4AI | +| **Night 主题(深色霓虹)** | Powered by Crawl4AI | +| **Dark 主题(经典)** | Powered by Crawl4AI | +| **Light 主题(经典)** | Powered by Crawl4AI | -HTML code for adding the badges: +添加徽章的 HTML 代码: ```html @@ -1156,16 +1165,16 @@ HTML code for adding the badges:
-📖 2. Text Attribution -Add this line to your documentation: +📖 2. 文字署名 +在你的文档中加入以下一行: ``` This project uses Crawl4AI (https://github.com/unclecode/crawl4ai) for web data extraction. ```
-## 📚 Citation +## 📚 引用 -If you use Crawl4AI in your research or project, please cite: +若你在研究或项目中使用 Crawl4AI,请引用: ```bibtex @software{crawl4ai2024, @@ -1179,82 +1188,82 @@ If you use Crawl4AI in your research or project, please cite: } ``` -Text citation format: +文本引用格式: ``` UncleCode. (2024). Crawl4AI: Open-source LLM Friendly Web Crawler & Scraper [Computer software]. GitHub. https://github.com/unclecode/crawl4ai ``` -## 📧 Contact +## 📧 联系方式 -For questions, suggestions, or feedback, feel free to reach out: +如有问题、建议或反馈,欢迎联系: - GitHub: [unclecode](https://github.com/unclecode) - Twitter: [@unclecode](https://twitter.com/unclecode) -- Website: [crawl4ai.com](https://crawl4ai.com) +- 网站: [crawl4ai.com](https://crawl4ai.com) -Happy Crawling! 🕸️🚀 +爬取愉快!🕸️🚀 -## 🗾 Mission +## 🗾 使命 -Our mission is to unlock the value of personal and enterprise data by transforming digital footprints into structured, tradeable assets. Crawl4AI empowers individuals and organizations with open-source tools to extract and structure data, fostering a shared data economy. +我们的使命是通过将数字足迹转化为结构化、可交易的资产,释放个人与企业数据的价值。Crawl4AI 以开源工具赋能个人与组织进行数据提取与结构化,推动共享数据经济。 -We envision a future where AI is powered by real human knowledge, ensuring data creators directly benefit from their contributions. By democratizing data and enabling ethical sharing, we are laying the foundation for authentic AI advancement. +我们展望这样的未来:AI 由真实人类知识驱动,确保数据创造者直接从其贡献中受益。通过数据民主化与合乎伦理的共享,我们正为真正的 AI 进步奠定基础。
-🔑 Key Opportunities +🔑 关键机遇 -- **Data Capitalization**: Transform digital footprints into measurable, valuable assets. -- **Authentic AI Data**: Provide AI systems with real human insights. -- **Shared Economy**: Create a fair data marketplace that benefits data creators. +- **数据资本化**:将数字足迹转化为可度量、有价值的资产。 +- **真实 AI 数据**:为 AI 系统提供真实人类洞察。 +- **共享经济**:打造惠及数据创造者的公平数据市场。
-🚀 Development Pathway +🚀 Development Pathway(发展路径) -1. **Open-Source Tools**: Community-driven platforms for transparent data extraction. -2. **Digital Asset Structuring**: Tools to organize and value digital knowledge. -3. **Ethical Data Marketplace**: A secure, fair platform for exchanging structured data. +1. **Open-Source Tools(开源工具)**:面向透明数据提取的社区驱动平台。 +2. **Digital Asset Structuring(数字资产结构化)**:用于组织与评估数字知识的工具。 +3. **Ethical Data Marketplace(伦理数据市场)**:用于交换结构化数据的安全、公平平台。 -For more details, see our [full mission statement](./MISSION.md). +更多详情,请参阅我们的[完整使命声明](./MISSION.md)。
-## 🌟 Current Sponsors +## 🌟 Current Sponsors(当前赞助商) -### 🤝 Strategic Partners +### 🤝 Strategic Partners(战略合作伙伴) -These companies provide core infrastructure and technology that power Crawl4AI’s capabilities — from web access and proxy networks to AI tooling and data pipelines. +这些公司提供支撑 Crawl4AI 能力的核心基础设施与技术——从 Web 访问与代理网络,到 AI 工具与数据流水线。 | Company | About | |------|------| -|
Massive | Massive is a web access API backed by millions of volunteer devices in 195+ countries. AI agents, models, and data pipelines use it to reach any site on the internet, reliably, in real time, and at scale. | +| Massive | Massive 是一款 Web 访问 API,依托遍布 195+ 个国家/地区的数百万台志愿者设备。AI 智能体、模型与数据流水线可借助它可靠、实时、大规模地访问互联网上的任意网站。 | -### 🏢 Enterprise Sponsors +### 🏢 Enterprise Sponsors(企业赞助商) -Our enterprise sponsors support Crawl4AI and help scale it to power production-grade data pipelines. +我们的企业赞助商支持 Crawl4AI,并帮助其扩展规模,以支撑生产级数据流水线。 | Company | About | Sponsorship Tier | |------|------|----------------------------| -| DataSync | Helps engineers and buyers find, compare, and source electronic & industrial parts in seconds, with specs, pricing, lead times & alternatives.| 🥇 Gold | -| Kidocode | Kidocode is a hybrid technology and entrepreneurship school for kids aged 5–18, offering both online and on-campus education. | 🥇 Gold | -| Aleph null | Singapore-based Aleph Null is Asia’s leading edtech hub, dedicated to student-centric, AI-driven education—empowering learners with the tools to thrive in a fast-changing world. | 🥇 Gold | +| DataSync | 帮助工程师与采购人员在数秒内查找、比较并采购电子与工业零部件,并提供规格、价格、交期与替代方案。| 🥇 Gold | +| Kidocode | Kidocode 是一所面向 5–18 岁儿童的混合式技术与创业学校,提供线上与校园教育。 | 🥇 Gold | +| Aleph null | 总部位于新加坡的 Aleph Null 是亚洲领先的 edtech 中心,致力于以学生为中心、AI 驱动的教育——为学习者提供在快速变化的世界中茁壮成长的工具。 | 🥇 Gold | --- -### 💼 Become a Strategic Partner or Sponsor +### 💼 Become a Strategic Partner or Sponsor(成为战略合作伙伴或赞助商) -Interested in partnering with Crawl4AI? +有兴趣与 Crawl4AI 合作? -Whether you’re a proxy provider, AI infrastructure company, cloud platform, or an organization looking to support the Crawl4AI ecosystem, we’d love to hear from you. +无论你是代理提供商、AI 基础设施公司、云平台,还是希望支持 Crawl4AI 生态的组织,我们都欢迎与你联系。 📩 Contact: hello@crawl4ai.com -### 🧑‍🤝 Individual Sponsors +### 🧑‍🤝 Individual Sponsors(个人赞助商) -A heartfelt thanks to our individual supporters! Every contribution helps us keep our opensource mission alive and thriving! +衷心感谢我们的个人支持者!每一份贡献都帮助我们保持开源使命的活力与持续发展!