Skip to content

fix(web-crawler): remove Playwright rendering andoptimize the robots.txt entry-failure message - #3040

Merged
qin-ctx merged 2 commits into
volcengine:mainfrom
sponge225:refactor/remove-playwright-rendering
Jul 6, 2026
Merged

fix(web-crawler): remove Playwright rendering andoptimize the robots.txt entry-failure message#3040
qin-ctx merged 2 commits into
volcengine:mainfrom
sponge225:refactor/remove-playwright-rendering

Conversation

@sponge225

@sponge225 sponge225 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Description

从递归网页爬虫中移除基于 Playwright 的回退渲染路径。SPA 页面现在直接存储为静态 shell HTML,不再启动 headless 浏览器渲染,恢复了爬虫原本轻量、无额外依赖的行为。为避免产出空文档,SPA 空壳页现在会保留 提示语(例如 You need to enable JavaScript to run this app. );被 robots.txt 拦截的入口页也会返回更易读的报错。

Related Issue

Type of Change

  • Refactoring(无功能变更)
  • Bug fix(修复问题的非破坏性变更)
  • New feature
  • Breaking change
  • Documentation update
  • Performance improvement
  • Test update

Changes Made

  • 删除 playwright_renderer.py 、 render_heuristics.py 及其测试; parse 现在直接存储静态 HTML( source="scrapy_static" )
  • 移除 fallback_playwright / playwright_timeout 配置项、 fallback_rendered 计数器,以及爬虫和 web importer 中所有 render-hint 相关逻辑
  • HTMLParser :删除对 SPA 空壳提示语的清洗替换,并在 trafilatura 抽取为空时回退提取 文本,使 SPA 空壳页保留提示而非写出空文件
  • 优化 robots.txt 入口页失败的报错文案(把生硬的 Forbidden by robots.txt 换成通俗的说明)
  • 将失联的 _convert_to_raw_url 测试迁移到 HTTPAccessor (该方法在早前的重构中已迁至此处),并删除过时的测试文件
  • 更新文档( docs/{en,zh}/api/02-resources.md ),移除关于 Playwright 回退渲染的描述

Testing

  • 已添加测试以验证修复有效 / 功能可用
  • 本地新增及既有单元测试均通过
  • 已在以下平台测试:
    • Linux
    • macOS
    • Windows
      本地相关测试套件全部通过( tests/parse/ 、 tests/parse/accessors/web_crawler/ 、 tests/unit/test_web_importer.py 、 tests/unit/test_accessors_http.py )——共 160 passed。

Checklist

  • 代码遵循项目的编码风格
  • 已进行自查(self-review)
  • 变更未产生新的告警
  • 已同步更新相关文档(资源 API 文档)

Additional Notes

…hells

Drop the Playwright-based fallback rendering path so SPA pages are stored
as their static shell HTML instead of being rendered headlessly. SPA
shells now surface the <noscript> notice (e.g. "You need to enable
JavaScript to run this app.") rather than producing an empty document,
and robots.txt-blocked entry pages get a human-readable error message.

- Delete playwright_renderer.py, render_heuristics.py and their tests
- Strip fallback_playwright/playwright_timeout config, fallback_rendered
  counter, and render-hint plumbing from the crawler and web importer
- HTMLParser: drop the SPA-empty-pattern stripping and fall back to
  <noscript> text when trafilatura extracts nothing
- Humanize the robots.txt entry-failure message
- Migrate the orphaned _convert_to_raw_url tests to HTTPAccessor (the
  method moved there in an earlier reorg) and remove the stale file
Replace the verbose robots.txt explanation with a short compliance hint
that omits the URL and points users to local-file import instead.
@qin-ctx
qin-ctx merged commit 8d861fa into volcengine:main Jul 6, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Jul 6, 2026
@sponge225
sponge225 deleted the refactor/remove-playwright-rendering branch July 27, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants