openclaw-smart-fetch 0.2.22 โ†’ 0.2.24

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
@@ -1,52 +1,31 @@
1
1
  # openclaw-smart-fetch
2
2
 
3
- `openclaw-smart-fetch` adds smarter fetching tools for OpenClaw.
3
+ `openclaw-smart-fetch` adds smarter web fetching tools to OpenClaw.
4
4
 
5
- It registers:
6
- - `smart_fetch`
7
- - `batch_smart_fetch`
8
-
9
- It combines:
10
- - `@thinkscape/wreq-js` for browser-like transport fingerprints
11
- - `Defuddle` for readable content extraction
12
-
13
- ## Why use this instead of OpenClaw's built-in `web_fetch`
14
-
15
- Use this package when the built-in `web_fetch` is not enough.
5
+ ## Features
16
6
 
17
- Typical advantages:
18
- - **better resistance to bot detection** on sites that inspect TLS/HTTP client fingerprints
19
- - **more browser-like transport behavior** instead of a generic server-side HTTP client
20
- - **cleaner extracted content** instead of raw or noisy page output
21
- - **better article/document readability** for downstream agent analysis
22
- - **useful metadata** like title, author, published date, site, and language when available
23
- - **batch fan-out support** when you want to fetch multiple URLs in one tool call
24
- - **attachment and binary download support** when a server returns `Content-Disposition: attachment` or a non-text content type
25
- - **temp-file output** with sanitized filenames and file metadata instead of trying to render binary bytes as page text
7
+ - ๐Ÿ” **Browser-like TLS/SSL + HTTP fingerprints** โ€” better success on bot-defended pages
8
+ - ๐Ÿงน **Defuddle extraction** โ€” clean readable content instead of noisy HTML
9
+ - ๐Ÿง  **Useful metadata** โ€” title, author, site, language, published date when available
10
+ - ๐Ÿ“ฆ **Downloads + large file support** โ€” stream attachments and binaries to temp files
11
+ - โšก **Batch fetch** โ€” fetch many URLs with bounded concurrency
12
+ - ๐Ÿ“ **Multiple output formats** โ€” `markdown`, `html`, `text`, `json`
26
13
 
27
- A good rule of thumb:
28
- - use built-in `web_fetch` for simple pages
29
- - use `smart_fetch` when pages are blocked, noisy, or extraction quality matters
30
- - use `batch_smart_fetch` when you need the same smarter fetch behavior over many URLs at once
14
+ ## Site optimisations
31
15
 
32
- ## Bot-detection focus
16
+ This package works on general web pages, but some site types benefit especially from Defuddle's extractors and cleanup:
33
17
 
34
- These tools are aimed at sites that detect bots through:
35
- - TLS/client fingerprinting
36
- - transport/header inconsistencies
37
- - non-browser HTTP behavior
18
+ - YouTube pages and transcripts
19
+ - Reddit posts and comment threads
20
+ - X / Twitter posts
21
+ - GitHub pages, issues, PRs, and discussions
22
+ - Hacker News threads
23
+ - Substack posts
24
+ - Pages with code blocks, footnotes, math, and callouts
38
25
 
39
- They do **not** execute JavaScript or solve interactive anti-bot flows.
40
-
41
- If a page requires JS execution, login, scrolling, or clicking, use browser automation instead.
42
-
43
- ## What tools it exposes
44
-
45
- This package registers:
46
- - `smart_fetch`
47
- - `batch_smart_fetch`
48
-
49
- OpenClaw keeps separate tool names because overriding/hoisting built-in `web_fetch` is not the desired path here.
26
+ Notes:
27
+ - Defuddle is the cleanup layer: it strips common page chrome like nav, sidebars, related links, share widgets, and footers
28
+ - It does **not** execute JavaScript or solve interactive anti-bot/login flows
50
29
 
51
30
  ## Install
52
31
 
@@ -62,139 +41,58 @@ From a local checkout:
62
41
  openclaw plugins install -l /absolute/path/to/agent-smart-fetch/packages/openclaw-smart-fetch
63
42
  ```
64
43
 
65
- ## Use cases
44
+ ## OpenClaw tools
66
45
 
67
- Use `smart_fetch` when you want to:
68
- - fetch pages that reject naive HTTP clients
69
- - extract the readable body from articles, docs, and blog posts
70
- - reduce noise before passing content to an agent
71
- - preserve page metadata for summarization or research
72
- - use browser-like fetching without paying the cost of full browser automation
73
-
74
- Use `batch_smart_fetch` when you want to:
75
- - fetch multiple URLs in one tool call
76
- - preserve a clear mapping between each input URL and its result
77
- - keep full content for successes while retaining per-item error strings for failures
78
- - run bounded-concurrency fetches instead of firing everything at once
46
+ Registers:
47
+ - `smart_fetch`
48
+ - `batch_smart_fetch`
79
49
 
80
- ## Tool synopsis
50
+ Synopsis:
81
51
 
82
52
  ```text
83
- smart_fetch(url, browser?, os?, headers?, maxChars?, format?, removeImages?, includeReplies?, proxy?)
53
+ smart_fetch(url, browser?, os?, headers?, maxChars?, timeoutMs?, format?, removeImages?, includeReplies?, proxy?)
84
54
  batch_smart_fetch(requests)
85
55
  ```
86
56
 
87
- For `batch_smart_fetch`, `requests` is an array of objects, and **each item accepts the same parameters as `smart_fetch`**.
57
+ For `batch_smart_fetch`, each item in `requests` accepts the same parameters as `smart_fetch`.
88
58
 
89
- ## Example output
59
+ ## Output formats
90
60
 
91
- ### `smart_fetch`
61
+ | Format | What you get |
62
+ |---|---|
63
+ | `markdown` | Best default for readable page content |
64
+ | `html` | Cleaned HTML output |
65
+ | `text` | Plain text with markdown stripped |
66
+ | `json` | Structured JSON for metadata-heavy workflows |
92
67
 
93
- ```text
94
- > URL: https://example.com/blog/some-article
95
- > Title: Some Article
96
- > Author: Jane Doe
97
- > Published: 2026-03-12
98
- > Site: Example Blog
99
- > Language: en
100
- > Words: 1284
101
- > Browser: chrome_145/windows
102
-
103
- # Some Article
104
-
105
- This is the cleaned readable content extracted from the page.
106
- ```
68
+ ## Plugin defaults
107
69
 
108
- ### `smart_fetch` attachment/binary output
70
+ See `openclaw.plugin.json` for the schema. The effective defaults are:
109
71
 
110
- ```text
111
- > URL: https://example.com/download/report
112
- > File size: 999999
113
- > Mime type: application/pdf
114
- > File path: /absolute/path/to/temp/report.pdf
72
+ ```json
73
+ {
74
+ "maxChars": 50000,
75
+ "timeoutMs": 15000,
76
+ "browser": "chrome_145",
77
+ "os": "windows",
78
+ "removeImages": false,
79
+ "includeReplies": "extractors",
80
+ "batchConcurrency": 8,
81
+ "tempDir": "/tmp/openclaw-smart-fetch"
82
+ }
115
83
  ```
116
84
 
117
- ### `batch_smart_fetch`
118
-
119
- ```text
120
- > Requests: 2
121
- > Succeeded: 1
122
- > Failed: 1
123
- > Concurrency: 8
124
-
125
- ## [1/2] https://example.com/blog/some-article
126
- > URL: https://example.com/blog/some-article
127
- > Title: Some Article
128
- > Author: Jane Doe
129
- > Published: 2026-03-12
130
- > Site: Example Blog
131
- > Language: en
132
- > Words: 1284
133
- > Browser: chrome_145/windows
134
-
135
- # Some Article
136
-
137
- This is the cleaned readable content extracted from the page.
138
-
139
- ## [2/2] https://blocked.example/post
140
- > URL: https://blocked.example/post
141
- > Status: error
142
- > Error: HTTP 403 Forbidden for https://blocked.example/post
143
- ```
144
-
145
- ## Parameters
146
-
147
- ### `smart_fetch`
148
-
149
- | Parameter | Type | Default | Description |
150
- |-------------------|-------------------------------|-----------------|-----------------------------------------------------------|
151
- | `url` | string | required | URL to fetch |
152
- | `browser` | string | `chrome_145` | Browser profile used for transport fingerprinting |
153
- | `os` | string | `windows` | OS profile: `windows`, `macos`, `linux`, `android`, `ios` |
154
- | `headers` | object | auto | Extra request headers |
155
- | `maxChars` | number | `50000` | Maximum returned characters |
156
- | `format` | `markdown` \| `html` \| `text` \| `json` | `markdown` | Output format |
157
- | `removeImages` | boolean | `false` | Strip image references from output |
158
- | `includeReplies` | boolean \| `extractors` | `extractors` | Include replies/comments |
159
- | `proxy` | string | none | Proxy URL |
160
-
161
- ### `batch_smart_fetch`
162
-
163
- | Parameter | Type | Default | Description |
164
- |-------------|------------------|-----------|-------------|
165
- | `requests` | array of objects | required | Array of fetch requests. Each item accepts the same parameters as `smart_fetch` |
166
-
167
- ## OpenClaw config
168
-
169
- See `openclaw.plugin.json` for plugin config defaults and schema.
170
-
171
- Configurable defaults include:
172
- - `maxChars`
173
- - `timeoutMs`
174
- - `browser`
175
- - `os`
176
- - `removeImages`
177
- - `includeReplies`
178
- - `batchConcurrency`
179
- - `tempDir`
180
-
181
- `batchConcurrency` defaults to `8` and controls how many `batch_smart_fetch` requests run concurrently.
182
-
183
- `tempDir` lets the OpenClaw consumer choose where attachment/binary downloads are written before the tool returns their absolute file paths.
184
-
185
- ## When not to use it
186
-
187
- Do not use these tools when:
188
- - the page requires JS rendering
189
- - you need login/session flows
190
- - you need clicks, scrolling, or form submission
191
- - a full browser session is required
192
-
193
- In those cases, use browser automation instead.
85
+ | Setting | Default | Description |
86
+ |---|---:|---|
87
+ | `maxChars` | `50000` | Default maximum returned characters |
88
+ | `timeoutMs` | `15000` | Default request timeout in milliseconds |
89
+ | `browser` | `chrome_145` | Default browser fingerprint profile |
90
+ | `os` | `windows` | Default OS fingerprint profile |
91
+ | `removeImages` | `false` | Strip image references by default |
92
+ | `includeReplies` | `extractors` | Include replies/comments only when site extractors support them |
93
+ | `batchConcurrency` | `8` | Default bounded concurrency for `batch_smart_fetch` |
94
+ | `tempDir` | OS temp dir | Directory for attachment and binary downloads |
194
95
 
195
- ## Recent feature additions reflected here
96
+ ## Dev and publishing note
196
97
 
197
- Recent `feat:` work added:
198
- - publish-ready TS/test/build packaging workflow across the monorepo
199
- - richer animated batch progress behavior in pi-facing consumers
200
- - attachment and binary download streaming with sanitized temp-file output
98
+ This repo uses Bun for local development, tests, and workspace scripts. Package publishing still goes through `npm publish` in CI so npm Trusted Publishing can be used.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "smart-fetch",
3
3
  "name": "Smart Fetch",
4
- "version": "0.2.22",
4
+ "version": "0.2.24",
5
5
  "description": "Clean web content extraction with browser-grade TLS fingerprinting. Uses wreq-js (Rust native bindings) for anti-bot bypass and Defuddle for superior content extraction.",
6
6
  "configSchema": {
7
7
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-smart-fetch",
3
- "version": "0.2.22",
3
+ "version": "0.2.24",
4
4
  "type": "module",
5
5
  "description": "OpenClaw smart fetch plugin with browser-grade TLS fingerprinting and Defuddle extraction.",
6
6
  "license": "MIT",