Skip to content

Commit f28c492

Browse files
committed
docs(use-cases): sync capture, MCP logs, and Botasaurus request schema
Capture stamps strategy and supports --explain; MCP daemons log to stderr at info. Replace scroll_to_bottom with scroll and document the OpenAPI 2.0 window_size object.
1 parent 7fc7d0f commit f28c492

5 files changed

Lines changed: 26 additions & 7 deletions

File tree

src/content/docs/ruby-gem/guides/ai-agent-workflows.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,7 @@ For dynamic JavaScript single-page applications or sites protected by anti-bot m
110110
/>
111111

112112
Put `BOTASAURUS_SCRAPER_URL` (typically `http://127.0.0.1:4010`) in the MCP server `env` block above — a shell export does not reach the Cursor/Claude MCP process. Confirm with `html2rss://runtime` (`botasaurus_configured: true`). AutoFallback then hops without a second tool call.
113+
114+
## Daemon logs (stderr)
115+
116+
`html2rss mcp` uses stdout for JSON-RPC, so the daemon logs to **stderr**. Unless you set `LOG_LEVEL`, the MCP process uses `info` (the gem library default stays `warn`). A foreground watcher sees the start banner, each tool call, and pipeline fallbacks. Use `LOG_LEVEL=debug` for more detail or `LOG_LEVEL=warn` to quiet it.

src/content/docs/ruby-gem/guides/backward-compatibility.mdx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ import { Code } from "@astrojs/starlight/components";
77

88
This page outlines recent breaking changes, purged legacy aliases, and migration steps for older feed configurations.
99

10+
## Current Botasaurus request schema
11+
12+
`request.botasaurus` matches the scrape-API OpenAPI 2.0 `ScrapeRequest` (unknown keys rejected):
13+
14+
1. **`scroll`** — boolean. There is no `scroll_to_bottom` key; use `scroll: true` for infinite lists.
15+
2. **`window_size`** — object `{ width: 1920, height: 1080 }`, not a two-item array.
16+
3. **`wait_timeout_seconds`** — integer `1..20` (omit to use the scrape-API default of `15`).
17+
4. **`max_retries`** — integer `0..3` (omit to use the scrape-API default of `2`).
18+
19+
Run `html2rss validate config.yml` after editing Botasaurus options.
20+
1021
## 0.26.0
1122

1223
Upgrade notes for configs and integrators targeting gem **0.26.0**:
@@ -97,4 +108,5 @@ When upgrading to modern `html2rss` releases:
97108
4. **Move channel-level transport keys**: Ensure `strategy` and `headers` are defined at the top level of the YAML file.
98109
5. **Use `enclosure` for RSS media**: Do not rely on `image` becoming an RSS `<enclosure>`; select podcast/media URLs with `enclosure`.
99110
6. **Prefer `feed_result` for dual-format / cache**: Integrators that need RSS + JSON Feed from one scrape (or Marshal caching) should use `Html2rss.feed_result` and `status.to_h`.
100-
7. **Validate configurations**: Run `html2rss validate config.yml` to ensure your YAML conforms to the current schema.
111+
7. **Align `request.botasaurus` with OpenAPI 2.0**: Replace `scroll_to_bottom` with `scroll`, use `{ width, height }` for `window_size`, and keep `wait_timeout_seconds` in `1..20`.
112+
8. **Validate configurations**: Run `html2rss validate config.yml` to ensure your YAML conforms to the current schema.

src/content/docs/ruby-gem/guides/capturing-feed-configs.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Print YAML to stdout:
3636
html2rss capture https://example.com/articles --items_selector ".post-card"
3737
# Analyze a local HTML fixture
3838
html2rss capture https://example.com/articles --input ./page.html
39+
# Quality JSON on stderr; YAML stays on stdout
40+
html2rss capture https://example.com/articles --explain
3941
# Save the draft
4042
html2rss capture https://example.com/articles > my-feed.yml
4143
`}
@@ -46,9 +48,10 @@ Common options:
4648

4749
- `--strategy``auto`, `faraday`, `botasaurus`, or `local_file` (default `auto`)
4850
- `--items_selector` — CSS selector hint for item cards
49-
- `--limit` — maximum articles kept while deriving selectors
51+
- `--limit` — maximum articles kept while deriving selectors (default `25`)
5052
- `--max-redirects` / `--max-requests` — request budget overrides
5153
- `--input` — local HTML file (sets `local_file` strategy)
54+
- `--explain` — print capture quality JSON on stderr (`articles_count`, `channel_title`, `has_selectors`, `segment_strategy`, `selected_strategy`, `admission_drops`); YAML stays on stdout
5255

5356
See the [CLI reference](/ruby-gem/reference/cli-reference/#capture) for the full flag list.
5457

@@ -77,7 +80,7 @@ See the [CLI reference](/ruby-gem/reference/cli-reference/#capture) for the full
7780
2. **Discover** — AutoSource extracts admitted articles
7881
3. **Segment** — SST Segmenter strategies `:list``:cluster``:semantic`
7982
4. **Gate** — emit an items selector only when enough articles match
80-
5. **Assemble**`{ items: { selector:, enhance: true } }` plus channel
83+
5. **Assemble**`{ items: { selector:, enhance: true } }` plus channel. When AutoFallback selects a concrete transport (or you pin one), Capture **stamps** `strategy:` into the YAML so later `html2rss feed` / `Html2rss.feed` replay the same transport.
8184

8285
When the quality gate fails, selectors are omitted (`has_selectors: false`) rather than inventing attribute selectors. Hint with `--items_selector` or refine by hand.
8386

src/content/docs/ruby-gem/guides/custom-http-requests.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Request budgets are configured under `request`, not as top-level keys:
7373

7474
- `request.max_redirects` limits redirect hops
7575
- `request.max_requests` limits the total request budget for the feed build
76-
- `request.botasaurus.*` is reserved for Botasaurus-only behavior such as navigation mode, retries, header/cookie forwarding, and scroll options
76+
- `request.botasaurus.*` is reserved for Botasaurus-only behavior such as navigation mode, retries, header/cookie forwarding, and `scroll`
7777

7878
## Common Use Cases
7979

src/content/docs/ruby-gem/guides/handling-dynamic-content.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ When a site requires browser rendering or anti-bot bypass by default, you can ex
2222
botasaurus:
2323
navigation_mode: google_get_bypass
2424
wait_for_selector: ".article-card"
25-
scroll_to_bottom: true
25+
scroll: true
2626
channel:
2727
url: https://example.com/app
2828
selectors:
@@ -44,7 +44,7 @@ Botasaurus extraction is ideal when:
4444
- **Content loads after page load** - JavaScript fetches data dynamically
4545
- **Single Page Applications (SPAs)** - React, Vue, Angular apps
4646
- **Anti-bot interstitials** - Cloudflare, Google search referrers, or challenge pages
47-
- **Scroll-triggered content** - Infinite scroll lists (`scroll_to_bottom: true`)
47+
- **Scroll-triggered content** - Infinite scroll lists (`scroll: true`)
4848

4949
## Botasaurus Request Controls
5050

@@ -70,7 +70,7 @@ Configure browser actions under `request.botasaurus`:
7070
strategy: botasaurus
7171
request:
7272
botasaurus:
73-
scroll_to_bottom: true
73+
scroll: true
7474
`}
7575
lang="yaml"
7676
/>

0 commit comments

Comments
 (0)