docs: CJK Latin spacing fixes for the Chinese README

This commit is contained in:
Karim shoair
2026-03-16 15:26:25 +02:00
parent eb32285c49
commit ca6c1f3c1e
+77 -77
View File
@@ -36,7 +36,7 @@
<p align="center"> <p align="center">
<a href="https://scrapling.readthedocs.io/en/latest/parsing/selection/"><strong>选择方法</strong></a> <a href="https://scrapling.readthedocs.io/en/latest/parsing/selection/"><strong>选择方法</strong></a>
&middot; &middot;
<a href="https://scrapling.readthedocs.io/en/latest/fetching/choosing/"><strong>选择Fetcher</strong></a> <a href="https://scrapling.readthedocs.io/en/latest/fetching/choosing/"><strong>选择 Fetcher</strong></a>
&middot; &middot;
<a href="https://scrapling.readthedocs.io/en/latest/spiders/architecture.html"><strong>爬虫</strong></a> <a href="https://scrapling.readthedocs.io/en/latest/spiders/architecture.html"><strong>爬虫</strong></a>
&middot; &middot;
@@ -44,14 +44,14 @@
&middot; &middot;
<a href="https://scrapling.readthedocs.io/en/latest/cli/overview/"><strong>CLI</strong></a> <a href="https://scrapling.readthedocs.io/en/latest/cli/overview/"><strong>CLI</strong></a>
&middot; &middot;
<a href="https://scrapling.readthedocs.io/en/latest/ai/mcp-server/"><strong>MCP模式</strong></a> <a href="https://scrapling.readthedocs.io/en/latest/ai/mcp-server/"><strong>MCP 模式</strong></a>
</p> </p>
Scrapling是一个自适应Web Scraping框架,能处理从单个请求到大规模爬取的一切需求。 Scrapling 是一个自适应 Web Scraping 框架,能处理从单个请求到大规模爬取的一切需求。
它的解析器能够从网站变化中学习,并在页面更新时自动重新定位您的元素。它的Fetcher能够开箱即用地绕过Cloudflare Turnstile等反机器人系统。它的Spider框架让您可以扩展到并发、多Session爬取,支持暂停/恢复和自动Proxy轮换——只需几行Python代码。一个库,零妥协。 它的解析器能够从网站变化中学习,并在页面更新时自动重新定位您的元素。它的 Fetcher 能够开箱即用地绕过 Cloudflare Turnstile 等反机器人系统。它的 Spider 框架让您可以扩展到并发、多 Session 爬取,支持暂停/恢复和自动 Proxy 轮换——只需几行 Python 代码。一个库,零妥协。
极速爬取,实时统计和Streaming。由Web ScraperWeb Scraper和普通用户而构建,每个人都能找到适合自己的功能。 极速爬取,实时统计和 Streaming。由 Web ScraperWeb Scraper 和普通用户而构建,每个人都能找到适合自己的功能。
```python ```python
from scrapling.fetchers import Fetcher, AsyncFetcher, StealthyFetcher, DynamicFetcher from scrapling.fetchers import Fetcher, AsyncFetcher, StealthyFetcher, DynamicFetcher
@@ -156,12 +156,12 @@ MySpider().start()
</a> </a>
</td> </td>
<td> <td>
阅读 <a href="https://substack.thewebscraping.club/p/scrapling-hands-on-guide?utm_source=github&utm_medium=repo&utm_campaign=scrapling" target="_blank">The Web Scraping Club 上关于 Scrapling 的完整评测</a>202511月),这是排名第一的网页抓取专业通讯。 阅读 <a href="https://substack.thewebscraping.club/p/scrapling-hands-on-guide?utm_source=github&utm_medium=repo&utm_campaign=scrapling" target="_blank">The Web Scraping Club 上关于 Scrapling 的完整评测</a>202511 月),这是排名第一的网页抓取专业通讯。
</td> </td>
</tr> </tr>
</table> </table>
<i><sub>想在这里展示您的广告吗?点击[这里](https://github.com/sponsors/D4Vinci/sponsorships?tier_id=586646)</sub></i> <i><sub>想在这里展示您的广告吗?点击 [这里](https://github.com/sponsors/D4Vinci/sponsorships?tier_id=586646)</sub></i>
# 赞助商 # 赞助商
<!-- sponsors --> <!-- sponsors -->
@@ -175,62 +175,62 @@ MySpider().start()
<!-- /sponsors --> <!-- /sponsors -->
<i><sub>想在这里展示您的广告吗?点击[这里](https://github.com/sponsors/D4Vinci)并选择适合您的级别!</sub></i> <i><sub>想在这里展示您的广告吗?点击 [这里](https://github.com/sponsors/D4Vinci) 并选择适合您的级别!</sub></i>
--- ---
## 主要特性 ## 主要特性
### Spider — 完整的爬取框架 ### Spider — 完整的爬取框架
- 🕷️ **类ScrapySpider API**:使用`start_urls`、async `parse` callback和`Request`/`Response`对象定义Spider。 - 🕷️ **类 ScrapySpider API**:使用 `start_urls`、async `parse` callback `Request`/`Response` 对象定义 Spider。
-**并发爬取**:可配置的并发限制、按域名节流和下载延迟。 -**并发爬取**:可配置的并发限制、按域名节流和下载延迟。
- 🔄 **多Session支持**:统一接口,支持HTTP请求和隐秘无头浏览器在同一个Spider中使用——通过ID将请求路由到不同的Session。 - 🔄 **多 Session 支持**:统一接口,支持 HTTP 请求和隐秘无头浏览器在同一个 Spider 中使用——通过 ID 将请求路由到不同的 Session。
- 💾 **暂停与恢复**:基于Checkpoint的爬取持久化。按Ctrl+C优雅关闭;重启后从上次停止的地方继续。 - 💾 **暂停与恢复**:基于 Checkpoint 的爬取持久化。按 Ctrl+C 优雅关闭;重启后从上次停止的地方继续。
- 📡 **Streaming模式**:通过`async for item in spider.stream()`以实时统计Streaming抓取的数据——非常适合UI、管道和长时间运行的爬取。 - 📡 **Streaming 模式**:通过 `async for item in spider.stream()` 以实时统计 Streaming 抓取的数据——非常适合 UI、管道和长时间运行的爬取。
- 🛡️ **被阻止请求检测**:自动检测并重试被阻止的请求,支持自定义逻辑。 - 🛡️ **被阻止请求检测**:自动检测并重试被阻止的请求,支持自定义逻辑。
- 📦 **内置导出**:通过钩子和您自己的管道导出结果,或使用内置的JSON/JSONL,分别通过`result.items.to_json()`/`result.items.to_jsonl()` - 📦 **内置导出**:通过钩子和您自己的管道导出结果,或使用内置的 JSON/JSONL,分别通过 `result.items.to_json()`/`result.items.to_jsonl()`
### 支持Session的高级网站获取 ### 支持 Session 的高级网站获取
- **HTTP请求**:使用`Fetcher`类进行快速和隐秘的HTTP请求。可以模拟浏览器的TLS fingerprint、标头并使用HTTP/3。 - **HTTP 请求**:使用 `Fetcher` 类进行快速和隐秘的 HTTP 请求。可以模拟浏览器的 TLS fingerprint、标头并使用 HTTP/3。
- **动态加载**:通过`DynamicFetcher`类使用完整的浏览器自动化获取动态网站,支持PlaywrightChromiumGoogle Chrome。 - **动态加载**:通过 `DynamicFetcher` 类使用完整的浏览器自动化获取动态网站,支持 PlaywrightChromiumGoogle Chrome。
- **反机器人绕过**:使用`StealthyFetcher`的高级隐秘功能和fingerprint伪装。可以轻松自动绕过所有类型的Cloudflare Turnstile/Interstitial。 - **反机器人绕过**:使用 `StealthyFetcher` 的高级隐秘功能和 fingerprint 伪装。可以轻松自动绕过所有类型的 Cloudflare Turnstile/Interstitial。
- **Session管理**:使用`FetcherSession``StealthySession``DynamicSession`类实现持久化Session支持,用于跨请求的cookie和状态管理。 - **Session 管理**:使用 `FetcherSession``StealthySession``DynamicSession` 类实现持久化 Session 支持,用于跨请求的 cookie 和状态管理。
- **Proxy轮换**:内置`ProxyRotator`,支持轮询或自定义策略,适用于所有Session类型,并支持按请求覆盖Proxy。 - **Proxy 轮换**:内置 `ProxyRotator`,支持轮询或自定义策略,适用于所有 Session 类型,并支持按请求覆盖 Proxy。
- **域名屏蔽**:在基于浏览器的Fetcher中屏蔽对特定域名(及其子域名)的请求。 - **域名屏蔽**:在基于浏览器的 Fetcher 中屏蔽对特定域名(及其子域名)的请求。
- **Async支持**:所有Fetcher和专用async Session类的完整async支持。 - **Async 支持**:所有 Fetcher 和专用 async Session 类的完整 async 支持。
### 自适应抓取和AI集成 ### 自适应抓取和 AI 集成
- 🔄 **智能元素跟踪**:使用智能相似性算法在网站更改后重新定位元素。 - 🔄 **智能元素跟踪**:使用智能相似性算法在网站更改后重新定位元素。
- 🎯 **智能灵活选择**:CSS选择器、XPath选择器、基于过滤器的搜索、文本搜索、正则表达式搜索等。 - 🎯 **智能灵活选择**CSS 选择器、XPath 选择器、基于过滤器的搜索、文本搜索、正则表达式搜索等。
- 🔍 **查找相似元素**:自动定位与已找到元素相似的元素。 - 🔍 **查找相似元素**:自动定位与已找到元素相似的元素。
- 🤖 **与AI一起使用的MCP服务器**:内置MCP服务器用于AI辅助Web Scraping和数据提取。MCP服务器具有强大的自定义功能,利用Scrapling在将内容传递给AIClaude/Cursor等)之前提取目标内容,从而加快操作并通过最小化token使用来降低成本。([演示视频](https://www.youtube.com/watch?v=qyFk3ZNwOxE) - 🤖 **与 AI 一起使用的 MCP 服务器**:内置 MCP 服务器用于 AI 辅助 Web Scraping 和数据提取。MCP 服务器具有强大的自定义功能,利用 Scrapling 在将内容传递给 AIClaude/Cursor 等)之前提取目标内容,从而加快操作并通过最小化 token 使用来降低成本。([演示视频](https://www.youtube.com/watch?v=qyFk3ZNwOxE)
### 高性能和经过实战测试的架构 ### 高性能和经过实战测试的架构
- 🚀 **闪电般快速**:优化性能超越大多数Python抓取库。 - 🚀 **闪电般快速**:优化性能超越大多数 Python 抓取库。
- 🔋 **内存高效**:优化的数据结构和延迟加载,最小内存占用。 - 🔋 **内存高效**:优化的数据结构和延迟加载,最小内存占用。
-**快速JSON序列化**:比标准库快10倍。 -**快速 JSON 序列化**:比标准库快 10 倍。
- 🏗️ **经过实战测试**Scrapling不仅拥有92%的测试覆盖率和完整的类型提示覆盖率,而且在过去一年中每天被数百名Web Scraper使用。 - 🏗️ **经过实战测试**Scrapling 不仅拥有 92% 的测试覆盖率和完整的类型提示覆盖率,而且在过去一年中每天被数百名 Web Scraper 使用。
### 对开发者/Web Scraper友好的体验 ### 对开发者/Web Scraper 友好的体验
- 🎯 **交互式Web Scraping Shell**:可选的内置IPython Shell,具有Scrapling集成、快捷方式和新工具,可加快Web Scraping脚本开发,例如将curl请求转换为Scrapling请求并在浏览器中查看请求结果。 - 🎯 **交互式 Web Scraping Shell**:可选的内置 IPython Shell,具有 Scrapling 集成、快捷方式和新工具,可加快 Web Scraping 脚本开发,例如将 curl 请求转换为 Scrapling 请求并在浏览器中查看请求结果。
- 🚀 **直接从终端使用**:可选地,您可以使用Scrapling抓取URL而无需编写任何代码! - 🚀 **直接从终端使用**:可选地,您可以使用 Scrapling 抓取 URL 而无需编写任何代码!
- 🛠️ **丰富的导航API**:使用父级、兄弟级和子级导航方法进行高级DOM遍历。 - 🛠️ **丰富的导航 API**:使用父级、兄弟级和子级导航方法进行高级 DOM 遍历。
- 🧬 **增强的文本处理**:内置正则表达式、清理方法和优化的字符串操作。 - 🧬 **增强的文本处理**:内置正则表达式、清理方法和优化的字符串操作。
- 📝 **自动选择器生成**:为任何元素生成强大的CSS/XPath选择器。 - 📝 **自动选择器生成**:为任何元素生成强大的 CSS/XPath 选择器。
- 🔌 **熟悉的API**:类似于Scrapy/BeautifulSoup,使用与Scrapy/Parsel相同的伪元素。 - 🔌 **熟悉的 API**:类似于 Scrapy/BeautifulSoup,使用与 Scrapy/Parsel 相同的伪元素。
- 📘 **完整的类型覆盖**:完整的类型提示,出色的IDE支持和代码补全。整个代码库在每次更改时都会自动使用**PyRight**和**MyPy**扫描。 - 📘 **完整的类型覆盖**:完整的类型提示,出色的 IDE 支持和代码补全。整个代码库在每次更改时都会自动使用**PyRight**和**MyPy**扫描。
- 🔋 **现成的Docker镜像**:每次发布时,包含所有浏览器的Docker镜像会自动构建和推送。 - 🔋 **现成的 Docker 镜像**:每次发布时,包含所有浏览器的 Docker 镜像会自动构建和推送。
## 入门 ## 入门
让我们快速展示Scrapling的功能,无需深入了解。 让我们快速展示 Scrapling 的功能,无需深入了解。
### 基本用法 ### 基本用法
支持SessionHTTP请求 支持 SessionHTTP 请求
```python ```python
from scrapling.fetchers import Fetcher, FetcherSession from scrapling.fetchers import Fetcher, FetcherSession
with FetcherSession(impersonate='chrome') as session: # 使用Chrome的最新版本TLS fingerprint with FetcherSession(impersonate='chrome') as session: # 使用 Chrome 的最新版本 TLS fingerprint
page = session.get('https://quotes.toscrape.com/', stealthy_headers=True) page = session.get('https://quotes.toscrape.com/', stealthy_headers=True)
quotes = page.css('.quote .text::text').getall() quotes = page.css('.quote .text::text').getall()
@@ -256,7 +256,7 @@ from scrapling.fetchers import DynamicFetcher, DynamicSession
with DynamicSession(headless=True, disable_resources=False, network_idle=True) as session: # 保持浏览器打开直到完成 with DynamicSession(headless=True, disable_resources=False, network_idle=True) as session: # 保持浏览器打开直到完成
page = session.fetch('https://quotes.toscrape.com/', load_dom=False) page = session.fetch('https://quotes.toscrape.com/', load_dom=False)
data = page.xpath('//span[@class="text"]/text()').getall() # 如果您偏好XPath选择器 data = page.xpath('//span[@class="text"]/text()').getall() # 如果您偏好 XPath 选择器
# 或使用一次性请求样式,为此请求打开浏览器,完成后关闭 # 或使用一次性请求样式,为此请求打开浏览器,完成后关闭
page = DynamicFetcher.fetch('https://quotes.toscrape.com/') page = DynamicFetcher.fetch('https://quotes.toscrape.com/')
@@ -264,7 +264,7 @@ data = page.css('.quote .text::text').getall()
``` ```
### Spider ### Spider
构建具有并发请求、多种Session类型和暂停/恢复功能的完整爬虫: 构建具有并发请求、多种 Session 类型和暂停/恢复功能的完整爬虫:
```python ```python
from scrapling.spiders import Spider, Request, Response from scrapling.spiders import Spider, Request, Response
@@ -288,7 +288,7 @@ result = QuotesSpider().start()
print(f"抓取了 {len(result.items)} 条引用") print(f"抓取了 {len(result.items)} 条引用")
result.items.to_json("quotes.json") result.items.to_json("quotes.json")
``` ```
在单个Spider中使用多种Session类型: 在单个 Spider 中使用多种 Session 类型:
```python ```python
from scrapling.spiders import Spider, Request, Response from scrapling.spiders import Spider, Request, Response
from scrapling.fetchers import FetcherSession, AsyncStealthySession from scrapling.fetchers import FetcherSession, AsyncStealthySession
@@ -303,17 +303,17 @@ class MultiSessionSpider(Spider):
async def parse(self, response: Response): async def parse(self, response: Response):
for link in response.css('a::attr(href)').getall(): for link in response.css('a::attr(href)').getall():
# 将受保护的页面路由到隐秘Session # 将受保护的页面路由到隐秘 Session
if "protected" in link: if "protected" in link:
yield Request(link, sid="stealth") yield Request(link, sid="stealth")
else: else:
yield Request(link, sid="fast", callback=self.parse) # 显式callback yield Request(link, sid="fast", callback=self.parse) # 显式 callback
``` ```
通过如下方式运行Spider来暂停和恢复长时间爬取,使用Checkpoint: 通过如下方式运行 Spider 来暂停和恢复长时间爬取,使用 Checkpoint
```python ```python
QuotesSpider(crawldir="./crawl_data").start() QuotesSpider(crawldir="./crawl_data").start()
``` ```
按Ctrl+C优雅暂停——进度会自动保存。之后,当您再次启动Spider时,传递相同的`crawldir`,它将从上次停止的地方继续。 Ctrl+C 优雅暂停——进度会自动保存。之后,当您再次启动 Spider 时,传递相同的 `crawldir`,它将从上次停止的地方继续。
### 高级解析与导航 ### 高级解析与导航
```python ```python
@@ -323,9 +323,9 @@ from scrapling.fetchers import Fetcher
page = Fetcher.get('https://quotes.toscrape.com/') page = Fetcher.get('https://quotes.toscrape.com/')
# 使用多种选择方法获取引用 # 使用多种选择方法获取引用
quotes = page.css('.quote') # CSS选择器 quotes = page.css('.quote') # CSS 选择器
quotes = page.xpath('//div[@class="quote"]') # XPath quotes = page.xpath('//div[@class="quote"]') # XPath
quotes = page.find_all('div', {'class': 'quote'}) # BeautifulSoup风格 quotes = page.find_all('div', {'class': 'quote'}) # BeautifulSoup 风格
# 等同于 # 等同于
quotes = page.find_all('div', class_='quote') quotes = page.find_all('div', class_='quote')
quotes = page.find_all(['div'], class_='quote') quotes = page.find_all(['div'], class_='quote')
@@ -352,16 +352,16 @@ page = Selector("<html>...</html>")
``` ```
用法完全相同! 用法完全相同!
### Async Session管理示例 ### Async Session 管理示例
```python ```python
import asyncio import asyncio
from scrapling.fetchers import FetcherSession, AsyncStealthySession, AsyncDynamicSession from scrapling.fetchers import FetcherSession, AsyncStealthySession, AsyncDynamicSession
async with FetcherSession(http3=True) as session: # `FetcherSession`是上下文感知的,可以在sync/async模式下工作 async with FetcherSession(http3=True) as session: # `FetcherSession`是上下文感知的,可以在 sync/async 模式下工作
page1 = session.get('https://quotes.toscrape.com/') page1 = session.get('https://quotes.toscrape.com/')
page2 = session.get('https://quotes.toscrape.com/', impersonate='firefox135') page2 = session.get('https://quotes.toscrape.com/', impersonate='firefox135')
# Async Session用法 # Async Session 用法
async with AsyncStealthySession(max_pages=2) as session: async with AsyncStealthySession(max_pages=2) as session:
tasks = [] tasks = []
urls = ['https://example.com/page1', 'https://example.com/page2'] urls = ['https://example.com/page1', 'https://example.com/page2']
@@ -375,34 +375,34 @@ async with AsyncStealthySession(max_pages=2) as session:
print(session.get_pool_stats()) print(session.get_pool_stats())
``` ```
## CLI和交互式Shell ## CLI 和交互式 Shell
Scrapling包含强大的命令行界面: Scrapling 包含强大的命令行界面:
[![asciicast](https://asciinema.org/a/736339.svg)](https://asciinema.org/a/736339) [![asciicast](https://asciinema.org/a/736339.svg)](https://asciinema.org/a/736339)
启动交互式Web Scraping Shell 启动交互式 Web Scraping Shell
```bash ```bash
scrapling shell scrapling shell
``` ```
直接将页面提取到文件而无需编程(默认提取`body`标签内的内容)。如果输出文件以`.txt`结尾,则将提取目标的文本内容。如果以`.md`结尾,它将是HTML内容的Markdown表示;如果以`.html`结尾,它将是HTML内容本身。 直接将页面提取到文件而无需编程(默认提取 `body` 标签内的内容)。如果输出文件以`.txt` 结尾,则将提取目标的文本内容。如果以`.md` 结尾,它将是 HTML 内容的 Markdown 表示;如果以`.html` 结尾,它将是 HTML 内容本身。
```bash ```bash
scrapling extract get 'https://example.com' content.md scrapling extract get 'https://example.com' content.md
scrapling extract get 'https://example.com' content.txt --css-selector '#fromSkipToProducts' --impersonate 'chrome' # 所有匹配CSS选择器'#fromSkipToProducts'的元素 scrapling extract get 'https://example.com' content.txt --css-selector '#fromSkipToProducts' --impersonate 'chrome' # 所有匹配 CSS 选择器'#fromSkipToProducts' 的元素
scrapling extract fetch 'https://example.com' content.md --css-selector '#fromSkipToProducts' --no-headless scrapling extract fetch 'https://example.com' content.md --css-selector '#fromSkipToProducts' --no-headless
scrapling extract stealthy-fetch 'https://nopecha.com/demo/cloudflare' captchas.html --css-selector '#padded_content a' --solve-cloudflare scrapling extract stealthy-fetch 'https://nopecha.com/demo/cloudflare' captchas.html --css-selector '#padded_content a' --solve-cloudflare
``` ```
> [!NOTE] > [!NOTE]
> 还有许多其他功能,但我们希望保持此页面简洁,包括MCP服务器和交互式Web Scraping Shell。查看完整文档[这里](https://scrapling.readthedocs.io/en/latest/) > 还有许多其他功能,但我们希望保持此页面简洁,包括 MCP 服务器和交互式 Web Scraping Shell。查看完整文档 [这里](https://scrapling.readthedocs.io/en/latest/)
## 性能基准 ## 性能基准
Scrapling不仅功能强大——它还速度极快。以下基准测试将Scrapling的解析器与其他流行库的最新版本进行了比较。 Scrapling 不仅功能强大——它还速度极快。以下基准测试将 Scrapling 的解析器与其他流行库的最新版本进行了比较。
### 文本提取速度测试(5000个嵌套元素) ### 文本提取速度测试(5000 个嵌套元素)
| # | 库 | 时间(ms) | vs Scrapling | | # | 库 | 时间 (ms) | vs Scrapling |
|---|:-----------------:|:---------:|:------------:| |---|:-----------------:|:---------:|:------------:|
| 1 | Scrapling | 2.02 | 1.0x | | 1 | Scrapling | 2.02 | 1.0x |
| 2 | Parsel/Scrapy | 2.04 | 1.01 | | 2 | Parsel/Scrapy | 2.04 | 1.01 |
@@ -416,29 +416,29 @@ Scrapling不仅功能强大——它还速度极快。以下基准测试将Scrap
### 元素相似性和文本搜索性能 ### 元素相似性和文本搜索性能
Scrapling的自适应元素查找功能明显优于替代方案: Scrapling 的自适应元素查找功能明显优于替代方案:
| 库 | 时间(ms) | vs Scrapling | | 库 | 时间 (ms) | vs Scrapling |
|-------------|:---------:|:------------:| |-------------|:---------:|:------------:|
| Scrapling | 2.39 | 1.0x | | Scrapling | 2.39 | 1.0x |
| AutoScraper | 12.45 | 5.209x | | AutoScraper | 12.45 | 5.209x |
> 所有基准测试代表100+次运行的平均值。请参阅[benchmarks.py](https://github.com/D4Vinci/Scrapling/blob/main/benchmarks.py)了解方法。 > 所有基准测试代表 100+ 次运行的平均值。请参阅 [benchmarks.py](https://github.com/D4Vinci/Scrapling/blob/main/benchmarks.py) 了解方法。
## 安装 ## 安装
Scrapling需要Python 3.10或更高版本: Scrapling 需要 Python 3.10 或更高版本:
```bash ```bash
pip install scrapling pip install scrapling
``` ```
此安装仅包括解析器引擎及其依赖项,没有任何Fetcher或命令行依赖项。 此安装仅包括解析器引擎及其依赖项,没有任何 Fetcher 或命令行依赖项。
### 可选依赖项 ### 可选依赖项
1. 如果您要使用以下任何额外功能、Fetcher或它们的类,您将需要安装Fetcher的依赖项和它们的浏览器依赖项,如下所示: 1. 如果您要使用以下任何额外功能、Fetcher 或它们的类,您将需要安装 Fetcher 的依赖项和它们的浏览器依赖项,如下所示:
```bash ```bash
pip install "scrapling[fetchers]" pip install "scrapling[fetchers]"
@@ -446,7 +446,7 @@ pip install scrapling
scrapling install --force # force reinstall scrapling install --force # force reinstall
``` ```
这会下载所有浏览器,以及它们的系统依赖项和fingerprint操作依赖项。 这会下载所有浏览器,以及它们的系统依赖项和 fingerprint 操作依赖项。
或者你可以从代码中安装,而不是运行命令: 或者你可以从代码中安装,而不是运行命令:
```python ```python
@@ -457,11 +457,11 @@ pip install scrapling
``` ```
2. 额外功能: 2. 额外功能:
- 安装MCP服务器功能: - 安装 MCP 服务器功能:
```bash ```bash
pip install "scrapling[ai]" pip install "scrapling[ai]"
``` ```
- 安装Shell功能(Web Scraping Shell`extract`命令): - 安装 Shell 功能(Web Scraping Shell`extract` 命令):
```bash ```bash
pip install "scrapling[shell]" pip install "scrapling[shell]"
``` ```
@@ -469,27 +469,27 @@ pip install scrapling
```bash ```bash
pip install "scrapling[all]" pip install "scrapling[all]"
``` ```
请记住,在安装任何这些额外功能后(如果您还没有安装),您需要使用`scrapling install`安装浏览器依赖项 请记住,在安装任何这些额外功能后(如果您还没有安装),您需要使用 `scrapling install` 安装浏览器依赖项
### Docker ### Docker
您还可以使用以下命令从DockerHub安装包含所有额外功能和浏览器的Docker镜像: 您还可以使用以下命令从 DockerHub 安装包含所有额外功能和浏览器的 Docker 镜像:
```bash ```bash
docker pull pyd4vinci/scrapling docker pull pyd4vinci/scrapling
``` ```
或从GitHub注册表下载: 或从 GitHub 注册表下载:
```bash ```bash
docker pull ghcr.io/d4vinci/scrapling:latest docker pull ghcr.io/d4vinci/scrapling:latest
``` ```
此镜像使用GitHub Actions和仓库主分支自动构建和推送。 此镜像使用 GitHub Actions 和仓库主分支自动构建和推送。
## 贡献 ## 贡献
我们欢迎贡献!在开始之前,请阅读我们的[贡献指南](https://github.com/D4Vinci/Scrapling/blob/main/CONTRIBUTING.md)。 我们欢迎贡献!在开始之前,请阅读我们的 [贡献指南](https://github.com/D4Vinci/Scrapling/blob/main/CONTRIBUTING.md)。
## 免责声明 ## 免责声明
> [!CAUTION] > [!CAUTION]
> 此库仅用于教育和研究目的。使用此库即表示您同意遵守本地和国际数据抓取和隐私法律。作者和贡献者对本软件的任何滥用不承担责任。始终尊重网站的服务条款和robots.txt文件。 > 此库仅用于教育和研究目的。使用此库即表示您同意遵守本地和国际数据抓取和隐私法律。作者和贡献者对本软件的任何滥用不承担责任。始终尊重网站的服务条款和 robots.txt 文件。
## 🎓 引用 ## 🎓 引用
如果您将我们的库用于研究目的,请使用以下参考文献引用我们: 如果您将我们的库用于研究目的,请使用以下参考文献引用我们:
@@ -505,12 +505,12 @@ docker pull ghcr.io/d4vinci/scrapling:latest
## 许可证 ## 许可证
本作品根据BSD-3-Clause许可证授权。 本作品根据 BSD-3-Clause 许可证授权。
## 致谢 ## 致谢
此项目包含改编自以下内容的代码: 此项目包含改编自以下内容的代码:
- ParselBSD许可证)——用于[translator](https://github.com/D4Vinci/Scrapling/blob/main/scrapling/core/translator.py)子模块 - ParselBSD 许可证)——用于 [translator](https://github.com/D4Vinci/Scrapling/blob/main/scrapling/core/translator.py)子模块
--- ---
<div align="center"><small>由Karim Shoair用❤️设计和制作。</small></div><br> <div align="center"><small>由 Karim Shoair 用❤️设计和制作。</small></div><br>