Capturing Feed Configs
html2rss capture analyzes a page through the auto-source pipeline and prints a reusable feed config with derived CSS selectors. Use it when you want a first draft faster than hand-writing selectors from scratch.
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# 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--max-redirects/--max-requests— request budget overrides--input— local HTML file (setslocal_filestrategy)
See the CLI reference for the full flag list.
Ruby API
Section titled “Ruby API”require 'html2rss'require 'yaml'# Derive a config hash (:channel and :selectors)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')# Serialize with string keys (same wire form as hand-written YAML)File.write( 'my-feed.yml', YAML.dump(Html2rss::HashUtil.deep_stringify_keys(config)))# Use immediatelyfeed = Html2rss.feed(config)How It Works
Section titled “How It Works”- Request — fetches the page with the chosen strategy
- Discover — runs AutoSource to extract articles
- Analyze — normalizes the page into an SST document and maps segment positions back to articles
- Derive — builds CSS selectors from SST tag paths for items, title, link, and description
- Assemble — returns a config hash ready for YAML or
Html2rss.feed
Capture segment discovery currently uses the list Segmenter strategy only (not AutoSource cluster/semantic heuristics). When the draft is weak, pass --items_selector or refine selectors by hand.
What Capture Derives
Section titled “What Capture Derives”Capture focuses on:
channel.url(and related channel defaults)selectors.itemsselectors.titleselectors.url(derived href selector)selectors.descriptionwhen a distinct description root exists
It does not invent author, published_at, categories, or enclosure selectors. Add those manually when the page exposes them reliably.
Description is omitted when it would resolve to the invalid CSS selector . (item root equals description root).
Recommended Follow-Up
Section titled “Recommended Follow-Up”- Validate:
html2rss validate my-feed.yml - Render:
html2rss feed my-feed.yml - Tighten selectors, strategy, or
request.botasaurusoptions if needed - For Feed Directory contributions, add
directory.topics(see Creating Custom Feeds)
