@fffangchenghao/dsh-web-search 0.13.0 → 0.13.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.1
4
+
5
+ ### Documentation
6
+ - `read_page`'s page cache is keyed by URL, output format and the fetch settings
7
+ that shape the result — including the AnySearch key. The READMEs now say so,
8
+ and the test count matches what the suite actually reports.
9
+
3
10
  ## 0.13.0
4
11
 
5
12
  ### Added
package/README.md CHANGED
@@ -746,7 +746,7 @@ Arguments: `url` (required), `offset` (optional, default `0`, zero-based), `maxL
746
746
 
747
747
  Returns: `url`, `content` (this chunk's text), `offset`, `nextOffset` (the offset to pass next; `null` when finished), `totalLength` (whole-body length), `truncated` (whether the source itself was cut: the 2,000,000-character cap or the transport), `chunk` (`index` is 1-based, `count` is estimated for this call's `maxLength`), and `failures` (fetch failures, shaped like `domain_search` / `search_many`).
748
748
 
749
- Cache: a successful body is cached per URL, output format and fetch-affecting settings, up to eight pages with least-recently-used eviction; walking a page chunk by chunk therefore fetches it once, and only a format change or a change to proxy, timeout or render settings fetches it again. Failures are not cached. `content` excludes the "characters remain" hint, so concatenating the chunks reproduces the body exactly.
749
+ Cache: a successful body is cached per URL, output format and fetch-affecting settings, up to eight pages with least-recently-used eviction; walking a page chunk by chunk therefore fetches it once, and only a format change or a change to proxy, timeout, render settings or the AnySearch key fetches it again. Failures are not cached. `content` excludes the "characters remain" hint, so concatenating the chunks reproduces the body exactly.
750
750
 
751
751
  Boundaries: an `offset` past `totalLength` throws; `offset === totalLength` counts as finished and returns empty `content` with `nextOffset: null`; a non-http(s) URL throws; network, HTTP or blocked failures come back in `failures` instead of reaching the host; caller cancellation still throws. Offsets and lengths count JavaScript string code units, and a cut that would split a surrogate pair moves back one code unit, with `nextOffset` following the adjusted boundary.
752
752
 
package/README.zh-CN.md CHANGED
@@ -746,7 +746,7 @@ read_page 调用
746
746
 
747
747
  返回:`url`、`content`(这一段正文)、`offset`、`nextOffset`(下次该传的 offset;读完为 `null`)、`totalLength`(整页正文长度)、`truncated`(来源本身是否被截断:2,000,000 字符安全上限或传输层截断)、`chunk`(`index` 从 1 开始,`count` 按本次 `maxLength` 估算)、`failures`(抓取失败,形状与 `domain_search` / `search_many` 相同)。
748
748
 
749
- 缓存:成功的整页正文按「URL + 输出格式 + 影响抓取的设置」缓存,最多 8 页,按最久未用淘汰;因此一页分几段读也只抓一次,只有换格式或改代理、超时、渲染设置才会重新抓。失败不缓存。`content` 里不含「还剩多少字符」那行提示,所以各段 `content` 直接拼接就是完整正文。
749
+ 缓存:成功的整页正文按「URL + 输出格式 + 影响抓取的设置」缓存,最多 8 页,按最久未用淘汰;因此一页分几段读也只抓一次,只有换格式或改代理、超时、渲染设置、AnySearch key 才会重新抓。失败不缓存。`content` 里不含「还剩多少字符」那行提示,所以各段 `content` 直接拼接就是完整正文。
750
750
 
751
751
  边界:`offset` 超过 `totalLength` 直接报错;`offset === totalLength` 视为读完,返回空 `content` 与 `nextOffset: null`;非 http/https 报错;网络、HTTP 状态或拦截失败以 `failures` 返回,不抛给宿主;调用方取消仍然抛出。切片按 JavaScript 字符串的 code unit 计数,切点落在代理对中间时回退一个 code unit,`nextOffset` 跟着回退后的边界走。
752
752
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fffangchenghao/dsh-web-search",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "DSH bundle: a key-free web search provider. Leads with the anonymous AnySearch API and falls back to public result pages (DuckDuckGo, Bing, 360), merged by reciprocal-rank fusion with a bilingual region policy, an engine cooldown and a TTL cache.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",