首页
/ Scrapling 框架实战指南:从单请求抓取到大规模 Spider 爬取的完整技术方案

Scrapling 框架实战指南:从单请求抓取到大规模 Spider 爬取的完整技术方案

2026-09-04 21:39:48作者:霍妲思

本文以 Scrapling 中文 README(docs/README_CN.md)为主体骨架,逐层展开这个自适应 Web Scraping 框架的三层能力:Fetcher 请求层、自适应解析层和 Spider 爬取框架层。读完后,您将掌握如何选择合适的 Fetcher 绕过反机器人系统、如何用自适应选择器在页面改版后自动重定位元素、如何用几行 Python 代码构建带并发/暂停恢复/多 Session 的爬虫,以及 CLI、Docker 与 MCP 等配套工具的正确安装与用法。

一、项目定位:一个库覆盖从单请求到全量爬取

Scrapling 是一个自适应 Web Scraping 框架,官方定位是"能处理从单个请求到大规模爬取的一切需求"(pyproject.toml 中当前版本为 0.4.13,要求 Python 3.10+)。它的核心卖点由三块互相衔接的模块组成:

  • 解析器:能够从网站变化中学习,并在页面更新时自动重新定位您的元素(auto_save/adaptive 机制);
  • Fetcher:开箱即用地绕过 Cloudflare Turnstile 等反机器人系统;
  • Spider 框架:可扩展到并发、多 Session 爬取,支持暂停/恢复和自动 Proxy 轮换——只需几行 Python 代码。

官方给出的一句话式用法如下(直接来自 docs/README_CN.md):

from scrapling.fetchers import Fetcher, AsyncFetcher, StealthyFetcher, DynamicFetcher
StealthyFetcher.adaptive = True
p = StealthyFetcher.fetch('https://example.com', headless=True, network_idle=True)  # 隐秘地获取网站!
products = p.css('.product', auto_save=True)      # 抓取在网站设计变更后仍能存活的数据!
products = p.css('.product', adaptive=True)       # 之后,如果网站结构改变,传递 `adaptive=True` 来找到它们!

"或扩展为完整爬取":

from scrapling.spiders import Spider, Response

class MySpider(Spider):
  name = "demo"
  start_urls = ["https://example.com/"]

  async def parse(self, response: Response):
      for item in response.css('.product'):
          yield {"title": item.css('h2::text').get()}

MySpider().start()

从源码结构看,这个"三层能力"对应清晰的包划分:scrapling/fetchers/ 封装三种请求后端,scrapling/parser.py 提供 Selector 解析器,scrapling/spiders/ 提供完整的爬取引擎。scrapling/spiders/init.py 中导出的公共 API 包括 SpiderRequestCrawlResultSessionManagerCrawlerEngineLinkExtractor 及全部现成模板(CrawlSpiderSitemapSpiderShopifySpiderXMLFeedSpiderCSVFeedSpider)。

更多文档入口可参见仓库内文档目录:选择方法选择 FetcherSpider 架构代理轮换CLI 概览MCP 服务器

二、安装:基础版与可选依赖的正确组合

Scrapling 需要 Python 3.10 或更高版本

pip install scrapling

重要:此安装仅包括解析器引擎及其依赖项,没有任何 Fetcher 或命令行依赖项。因此仅用此安装时,从 scrapling.fetchersscrapling.spiders 导入任何内容都会引发 ModuleNotFoundError。如果要使用任何 Fetcher 或 Spider,请先安装 Fetcher 的依赖项。

2.1 可选依赖项

  1. 要使用任何 Fetcher(或它们的类),需要安装 Fetcher 依赖及其浏览器依赖:

    pip install "scrapling[fetchers]"
    
    scrapling install           # normal install
    scrapling install  --force   # force reinstall
    

    这会下载所有浏览器,以及它们的系统依赖项和 fingerprint 操作依赖项。也可以从代码中安装,而不运行命令:

    from scrapling.cli import install
    
    install([], standalone_mode=False)           # normal install
    install(["--force"], standalone_mode=False) # force reinstall
    

    从源码看,scrapling/cli.pyinstall 命令实际执行 python -m playwright install chromiuminstall-deps chromium,更新 tld 名称库后,在包目录写入 .scrapling_dependencies_installed 标记文件——所以非 --force 模式第二次运行会直接打印 "The dependencies are already installed"。

  2. 额外功能 extras(与 pyproject.toml 中的 optional-dependencies 定义一致):

    pip install "scrapling[ai]"      # MCP 服务器功能(依赖 mcp、markdownify 及 fetchers)
    pip install "scrapling[shell]"  # Web Scraping Shell 和 extract 命令(依赖 IPython 等)
    pip install "scrapling[all]"    # 安装所有内容(即 ai + shell)
    

    请记住,在安装任何这些额外功能后(如果您还没有安装),需要再用 scrapling install 安装浏览器依赖项。

2.2 Docker

也可以直接使用包含所有额外功能和浏览器的 Docker 镜像:

docker pull pyd4vinci/scrapling

或从 GitHub 注册表下载:

docker pull ghcr.io/d4vinci/scrapling:latest

该镜像由 GitHub Actions 基于仓库主分支自动构建和推送,仓库根目录的 Dockerfile 定义了其构建方式。

三、Fetcher:三种请求后端与 Session 管理

从源码看,scrapling/fetchers/init.py 采用懒加载导入映射Fetcher/AsyncFetcher/FetcherSession 来自 scrapling.fetchers.requestsDynamicFetcher/DynamicSession/AsyncDynamicSession 来自 scrapling.fetchers.chromeStealthyFetcher/StealthySession/AsyncStealthySession 来自 scrapling.fetchers.stealth_chrome。这意味着导入 scrapling.fetchers 本身不加载 Playwright 等重依赖,只有真正访问某个类时才触发对应模块——这也解释了为什么基础安装下使用 Fetcher 会报 ModuleNotFoundError

3.1 支持 Session 的 HTTP 请求

基于 curl_cffi 的快速 HTTP 请求(scrapling/fetchers/requests.pyFetcher 的 docstring 明确其"based on curl_cffi",仅支持 GET/POST/PUT/DELETE)。可以模拟浏览器的 TLS fingerprint、标头并使用 HTTP/3:

from scrapling.fetchers import Fetcher, FetcherSession

with FetcherSession(impersonate='chrome') as session:  # 使用 Chrome 的最新版本 TLS fingerprint
    page = session.get('https://quotes.toscrape.com/', stealthy_headers=True)
    quotes = page.css('.quote .text::text').getall()

# 或使用一次性请求
page = Fetcher.get('https://quotes.toscrape.com/')
quotes = page.css('.quote .text::text').getall()

3.2 高级隐秘模式

使用 StealthyFetcher 的高级隐秘功能和 fingerprint 伪装,可以轻松自动绕过所有类型的 Cloudflare Turnstile/Interstitial:

from scrapling.fetchers import StealthyFetcher, StealthySession

with StealthySession(headless=True, solve_cloudflare=True) as session:  # 保持浏览器打开直到完成
    page = session.fetch('https://nopecha.com/demo/cloudflare', google_search=False)
    data = page.css('#padded_content a').getall()

# 或使用一次性请求样式,为此请求打开浏览器,完成后关闭
page = StealthyFetcher.fetch('https://nopecha.com/demo/cloudflare')
data = page.css('#padded_content a').getall()

3.3 完整的浏览器自动化

通过 DynamicFetcher 使用完整的浏览器自动化获取动态网站,支持 Playwright 的 Chromium 和 Google Chrome:

from scrapling.fetchers import DynamicFetcher, DynamicSession

with DynamicSession(headless=True, disable_resources=False, network_idle=True) as session:  # 保持浏览器打开直到完成
    page = session.fetch('https://quotes.toscrape.com/', load_dom=False)
    data = page.xpath('//span[@class="text"]/text()').getall()  # 如果您偏好 XPath 选择器

# 或使用一次性请求样式,为此请求打开浏览器,完成后关闭
page = DynamicFetcher.fetch('https://quotes.toscrape.com/')
data = page.css('.quote .text::text').getall()

3.4 Async Session 管理

所有 Fetcher 和专用 async Session 类都有完整 async 支持。FetcherSession 是上下文感知的,可以在 sync/async 模式下工作:

import asyncio
from scrapling.fetchers import FetcherSession, AsyncStealthySession, AsyncDynamicSession

async with FetcherSession(http3=True) as session:
    page1 = session.get('https://quotes.toscrape.com/')
    page2 = session.get('https://quotes.toscrape.com/', impersonate='firefox135')

# Async Session 用法
async with AsyncStealthySession(max_pages=2) as session:
    tasks = []
    urls = ['https://example.com/page1', 'https://example.com/page2']

    for url in urls:
        task = session.fetch(url)
        tasks.append(task)

    print(session.get_pool_stats())  # 可选 - 浏览器标签池的状态(忙/空闲/错误)
    results = await asyncio.gather(*tasks)
    print(session.get_pool_stats())

3.5 Fetcher 层的其余能力

官方特性清单中与 Fetcher 相关、但上面代码示例未直接体现的能力,均对应到具体源码模块:

  • Proxy 轮换:内置 ProxyRotator,支持轮询或自定义策略,适用于所有 Session 类型,并支持按请求覆盖 Proxy(实现位于 scrapling/engines/toolbelt/proxy_rotation.py,并在 scrapling/fetchers/init.py 中直接导出);
  • 域名和广告屏蔽:在基于浏览器的 Fetcher 中屏蔽对特定域名(及其子域名)的请求,或启用内置广告屏蔽(约 3,500 个已知广告/追踪域名,列表见 scrapling/engines/toolbelt/ad_domains.py);
  • DNS 泄漏防护:可选的 DNS-over-HTTPS 支持,通过 Cloudflare 的 DoH 路由 DNS 查询,防止使用代理时的 DNS 泄漏;
  • 远程浏览器:无需在本地启动浏览器,通过 cdp_url 用 CDP 连接到已在运行的浏览器(同一台机器、另一台主机或托管的浏览器服务商);也可以通过 executable_path 让任意浏览器 Fetcher 使用您自己的 Chromium 构建版本;
  • 后台 API 捕获:向 capture_xhr 传入 URL 模式,页面加载过程中所有匹配的 XHR/fetch 响应都会作为 Response 对象收集到 response.captured_xhr 中——无需自己逆向分析请求即可获取网站的 API 数据。

四、自适应解析:让选择器在页面改版后"存活"

解析器核心是 scrapling/parser.py 中的 Selector 类(继承自 SelectorsGeneration),它与 Scrapy/Parsel 使用相同的伪元素,API 风格类似 Scrapy/BeautifulSoup。丰富的选择与导航示例(直接继承自 README):

from scrapling.fetchers import Fetcher

# 丰富的元素选择和导航
page = Fetcher.get('https://quotes.toscrape.com/')

# 使用多种选择方法获取引用
quotes = page.css('.quote')                                # CSS 选择器
quotes = page.xpath('//div[@class="quote"]')              # XPath
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(class_='quote')  # 等等...
# 按文本内容查找元素
quotes = page.find_by_text('quote', tag='div')

# 高级导航
quote_text = page.css('.quote')[0].css('.text::text').get()
quote_text = page.css('.quote').css('.text::text').getall()  # 链式选择器
first_quote = page.css('.quote')[0]
author = first_quote.next_sibling.css('.author::text')
parent_container = first_quote.parent

# 元素关系和相似性
similar_elements = first_quote.find_similar()
below_elements = first_quote.below_elements()

如果您不想获取网站,可以直接使用解析器,用法完全相同:

from scrapling.parser import Selector

page = Selector("<html>...</html>")

4.1 自适应机制的源码原理

自适应能力的关键方法是 scrapling/parser.py 中的 relocate:它遍历页面树中的所有节点(注意源码注释:"the code doesn't stop even if the score was 100%,because there might be another element(s) left in page with the same score"),对每个节点用 __calculate_similarity_score 计算与目标元素指纹的相似度分数,按分数分桶存入 score_table,然后取最高分桶——但要求最高分不低于 percentage 阈值(默认 40%),否则记录告警"Adaptive relocation found no element above the {percentage}% threshold"并返回空列表。css(..., auto_save=True) 负责首次抓取时保存元素指纹,css(..., adaptive=True) 则在页面结构变化后调用这条重定位链路;元素指纹的存取由 save/retrieve 方法管理,持久化存储的实现细节见 docs/development/adaptive_storage_system.md

除重定位外,Selector 还内置了:find_similar(自动定位与已找到元素相似的元素)、find_by_textfind_by_regex(按文本/正则搜索)、re/re_first(内置正则方法)、父级/兄弟级/子级导航方法(parentchildrensiblingsnextpreviousiterancestors 等)、以及 get_all_text/prettify 等文本处理。Selectors 集合类(scrapling/parser.py 起)继承自 list,支持链式 css/xpathfilter/searchget/getallfirst/last

关于性能声明,README 称"快速 JSON 序列化比标准库快 10 倍"——从 pyproject.toml 的依赖看,序列化基于 orjson,这是该结论的实现基础。

五、Spider 框架:类 Scrapy 的完整爬取方案

Scrapling Spider 架构图

5.1 基础 Spider:并发请求 + 结果导出

构建具有并发请求、多种 Session 类型和暂停/恢复功能的完整爬虫:

from scrapling.spiders import Spider, Request, Response

class QuotesSpider(Spider):
    name = "quotes"
    start_urls = ["https://quotes.toscrape.com/"]
    concurrent_requests = 10

    async def parse(self, response: Response):
        for quote in response.css('.quote'):
            yield {
                "text": quote.css('.text::text').get(),
                "author": quote.css('.author::text').get(),
            }

        next_page = response.css('.next a')
        if next_page:
            yield response.follow(next_page[0].attrib['href'])

result = QuotesSpider().start()
print(f"抓取了 {len(result.items)} 条引用")
result.items.to_json("quotes.json")

scrapling/spiders/spider.pySpider 基类可以读到所有可调参数的真实默认值,这对调优很有用:

类属性 默认值 含义
concurrent_requests 4 全局并发请求数
concurrent_requests_per_domain 0(不限) 按域名限制并发
download_delay 0.0 下载延迟(秒)
max_blocked_retries 3 被阻止请求的最大重试次数
robots_txt_obey False 是否遵守 robots.txt
development_mode False 开发模式(响应缓存到磁盘,后续运行回放)
autothrottle_enabled False 是否启用自动限速
autothrottle_start_delay / autothrottle_max_delay 5.0 / 60.0 自动限速的起始/最大延迟
autothrottle_block_backoff True 被阻止时延迟加倍回退

此外源码中还定义了 BLOCKED_CODES = {401, 403, 407, 429, 444, 500, 502, 503, 504}scrapling/spiders/spider.py),即"被阻止请求检测:自动检测并重试被阻止的请求"所依据的状态码集合。

5.2 多 Session 类型混用

统一接口支持 HTTP 请求和隐秘无头浏览器在同一个 Spider 中使用——通过 ID 将请求路由到不同的 Session:

from scrapling.spiders import Spider, Request, Response
from scrapling.fetchers import FetcherSession, AsyncStealthySession

class MultiSessionSpider(Spider):
    name = "multi"
    start_urls = ["https://example.com/"]

    def configure_sessions(self, manager):
        manager.add("fast", FetcherSession(impersonate="chrome"))
        manager.add("stealth", AsyncStealthySession(headless=True), lazy=True)

    async def parse(self, response: Response):
        for link in response.css('a::attr(href)').getall():
            # 将受保护的页面路由到隐秘 Session
            if "protected" in link:
                yield Request(link, sid="stealth")
            else:
                yield Request(link, sid="fast", callback=self.parse)  # 显式 callback

Session 生命周期管理由 scrapling/spiders/session.pySessionManager 负责,lazy=True 意味着该 Session 直到首次被路由到请求时才真正启动浏览器。

5.3 暂停与恢复:基于 Checkpoint 的爬取持久化

通过如下方式运行 Spider 来暂停和恢复长时间爬取:

QuotesSpider(crawldir="./crawl_data").start()

按 Ctrl+C 优雅暂停——进度会自动保存。之后再次启动 Spider 时,传递相同的 crawldir,它将从上次停止的地方继续。从源码看(scrapling/spiders/spider.py),crawldirSpider.__init__ 的参数:"If provided, enables pause/resume";第二个参数 interval(默认 300.0 秒)控制周期性 checkpoint 保存的间隔。Checkpoint 的实现见 scrapling/spiders/checkpoint.py

5.4 Streaming 模式、AutoThrottle 与 robots.txt

  • Streaming 模式:通过 async for item in spider.stream() 以实时统计 Streaming 抓取的数据——非常适合 UI、管道和长时间运行的爬取;
  • AutoThrottle 自动限速:不用再猜延迟。Spider 会根据网站的响应速度自动调整每个域名的延迟,当网站开始封禁或限流时把延迟翻倍(或按 Retry-After 要求等待),并在恢复正常后重新提速。实现见 scrapling/spiders/throttle.py
  • robots.txt 合规:可选的 robots_txt_obey 标志,支持 DisallowCrawl-delayRequest-rate 指令,并按域名缓存。实现见 scrapling/spiders/robotstxt.py
  • 开发模式:首次运行时将响应缓存到磁盘(development_mode = True + development_cache_dir),后续运行直接回放——在不重新请求目标服务器的情况下迭代您的 parse() 逻辑;
  • 链接提取:独立的 LinkExtractor 组件(scrapling/spiders/links.py),支持 allow/deny 模式、域名过滤、CSS/XPath 范围限定、扩展名过滤和链接规范化——可在模板中使用,也可单独使用;
  • 内置导出:通过钩子和您自己的管道导出结果,或使用内置的 JSON/JSONL/CSV/XML 导出器:result.items.to_json()to_jsonl()to_csv()to_xml()(实现位于 scrapling/spiders/result.py)。

5.5 现成的 Spider 模板:跳过样板代码

使用 CrawlSpider 基于规则跟踪链接,SitemapSpider 基于 sitemap/robots.txt 爬取,XMLFeedSpider/CSVFeedSpider 用于遍历 XML/RSS 和 CSV 数据源,以及 ShopifySpider 通过 JSON API 抓取任意 Shopify 商店的全部商品,每个变体一条数据:

from scrapling.spiders import ShopifySpider

class MyStore(ShopifySpider):
    target_website = "example.com"

result = MyStore().start()  # 商店中的每件商品,每个变体一条数据

模板实现位于 scrapling/spiders/templates/ 目录(crawler.pysitemap.pyfeed.pyshopify.py),更完整的模板用法可参考 docs/spiders/generic-templates.mddocs/spiders/platform-templates.md

六、CLI 和交互式 Shell

Scrapling 包含强大的命令行界面,入口在 scrapling/cli.pypyproject.toml 中注册了两个命令脚本:scrapling = "scrapling.cli:main"scrapling-mcp = "scrapling.cli:mcp")。

启动交互式 Web Scraping Shell:

scrapling shell

这是一个可选的内置 IPython Shell,具有 Scrapling 集成、快捷方式和新工具,可加快 Web Scraping 脚本开发,例如将 curl 请求转换为 Scrapling 请求并在浏览器中查看请求结果。

也可以直接从终端使用 Scrapling 抓取 URL 而无需编写任何代码——直接将页面提取到文件(默认提取 body 标签内的内容)。输出扩展名决定格式:.txt 结尾则提取目标的文本内容.md 结尾是 HTML 内容的 Markdown 表示.html 结尾是 HTML 内容本身

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 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

从源码看,extract 组包含 get/post/put/delete(HTTP 请求,见 scrapling/cli.py__http_command 统一处理)以及 fetch(Chromium/Chrome 自动化)和 stealthy_fetch(带反检测与 --solve-cloudflare 选项);--impersonate 等选项由 _common_http_options 装饰器统一注入。Shell 与 extract 功能属于 [shell] extra,安装说明见 docs/cli/overview.mddocs/cli/interactive-shell.md

七、性能基准:解析速度对比

Scrapling 不仅功能强大——它还速度极快。以下基准测试将 Scrapling 的解析器与其他流行库的最新版本进行了比较(数据继承自 docs/README_CN.md,代表 100+ 次运行的平均值,测试方法见 benchmarks.py):

7.1 文本提取速度测试(5000 个嵌套元素)

# 时间 (ms) vs Scrapling
1 Scrapling 1.99 1.0x
2 Parsel/Scrapy 2.06 1.035
3 Raw Lxml 2.56 1.286
4 PyQuery 23.98 ~12x
5 Selectolax 197.02 ~99x
6 MechanicalSoup 1545.15 ~776.5x
7 BS4 with Lxml 1562.1 ~785.0x
8 BS4 with html5lib 3412.73 ~1714.9x

7.2 元素相似性和文本搜索性能

Scrapling 的自适应元素查找功能明显优于替代方案:

时间 (ms) vs Scrapling
Scrapling 2.3 1.0x
AutoScraper 12.58 5.47x

除速度外,架构层面还有两项设计:优化性能超越大多数 Python 抓取库(闪电般快速);优化的数据结构和延迟加载,实现最小内存占用(如 3.1 节所述的 Fetcher 懒加载导入即是一例)。

八、AI 集成:MCP 服务器与 Agent Skill

  • 与 AI 一起使用的 MCP 服务器:内置 MCP 服务器用于 AI 辅助 Web Scraping 和数据提取。MCP 服务器具有强大的自定义功能,利用 Scrapling 在将内容传递给 AI(Claude/Cursor 等)之前提取目标内容,从而加快操作并通过最小化 token 使用来降低成本。它还可以在多次调用之间保持浏览器会话、截取页面截图,并通过 CDP 驱动远程浏览器。命令行入口即 scrapling-mcpscrapling/cli.py 中的 mcp 命令,支持 --http/--host/--port/--executable-path/--auth-token/--allowed-host 参数,服务实现位于 scrapling/core/ai.py),详细配置见 docs/ai/mcp-server.md
  • Agent Skill:仓库内的 agent-skill/Scrapling-Skill/ 是开箱即用的 Agent Skill,让编码智能体全面掌握本库,使它们用 Scrapling 写出的代码符合当前 API,而不是靠猜测。配套示例脚本见 agent-skill/Scrapling-Skill/examples/01_fetcher_session.py02_dynamic_session.py03_stealthy_session.py04_spider.py

九、开发者体验与生态

  • 对 Scrapy 用户的无缝集成:已经在用 Scrapy?用 scrapling_response 装饰任意回调,即可用 Scrapling 的解析器解析您本来就抓取到的响应,无需重写项目(实现见 scrapling/integrations/scrapy.py,说明见 docs/integrations/scrapy.md);
  • 完整的类型覆盖:完整的类型提示,出色的 IDE 支持和代码补全。整个代码库在每次更改时都会自动使用 PyRight 和 MyPy 扫描——pyproject.toml 中同时配置了 [tool.mypy]check_untyped_defs = true)和 [tool.pyright],且仓库内包含 scrapling/py.typed 标记文件;
  • 自动选择器生成:为任何元素生成强大的 CSS/XPath 选择器;
  • 经过实战测试:官方声明拥有 92% 的测试覆盖率和完整的类型提示覆盖率;仓库内 tests/ 目录按模块组织了对应测试,如 tests/fetchers/tests/spiders/tests/parser/ 等,可按 docs/README_CN.md 的说明安装依赖后运行验证;
  • 现成的 Docker 镜像:每次发布时,包含所有浏览器的 Docker 镜像会自动构建和推送(见 Dockerfile)。

十、适用边界与合规声明

  • 适用前提:Python 3.10+;仅解析器功能用 pip install scrapling 即可,任何 Fetcher/Spider/CLI 场景都需追加对应 extra 并运行 scrapling install 下载浏览器;基准数据依赖 5000 嵌套元素与特定对比库的测试环境,复现请先阅读 benchmarks.py 的方法说明;
  • 免责声明(继承自原文档):此库仅用于教育和研究目的。使用此库即表示您同意遵守本地和国际数据抓取和隐私法律。作者和贡献者对本软件的任何滥用不承担责任。始终尊重网站的服务条款和 robots.txt 文件——这与框架内置 robots_txt_obey、AutoThrottle 等"克制型"设计相呼应;
  • 引用:如果将本库用于研究目的,可使用原文档给出的 BibTeX(作者 Karim Shoair,2024 年);
  • 许可证:本作品根据 BSD-3-Clause 许可证授权(LICENSE)。项目包含改编自 Parsel(BSD 许可证)的代码,用于 scrapling/core/translator.py 子模块;
  • 贡献:仓库提供了完整的 CONTRIBUTING.md,并可用 tox.inipytest.iniruff.toml 作为本地校验依据。

从单请求的 Fetcher.get() 到带 Checkpoint 的 MySpider().start(),Scrapling 用同一套 Selector 解析 API 贯穿了所有层——这是它"一个库,零妥协"定位的实际含义:无论您的场景是一次性抓取、反爬对抗,还是长期运行的全量爬取,选择器和数据流都可以保持一致,只在请求后端与并发编排上做切换。

登录后查看全文
热门项目推荐
相关项目推荐

项目优选

收起
kernelkernel
deepin linux kernel
C
33
18
ops-transformerops-transformer
本项目是CANN提供的transformer类大模型算子库,实现网络在NPU上加速计算。
C++
1.12 K
2.72 K
kernelkernel
openEuler内核是openEuler操作系统的核心,既是系统性能与稳定性的基石,也是连接处理器、设备与服务的桥梁。
C
528
588
ops-nnops-nn
本项目是CANN提供的神经网络类计算算子库,实现网络在NPU上加速计算。
C++
906
1.83 K
pytorchpytorch
作为 Ascend for PyTorch 社区的核心组件,TorchNPU 是昇腾专为 PyTorch 打造的深度学习适配插件,使 PyTorch 框架能够直接调用昇腾 NPU,为开发者提供昇腾 AI 处理器的超强算力。
Python
854
1.34 K
docsdocs
暂无描述
Markdown
891
5.78 K
jiuwenswarmjiuwenswarm
JiuwenSwarm 是一款基于openJiuwen开发的智能AI Agent,它能够将大语言模型的强大能力,通过你日常使用的各类通讯应用,直接延伸至你的指尖。
Python
3.53 K
1.01 K
ops-mathops-math
本项目是CANN提供的数学类基础计算算子库,实现网络在NPU上加速计算。
C++
1.34 K
1.45 K
cann-learning-hubcann-learning-hub
CANN 学习中心仓,支持在线互动运行、边学边练,提供教程、示例与优化方案,一站式助力昇腾开发者快速上手。
Jupyter Notebook
987
506
AscendNPU-IRAscendNPU-IR
AscendNPU-IR是基于MLIR(Multi-Level Intermediate Representation)构建的,面向昇腾亲和算子编译时使用的中间表示,提供昇腾完备表达能力,通过编译优化提升昇腾AI处理器计算效率,支持通过生态框架使能昇腾AI处理器与深度调优
C++
540
384