dsh-web-fetch-playwright 0.2.18 → 0.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,7 @@ A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH) plug
10
10
 
11
11
  - **Real browser rendering** — loads the page the way a user sees it, so client-side rendered (SPA) content is captured, not just the raw HTML.
12
12
  - **Denoise pipeline** — Mozilla Readability extracts the article, DOMPurify removes layout/noise tags (nav, sidebar, footer, ads, forms), and Turndown with the GFM plugin converts to Markdown with the same style options as the shipped `tool-web` renderer. Inline `data:` images (build tools like Docusaurus embed screenshots as base64) are elided to size placeholders such as `![alt](data:image/png;base64,...8.9KB)` so they cannot flood the body. On list-shaped pages (portals, catalogs) where the content *is* the links, Readability's link-density scoring picks a noise fragment — a coverage gate therefore distrusts an extraction under 250 characters or covering under 10% of the page's visible text (measured on the 163.com homepage: 96 characters of footer licensing won while 320 headlines scored near zero), and the pipeline falls back to the sanitized whole document, which on such pages keeps effectively all list content. An accepted extraction is then pruned of trailing link-dense sections — the post-article recommendation rails and share bars that ride *inside* the winning wrapper and survive every vocabulary-based rule (163's `post_recommend` cards measure 0.42–0.48 per-card link density, just under Readability's own 0.5 removal bar, and arrive as bare divs with no class to match); a trailing run of such blocks is removed only when it is a minority of its container *and* clearly denser than the content before it, so link-list extractions (feed rows, portal headlines) are untouched.
13
+ - **PDF links** — a URL that serves a PDF (inline `application/pdf`, a `Content-Disposition: attachment` download, or an `application/octet-stream` whose bytes start with `%PDF-`) is read as bytes and converted to Markdown instead of failing: pdf.js (via `unpdf`) supplies positioned text and real font names, and layout heuristics rebuild headings (outline/bookmarks, section numbering such as `3.1` / `第二章` / `一、`, type size, standalone bold lines), paragraphs (gaps, first-line indents, cross-column/cross-page continuation, dictionary-checked de-hyphenation, CJK-aware joining), lists, monospace code blocks, column-aligned GFM tables, inline bold, and `<!-- page N -->` markers, while dropping running headers/footers and page numbers. See [PDF links](#pdf-links).
13
14
  - **Two backends** — launch a local Playwright browser, or drive an already-running browser over its DevTools Protocol (CDP) endpoint.
14
15
  - **Browser resolution** — a configured path, a `playwright` CLI on `$PATH`, or the bundled `playwright-core`; CDP needs no local browser at all.
15
16
  - **Shared profile or reusable isolation (CDP)** — each fetch opens and closes its own tab; session isolation uses a dedicated CDP connection per DSH session, while global/profile modes share one connection. By default it uses the browser's existing default context and logins (`connectOverCDP` → `browser.contexts()[0]`, like CLI CDP attach with isolation disabled, not `playwright-cli open`). Session isolation creates an in-memory context on demand and shares it only while same-session fetches or other tabs keep it in use; global isolation retains one fixed isolated context across all sessions within the same plugin instance. Local launches still close their browser per fetch.
@@ -30,12 +31,13 @@ web_fetch (tool-web)
30
31
  └─ ctx.web.fetchProvider = playwright
31
32
  ├─ local: resolve (path → $PATH → bundled playwright-core) → chromium.launch
32
33
  ├─ cdp: connectOverCDP(endpoint)
34
+ ├─ PDF (inline / attachment / sniffed octet-stream) → bytes (navigation body, else request-context refetch) → pdf.js → layout heuristics → Markdown
33
35
  ├─ page.goto → settle (networkidle, best-effort) → deep-capture scroll walk (virtualized feeds; returns its merged, stripped capture when it restored anything) → otherwise strip scripting subtrees in the live DOM → page.content()
34
36
  ├─ denoise: jsdom → elide data-URI images → Readability → coverage gate → trailing link-dense prune → DOMPurify → Turndown(GFM)
35
37
  └─ Markdown (or raw HTML when denoise is off)
36
38
  ```
37
39
 
38
- **Non-2xx statuses are results, not errors** — the web seam's contract (`@deepseek-ai/dsh-web`): a fetched 404/418/500 comes back with its status code, exactly what `dsh-web-fetch-http` does. Chromium complicates this for *status-only* responses — an error status with an empty body (httpbin's `/status/404`) fails the whole navigation with `net::ERR_HTTP_RESPONSE_CODE_FAILURE`, and a 204/205 is aborted (`net::ERR_ABORTED`) because nothing is renderable. The provider therefore tracks the last main-frame response on every fetch (that response arrives before Chromium fails the navigation) and recovers such failures into the status-bearing result, so `web_fetch` reports `Fetched … (HTTP 404)` instead of a `WEB_PROVIDER_ERROR` throw. The same recovery covers *download* responses — a body served with `Content-Disposition: attachment` (publish.twitter.com's oembed endpoint, the URL agents use to read a tweet, serves its JSON exactly that way) never commits a document: `goto` rejects with `Download is starting` and the body is gone from the network stack, so the provider refetches it through the page's API request context and returns the decodable content; undecodable downloads (a PDF, a ZIP) still fail with `WEB_UNSUPPORTED_CONTENT_TYPE`. A recovered response that is itself a Cloudflare challenge edge still fails with `WEB_FETCH_CHALLENGE`; transport errors and cancellations stay errors.
40
+ **Non-2xx statuses are results, not errors** — the web seam's contract (`@deepseek-ai/dsh-web`): a fetched 404/418/500 comes back with its status code, exactly what `dsh-web-fetch-http` does. Chromium complicates this for *status-only* responses — an error status with an empty body (httpbin's `/status/404`) fails the whole navigation with `net::ERR_HTTP_RESPONSE_CODE_FAILURE`, and a 204/205 is aborted (`net::ERR_ABORTED`) because nothing is renderable. The provider therefore tracks the last main-frame response on every fetch (that response arrives before Chromium fails the navigation) and recovers such failures into the status-bearing result, so `web_fetch` reports `Fetched … (HTTP 404)` instead of a `WEB_PROVIDER_ERROR` throw. The same recovery covers *download* responses — a body served with `Content-Disposition: attachment` (publish.twitter.com's oembed endpoint, the URL agents use to read a tweet, serves its JSON exactly that way) never commits a document: `goto` rejects with `Download is starting` and the body is gone from the network stack, so the provider refetches it through the page's API request context and returns the decodable content; a PDF download is extracted to Markdown (see [PDF links](#pdf-links)), and other undecodable downloads (a ZIP) still fail with `WEB_UNSUPPORTED_CONTENT_TYPE`. A recovered response that is itself a Cloudflare challenge edge still fails with `WEB_FETCH_CHALLENGE`; transport errors and cancellations stay errors.
39
41
 
40
42
  **Non-content scripting subtrees are removed in the live DOM before the document is read back — output-neutral by construction.** The denoise pipeline (and the tool layer's own renderer on the raw-HTML path) re-parses `page.content()` with jsdom, and a script's *text* is the one thing that round-trip cannot trust: a page's runtime JS may rewrite a data script's text with a literal `</script>` embedded — measured on techcommunity.microsoft.com (Khoros/Aurora), whose client writes its whole Apollo cache back into `script#__NEXT_DATA__` via `JSON.stringify`, un-escaping the wire's 712 `\u003c` sequences into raw `<` — and browsers serialize script text verbatim, so the flattened HTML string ends that script at the *first* embedded end tag and parses the remaining ~270KB of JSON *as markup*. The phantom elements that survive (unknown tags like `<id>`, anchors full of CSS and i18n strings) are exactly what Readability's scorer reads as article mass (measured: 126 points vs the real body's 45), so the badcase fetch of the RDP 10 AVC/H.264 article returned CSS rules and `CachedAsset` strings instead of the post. No string-level patch can disambiguate that serialization after the fact — only the browser's own parse holds the document's true structure — so ordinary `script` and `template` subtrees are stripped inside the live page (`page.evaluate`, best-effort) before `page.content()`. This changes nothing the pipeline ever returned: Readability deletes script/noscript nodes before extraction and scoring anyway, DOMPurify's allowlist drops script, and the tool layer's renderer removes SCRIPT/TEMPLATE wholesale — differential A/B over a real-page corpus (Wikipedia, MDN, Hacker News, the badcase page's wire HTML, plus noscript/JSON-LD/template edge cases) came back **byte-identical on every page**. Two deliberate carve-outs keep even the indirect consumers intact: `script[type="application/ld+json"]` is *defused* rather than deleted (`</` rewritten to `<\/` — still valid JSON, so Readability's metadata pass reads the same object and keeps the site-suffix-free article title, e.g. "Remote Desktop Protocol" instead of "… - Wikipedia"), and `noscript` is kept entirely because Readability's `_unwrapNoscriptImages` salvages the real image out of lazy-load `<noscript><img …>` wrappers. The strip also applies with `denoise` off, keeps the raw HTML serialization-safe for the tool layer's renderer, and shrinks what the pipeline parses (~70% on the badcase page).
41
43
 
@@ -157,6 +159,20 @@ The walk runs in both denoise modes and is bounded by `scrollBudgetMs` (default
157
159
 
158
160
  Measured on the live badcases: the linux.do topic (51 replies, ~18kpx) walks fully in one 20s budget with every post rehydrated and zero cloaked placeholders left; the Feishu wiki page walks its inner container in ~11.5s of the 20s budget (15 steps, 38 removed blocks spliced back, 191 blocks in the final DOM — the resting capture had 7) and the deep tail (both JSON examples, the full passages) lands in the markdown. One residual limitation, documented as measured: Feishu table blocks lazy-render their *cells* behind a second, in-block virtualization the walk does not chase — table headers and rows are restored, very large payload cells may stay empty.
159
161
 
162
+ ### PDF links
163
+
164
+ When the fetched URL turns out to be a PDF, the provider extracts it instead of failing with `WEB_UNSUPPORTED_CONTENT_TYPE`:
165
+
166
+ | How the PDF arrives | What the browser does | How the bytes are obtained |
167
+ | --- | --- | --- |
168
+ | `application/pdf` (inline) | headless Chromium downloads it; a headed or CDP-attached Chrome opens its viewer | navigation body when it is the PDF, else a refetch through the page's API request context |
169
+ | `Content-Disposition: attachment` | `goto` rejects with `Download is starting` | refetch through the API request context |
170
+ | `application/octet-stream` (and kin), `.pdf` path or filename | download | refetch, then the `%PDF-` magic decides |
171
+
172
+ The refetch uses the same browser context, so cookies and logins (CDP profile mode) apply to gated PDFs. The bytes go through pdf.js (`unpdf`'s serverless build, lazily imported — plugin start never loads it) and a layout pass (`src/pdf.ts`) that turns positioned text into Markdown: the largest first-page type becomes the `#` title (else the PDF's metadata title), headings come from the outline, numbering, larger type, or standalone bold lines; running headers/footers and page numbers are removed; paragraphs are rebuilt and joined across columns and pages; bullets, numbered items, monospace blocks, and column-aligned rows become lists, fenced code, and GFM tables; each page starts with a `<!-- page N -->` marker.
173
+
174
+ Limits and errors: PDFs over 50MB fail with `WEB_PDF_TOO_LARGE` (checked against `Content-Length` before downloading); reading stops after 500 pages, 100k collected characters, or the fetch deadline, and the result is flagged `truncated` with a note naming the last page read. A scan with no text layer fails with `WEB_PDF_NO_TEXT` (OCR is not supported — PDFs that carry an OCR text layer extract normally), a password-protected PDF with `WEB_PDF_ENCRYPTED`, and bytes pdf.js cannot parse with `WEB_PDF_INVALID`. Known limitations: tables without consistent column gaps (and figure labels) come out as plain text, multi-column layouts rely on the PDF's content order, and bullets drawn as vector shapes (rather than glyphs) are not recognized as list markers.
175
+
160
176
  ## Development
161
177
 
162
178
  ```sh
package/README.zh-CN.md CHANGED
@@ -10,6 +10,7 @@
10
10
 
11
11
  - **真实浏览器渲染** —— 以用户视角加载页面,SPA 客户端渲染内容也能抓到,而非只有原始 HTML。
12
12
  - **降噪管线** —— Mozilla Readability 提取正文,DOMPurify 移除布局/噪音标签(导航、侧边栏、页脚、广告、表单),Turndown + GFM 插件按与内置 `tool-web` 渲染器一致的风格转成 Markdown。内联 `data:` 图片(Docusaurus 等构建工具会把截图以 base64 内嵌进 HTML)会被替换为带大小的占位符,如 `![alt](data:image/png;base64,...8.9KB)`,避免 base64 字符流刷屏。对列表型页面(门户首页、商品目录——正文本身就是链接),Readability 的链接密度打分会误选出噪声碎片(实测 163.com 首页:96 字符的页脚备案块胜出,320 条新闻标题得分趋零),因此抽取结果需通过**覆盖率置信门**——不足 250 字符、或占页面可见文本不足 10% 即不予采信,转而回退到整页消毒转换,此类页面上可基本完整保留列表内容。通过置信门的抽取结果再做**尾部链接密集块修剪**——正文之后的推荐流、分享栏往往随正文一起被裹进胜出的容器里,且能躲过所有基于类名的规则(163 的 `post_recommend` 卡片单卡链接密度 0.42–0.48,恰好低于 Readability 自己 0.5 的删除线,且抽取后类名尽失、无从匹配);只有当尾部连续块**既占容器文本少数、又明显比其前的正文更"链接化"**时才整体移除,因此链接列表型抽取(信息流、门户头条)不受影响。
13
+ - **PDF 链接** —— 当 URL 返回的是 PDF(inline 的 `application/pdf`、`Content-Disposition: attachment` 下载,或文件头为 `%PDF-` 的 `application/octet-stream`)时,按字节读取并转换为 Markdown,而不是报错:pdf.js(通过 `unpdf`)提供带坐标的文本和真实字体名,版面启发式规则据此还原标题(书签、`3.1` / `第二章` / `一、` 等章节编号、字号、独立粗体行)、段落(间距、首行缩进、跨栏跨页衔接、基于全文词表的断词合并、中日韩文字无空格拼接)、列表、等宽代码块、列对齐的 GFM 表格、行内粗体和 `<!-- page N -->` 页码标记,同时去除页眉页脚和页码。详见 [PDF 链接](#pdf-链接)。
13
14
  - **两种后端** —— 本地启动 Playwright 浏览器,或通过 DevTools 协议(CDP)驱动一个已在运行的浏览器。
14
15
  - **浏览器解析** —— 配置路径 → `$PATH` 上的 `playwright` CLI → 插件自带的 `playwright-core`;CDP 模式完全不需要本地浏览器。
15
16
  - **共享 profile 或复用隔离上下文(CDP)** —— 每次抓取通过共享 CDP 连接创建自己的标签页,用完即关。默认复用浏览器已有默认 context 与登录态(`connectOverCDP` → `browser.contexts()[0]`,类似关闭隔离后的 CLI CDP attach,而不是 `playwright-cli open`)。会话隔离按需创建独立的内存 context,仅在同一会话的抓取或其他标签页仍在使用时复用;全局隔离则在同一插件实例内跨会话保留并复用一个固定的隔离 context。本地后端仍每次抓取启动并关闭浏览器。
@@ -30,12 +31,13 @@ web_fetch (tool-web)
30
31
  └─ ctx.web.fetchProvider = playwright
31
32
  ├─ local: 解析(路径 → $PATH → 内置 playwright-core)→ chromium.launch
32
33
  ├─ cdp: connectOverCDP(endpoint)
34
+ ├─ PDF(inline / attachment / 嗅探出的 octet-stream)→ 字节(导航响应体,否则 request context 重新拉取)→ pdf.js → 版面启发式 → Markdown
33
35
  ├─ page.goto → 等待稳定(networkidle,尽力而为)→ 深度抓取滚动遍历(虚拟化信息流;有还原时直接返回其合并且已剥离的结果)→ 否则在活 DOM 中剥离脚本子树 → page.content()
34
36
  ├─ 降噪:jsdom → 内联 data: 图片改占位符 → Readability → 覆盖率置信门 → 尾部链接密集块修剪 → DOMPurify → Turndown(GFM)
35
37
  └─ Markdown(关闭降噪时返回原始 HTML)
36
38
  ```
37
39
 
38
- **非 2xx 状态码是结果而非错误** —— 这是 web seam 的契约(`@deepseek-ai/dsh-web`):抓取到的 404/418/500 会连同状态码一起正常返回,与 `dsh-web-fetch-http` 的行为一致。但对*仅有状态*的响应 Chromium 会把事情搞砸 —— 空 body 的错误状态(httpbin 的 `/status/404`)会让整个导航以 `net::ERR_HTTP_RESPONSE_CODE_FAILURE` 失败,204/205 则因无可渲染内容被中止(`net::ERR_ABORTED`)。因此 provider 在每次抓取中都跟踪最后一个主框架响应(该响应先于 Chromium 判定导航失败到达),并把这类失败恢复成带状态码的正常结果,`web_fetch` 会报告 `Fetched … (HTTP 404)` 而不是抛出 `WEB_PROVIDER_ERROR`。同样的恢复也覆盖*下载型*响应 —— 带 `Content-Disposition: attachment` 的 body(publish.twitter.com 的 oembed 端点——agent 读取推文常用的替代 URL——返回的 JSON 正是如此)永远不会被提交为文档:`goto` 以 `Download is starting` 拒绝,且 body 已从网络栈中流失,provider 因此通过页面的 API request context 重新拉取并返回可解码内容;不可解码的下载(PDF、ZIP)仍以 `WEB_UNSUPPORTED_CONTENT_TYPE` 失败。若恢复出的响应本身来自 Cloudflare 挑战边缘,仍以 `WEB_FETCH_CHALLENGE` 失败;传输错误与取消也依旧按错误处理。
40
+ **非 2xx 状态码是结果而非错误** —— 这是 web seam 的契约(`@deepseek-ai/dsh-web`):抓取到的 404/418/500 会连同状态码一起正常返回,与 `dsh-web-fetch-http` 的行为一致。但对*仅有状态*的响应 Chromium 会把事情搞砸 —— 空 body 的错误状态(httpbin 的 `/status/404`)会让整个导航以 `net::ERR_HTTP_RESPONSE_CODE_FAILURE` 失败,204/205 则因无可渲染内容被中止(`net::ERR_ABORTED`)。因此 provider 在每次抓取中都跟踪最后一个主框架响应(该响应先于 Chromium 判定导航失败到达),并把这类失败恢复成带状态码的正常结果,`web_fetch` 会报告 `Fetched … (HTTP 404)` 而不是抛出 `WEB_PROVIDER_ERROR`。同样的恢复也覆盖*下载型*响应 —— 带 `Content-Disposition: attachment` 的 body(publish.twitter.com 的 oembed 端点——agent 读取推文常用的替代 URL——返回的 JSON 正是如此)永远不会被提交为文档:`goto` 以 `Download is starting` 拒绝,且 body 已从网络栈中流失,provider 因此通过页面的 API request context 重新拉取并返回可解码内容;PDF 下载会被提取为 Markdown(见 [PDF 链接](#pdf-链接)),其他不可解码的下载(ZIP)仍以 `WEB_UNSUPPORTED_CONTENT_TYPE` 失败。若恢复出的响应本身来自 Cloudflare 挑战边缘,仍以 `WEB_FETCH_CHALLENGE` 失败;传输错误与取消也依旧按错误处理。
39
41
 
40
42
  **回读文档前,先在活 DOM 中剥离非内容脚本子树 —— 构造上即输出中性。** 降噪管线(以及关闭降噪时工具层自己的渲染器)会用 jsdom 重新解析 `page.content()`,而脚本的*文本内容*是这条往返链路中唯一无法信任的东西:页面自身的运行时 JS 可能把内嵌 `</script>` 的文本写回某个数据脚本的 textContent —— 实测于 techcommunity.microsoft.com(Khoros/Aurora 平台),其客户端把整个 Apollo 缓存经 `JSON.stringify` 写回 `script#__NEXT_DATA__`,把线上响应里 712 处 `\u003c` 转义还原成了裸 `<` —— 而浏览器序列化脚本文本时原样输出,于是这份扁平化的 HTML 字符串会在*第一个*内嵌结束标签处终止脚本,把余下约 270KB 的 JSON *当作标记语言*解析。解析出的幽灵元素(`<id>` 之类的未知标签、塞满 CSS 与 i18n 字符串的锚点)恰好是 Readability 评分器眼里的"正文质量"(实测 126 分对真实正文的 45 分),于是抓取 RDP 10 AVC/H.264 一文时返回的是 CSS 规则和 `CachedAsset` 字符串而不是文章本体。事后再对字符串做补丁无法消除这种歧义 —— 只有浏览器自己的解析持有文档的真实结构 —— 因此普通的 `script` 与 `template` 子树在 `page.content()` 之前先在活页面里剥掉(`page.evaluate`,尽力而为)。这不会改变管线以往的任何输出:Readability 本就在抽取与评分前删除 script/noscript 节点,DOMPurify 的白名单本就丢弃 script,工具层渲染器也整体移除 SCRIPT/TEMPLATE —— 在真实页面语料(Wikipedia、MDN、Hacker News、坏例页 wire 版,加上 noscript/JSON-LD/template 边界用例)上的差分 A/B **每一页都字节级一致**。两个刻意的保留让间接消费方也不受损:`script[type="application/ld+json"]` 只做*消险*而非删除(`</` 改写为 `<\/` —— 仍是合法 JSON,Readability 的元数据读取解析到同一对象,文章标题保持无站点后缀的干净形态,如 "Remote Desktop Protocol" 而非 "… - Wikipedia");`noscript` 完整保留,因为 Readability 的 `_unwrapNoscriptImages` 会从懒加载的 `<noscript><img …>` 包裹中抢救出真实图片。该剥离在关闭降噪时同样生效,让返回给工具层渲染器的原始 HTML 也是序列化安全的,并把管线要解析的体积压缩约 70%(以该坏例页计)。
41
43
 
@@ -157,6 +159,20 @@ google-chrome --remote-debugging-port=9222 --user-data-dir="$HOME/.config/chrome
157
159
 
158
160
  真实坏例实测:linux.do 帖子(51 楼、约 18kpx)在 20s 预算内一次遍历走完,每楼都被再水合、零占位符残留;飞书 wiki 页面在 20s 预算中用约 11.5s 走完内层容器(15 步、插回 38 个被移除的块、最终 DOM 191 块——静止抓取只有 7 块),深部尾文(两处 JSON 示例与完整段落)都进入 markdown。一项如实记录的残余限制:飞书表格块的**单元格**藏在第二层块内虚拟化后面,遍历不追——表头与行能还原,超大载荷单元格可能保持为空。
159
161
 
162
+ ### PDF 链接
163
+
164
+ 当抓取的 URL 实际返回的是 PDF 时,provider 会提取其内容,而不是以 `WEB_UNSUPPORTED_CONTENT_TYPE` 失败:
165
+
166
+ | PDF 的返回方式 | 浏览器的行为 | 字节的获取方式 |
167
+ | --- | --- | --- |
168
+ | `application/pdf`(inline) | 无头 Chromium 会下载它;有界面或经 CDP 连接的 Chrome 会打开内置查看器 | 导航响应体本身是 PDF 时直接使用,否则通过页面的 API request context 重新拉取 |
169
+ | `Content-Disposition: attachment` | `goto` 以 `Download is starting` 拒绝 | 通过 API request context 重新拉取 |
170
+ | `application/octet-stream` 等通用二进制类型、`.pdf` 路径或文件名 | 下载 | 重新拉取后,以 `%PDF-` 魔数判定 |
171
+
172
+ 重新拉取使用同一个浏览器上下文,因此 Cookie 和登录态(CDP profile 模式)对需要登录的 PDF 同样生效。字节交给 pdf.js(`unpdf` 的 serverless 构建,按需动态加载,插件启动时不会加载)解析,再由版面分析(`src/pdf.ts`)把带坐标的文本还原成 Markdown:第一页最大字号的文字作为 `#` 标题(否则用 PDF 元数据中的标题);标题层级来自书签、章节编号(`3.1` / `第二章` / `一、`)、更大的字号或独立成行的粗体;去除页眉页脚和页码;重建段落,并跨栏、跨页衔接;项目符号、编号条目、等宽字体块和列对齐的行分别转为列表、代码块和 GFM 表格;每页开头带 `<!-- page N -->` 标记。
173
+
174
+ 限制与错误码:超过 50MB 的 PDF 以 `WEB_PDF_TOO_LARGE` 失败(下载前先按 `Content-Length` 检查);读取到 500 页、累计 10 万字符或抓取截止时间时停止,结果标记为 `truncated`,并注明最后读取的页码。没有文本层的扫描件以 `WEB_PDF_NO_TEXT` 失败(不支持 OCR;自带 OCR 文本层的 PDF 可以正常提取),加密 PDF 以 `WEB_PDF_ENCRYPTED` 失败,pdf.js 无法解析的数据以 `WEB_PDF_INVALID` 失败。已知局限:没有稳定列间距的表格(以及图中的标注文字)会以普通文本输出;多栏版面依赖 PDF 内容流的顺序;用矢量图形(而非字形)绘制的项目符号不会被识别为列表标记。
175
+
160
176
  ## 开发
161
177
 
162
178
  ```sh
package/lib/client.js CHANGED
@@ -417,12 +417,12 @@ window.__ModuleLoader__.load({
417
417
  document.head.appendChild(tag);
418
418
  }
419
419
  var PluginCard_module_css_default = {
420
- "form": "UM8-Rq_form",
421
420
  "footer": "UM8-Rq_footer",
422
- "failed": "UM8-Rq_failed",
421
+ "form": "UM8-Rq_form",
423
422
  "readOnly": "UM8-Rq_readOnly",
424
- "discard": "UM8-Rq_discard",
425
- "save": "UM8-Rq_save"
423
+ "failed": "UM8-Rq_failed",
424
+ "save": "UM8-Rq_save",
425
+ "discard": "UM8-Rq_discard"
426
426
  };
427
427
  //#endregion
428
428
  //#region src/client/PluginCard.tsx
@@ -482,27 +482,27 @@ window.__ModuleLoader__.load({
482
482
  document.head.appendChild(tag);
483
483
  }
484
484
  var fields_module_css_default = {
485
- "fieldEmbedded": "CFSaVG_fieldEmbedded",
486
- "head": "CFSaVG_head",
485
+ "inputInvalid": "CFSaVG_inputInvalid",
486
+ "radioOptionPlain": "CFSaVG_radioOptionPlain",
487
487
  "badge": "CFSaVG_badge",
488
- "reset": "CFSaVG_reset",
488
+ "radioPick": "CFSaVG_radioPick",
489
+ "field": "CFSaVG_field",
490
+ "invalid": "CFSaVG_invalid",
491
+ "hint": "CFSaVG_hint",
489
492
  "radioGroup": "CFSaVG_radioGroup",
493
+ "input": "CFSaVG_input",
490
494
  "radioText": "CFSaVG_radioText",
495
+ "radioHint": "CFSaVG_radioHint",
491
496
  "radioContent": "CFSaVG_radioContent",
492
- "hint": "CFSaVG_hint",
493
- "checkboxRow": "CFSaVG_checkboxRow",
497
+ "label": "CFSaVG_label",
498
+ "reset": "CFSaVG_reset",
494
499
  "radioLabel": "CFSaVG_radioLabel",
495
- "radioHint": "CFSaVG_radioHint",
496
- "radioPick": "CFSaVG_radioPick",
497
- "input": "CFSaVG_input",
498
500
  "hintIndented": "CFSaVG_hintIndented",
499
- "badges": "CFSaVG_badges",
500
- "invalid": "CFSaVG_invalid",
501
+ "checkboxRow": "CFSaVG_checkboxRow",
501
502
  "radioOption": "CFSaVG_radioOption",
502
- "radioOptionPlain": "CFSaVG_radioOptionPlain",
503
- "label": "CFSaVG_label",
504
- "field": "CFSaVG_field",
505
- "inputInvalid": "CFSaVG_inputInvalid"
503
+ "badges": "CFSaVG_badges",
504
+ "fieldEmbedded": "CFSaVG_fieldEmbedded",
505
+ "head": "CFSaVG_head"
506
506
  };
507
507
  //#endregion
508
508
  //#region src/client/fields.tsx