Capturing Feed Configs
html2rss capture analyzes a page through the auto-source pipeline and prints a reusable YAML draft: an items selector plus enhance: true. At feed-build time, enhance: true fills missing article fields from each matched card.
When to Capture
Section titled “When to Capture”Use capture when:
- you are writing a new custom feed and want a starting YAML
- auto-source finds articles, but you want durable selectors for review
- an AI agent or MCP client should produce a config before
validate/apply
Prefer automatic feed generation when you only need items now and do not need a saved config.
Print YAML to stdout:
html2rss capture https://example.com/articles# Pin Botasaurus for JS-rendered listingsBOTASAURUS_SCRAPER_URL="http://localhost:4010" \html2rss capture https://example.com/articles --strategy botasaurus# Hint the item card when auto detection is weakhtml2rss capture https://example.com/articles --items_selector ".post-card"# Analyze a local HTML fixturehtml2rss capture https://example.com/articles --input ./page.html# Quality JSON on stderr; YAML stays on stdouthtml2rss capture https://example.com/articles --explain# Save the drafthtml2rss capture https://example.com/articles > my-feed.ymlCommon options:
--strategy—auto,faraday,botasaurus, orlocal_file(defaultauto)--items_selector— CSS selector hint for item cards--limit— maximum articles kept while deriving selectors (default25)--max-redirects/--max-requests— request budget overrides--input— local HTML file (setslocal_filestrategy)--explain— print capture quality JSON on stderr (articles_count,channel_title,has_selectors,segment_strategy,selected_strategy,admission_drops); YAML stays on stdout
See the CLI reference for the full flag list.
Ruby API
Section titled “Ruby API”require 'html2rss'# Derive a config hash (channel + items selector with enhance: true)config = Html2rss.capture('https://example.com/articles')# Pin strategy or provide an items hintconfig = Html2rss.capture( 'https://spa-site.com', strategy: :botasaurus, items_selector: '.article-card')File.write('my-feed.yml', Html2rss::Config.to_yaml(config))feed = Html2rss.feed(config)How It Works
Section titled “How It Works”- Request —
FeedPipeline(AutoFallback when:auto) - Discover — AutoSource extracts admitted articles
- Segment — SST Segmenter strategies
:list→:cluster→:semantic - Gate — emit an items selector only when enough articles match
- Assemble —
{ items: { selector:, enhance: true } }plus channel. When AutoFallback selects a concrete transport (or you pin one), Capture stampsstrategy:into the YAML so laterhtml2rss apply/Html2rss.feedreplay the same transport.
When the quality gate fails, selectors are omitted (has_selectors: false) rather than inventing attribute selectors. Hint with --items_selector or refine by hand.
What Capture Derives
Section titled “What Capture Derives”Capture focuses on:
channel.url(and related channel defaults)selectors.itemswithenhance: true
It does not invent per-field title/url/description selectors, author, published_at, categories, or enclosure selectors. enhance: true fills missing article fields via the HTML article extractor at feed-build time.
MCP capture returns that YAML in payload.yaml. validate / apply accept the YAML string (XOR a config hash). apply is isError when the feed has zero items (payload.item_count).
Recommended Follow-Up
Section titled “Recommended Follow-Up”- Validate:
html2rss validate my-feed.yml - Render:
html2rss apply my-feed.yml - Tighten the items selector, strategy, or
request.botasaurusoptions if needed - For Feed Directory contributions, add
directory.topicsand keepenhance: trueunless chrome leaks (see Creating Custom Feeds)
