CLI Reference
This page documents the html2rss command-line interface (CLI).
For detailed documentation on the Ruby API, please refer to the official YARD documentation.
📚 View the Ruby API Docs on rubydoc.info
Commands
Section titled “Commands”The html2rss executable is the primary way to interact with the gem from your terminal.
Automatically discovers items from a page and prints the generated RSS or JSONFeed to stdout.
html2rss auto https://example.com/articles ; \html2rss auto https://example.com/articles --format jsonfeed ; \html2rss auto https://example.com/articles --limit 10 ; \BOTASAURUS_SCRAPER_URL="http://localhost:4010" html2rss auto https://example.com/protected --strategy botasaurus ; \html2rss auto https://example.com/articles --items_selector ".post-card" ; \html2rss auto https://example.com/articles --explain ; \html2rss auto --input sample.html ; \html2rss auto https://example.com/articles --input sample.htmlCommand: html2rss auto [URL]
Available options:
--strategy: Optional request strategy (auto,faraday,botasaurus,local_file). Defaults toauto, which triesfaraday->botasaurus.--format: Output format for the auto-sourced feed (rssorjsonfeed). Defaults torss.--limit: Maximum number of articles to extract during discovery (defaults to25).--items_selector: Optional CSS selector hint for item extraction.--max-redirects: Maximum redirects to follow per request.--max-requests: Maximum requests to allow for this feed build (defaults to4for auto discovery).--input: Local HTML file path to read input from without making network requests. When provided without aURL,html2rssattempts to detect the base URL from<link rel="canonical">or OpenGraph metadata in the HTML.--explain: PrintHtml2rss::StatusJSON to stderr (version,dedup_dropped, and when presentscraper_tallies,selected_strategy,attempt_count,strategy_attempts,admission_drops,entry_url,scrape_url,entry_resolution). Stdout stays the RSS or JSON Feed.
URL Surface Guidance For auto
Section titled “URL Surface Guidance For auto”auto works best when the input URL already exposes a server-rendered list of entries.
- High-success surfaces:
- newsroom or press listing pages
- blog/category/tag listing pages
- changelog/release notes/update listing pages
- paginated archive/list views
- Low-success surfaces:
- generic homepages with heavy promo/navigation chrome
- search results pages
- client-rendered app shells (
#app,#root,#__next, etc.)
When possible, pass a direct listing/update URL instead of a top-level homepage or app entrypoint.
Failure Outcomes You Should Expect
Section titled “Failure Outcomes You Should Expect”When no extractable items are found, auto classifies likely causes instead of only returning a generic message:
blocked surface likely (anti-bot or interstitial):- try a more specific public listing URL or configure
BOTASAURUS_SCRAPER_URL
- try a more specific public listing URL or configure
app-shell surface detected:- switch to a direct listing/update URL or configure
BOTASAURUS_SCRAPER_URL
- switch to a direct listing/update URL or configure
unsupported extraction surface for auto mode:- switch to listing/changelog/category URLs
- use explicit selectors in a feed config
Known anti-bot interstitial responses (for example Cloudflare challenge pages) are surfaced explicitly as blocked-surface errors.
If all fallback tiers run but still extract zero items, html2rss raises:
No RSS feed items extracted after auto fallback ...
If failures continue after URL/surface fixes, ensure BOTASAURUS_SCRAPER_URL is set so the auto Botasaurus tier can run.
Start by changing the input URL to a direct listing/update page, then move to explicit selectors if needed.
Botasaurus Environment Requirement (CLI)
Section titled “Botasaurus Environment Requirement (CLI)”botasaurus is an explicit strategy option for CLI usage and requires BOTASAURUS_SCRAPER_URL:
BOTASAURUS_SCRAPER_URL="http://localhost:4010" \html2rss auto https://example.com/updates --strategy botasaurusIf you see a Botasaurus configuration error, check:
BOTASAURUS_SCRAPER_URLis setBOTASAURUS_SCRAPER_URLis a valid URL- the Botasaurus scrape API is reachable from the shell environment running
html2rss
Loads a YAML config, builds the feed, and prints the RSS XML to stdout.
html2rss feed single.yml ; \html2rss feed feeds.yml my-first-feed ; \html2rss feed single.yml --strategy auto ; \BOTASAURUS_SCRAPER_URL="http://localhost:4010" html2rss feed single.yml --strategy botasaurus ; \html2rss feed single.yml --max-redirects 5 --max-requests 6 ; \html2rss feed single.yml --params id:42 foo:bar ; \html2rss feed single.yml --input sample.htmlCommand: html2rss feed YAML_FILE [feed_name]
Available options:
--strategy: Request strategy override (auto,faraday,botasaurus,local_file).--params: Dynamic parameters passed as key-value pairs (e.g.--params id:42 section:news).--max-redirects: Maximum redirects to follow per request.--max-requests: Total request budget allowed for this feed build.--input: Local HTML file path to read input from instead of making a network request.
The CLI keeps strategy as a top-level override and writes runtime request limits into the generated config under request.
Capture
Section titled “Capture”Analyzes a URL using auto-source structural analysis and prints a reusable YAML feed configuration (items selector + enhance: true) to stdout.
html2rss capture https://example.com/articles ; \html2rss capture https://example.com/articles --strategy botasaurus ; \html2rss capture https://example.com/articles --items_selector ".post-card" ; \html2rss capture https://example.com/articles --explain ; \html2rss capture --input sample.htmlCommand: html2rss capture [URL]
Available options:
--strategy: Optional request strategy (auto,faraday,botasaurus,local_file). Defaults toauto.--items_selector: Optional CSS selector hint for item extraction.--limit: Maximum number of articles to keep (defaults to25).--max-redirects: Maximum redirects to follow per request.--max-requests: Maximum requests to allow for this feed build.--input: Local HTML file path to read input from without making network requests.--explain: Print capture quality JSON to stderr (articles_count,channel_title,has_selectors,segment_strategy,selected_strategy,admission_drops). Stdout stays YAML.
When AutoFallback (or a pinned strategy) selects a concrete transport, the printed YAML includes a top-level strategy: so later html2rss feed uses the same hop.
Starts the Model Context Protocol (MCP) server for integration with AI clients and agent workflows (Cursor, Claude Desktop, Copilot).
html2rss mcp ; \html2rss mcp --transport stdio ; \html2rss mcp --transport http --port 8080Command: html2rss mcp
Available options:
--transport: MCP transport protocol (stdioorhttp). Defaults tostdio.--port: Port for HTTP transport (default:8080). Bound strictly to127.0.0.1(loopback only).
HTTP transport requires the rack, rackup, and webrick gems. MCP daemon logging (stderr, LOG_LEVEL) is documented in the MCP Server Reference. See also the AI Agent Workflows Guide for client setup and tool schemas.
Schema
Section titled “Schema”Prints or writes the exported JSON Schema for the current gem version.
html2rss schema ; \html2rss schema --no-pretty ; \html2rss schema --write tmp/html2rss-config.schema.jsonCommand: html2rss schema
Available options:
--pretty/--no-pretty: Pretty-print the schema JSON (default:true).--write PATH: Write the schema JSON directly to the given file path, creating any missing parent directories.
Validate
Section titled “Validate”Validates a config with the runtime validator without generating a feed.
html2rss validate single.yml ; \html2rss validate feeds.yml my-first-feed ; \html2rss validate single.yml --params id:42Command: html2rss validate YAML_FILE [feed_name]
Available options:
--params: Dynamic parameters to interpolate before validation (default:{}).
Displays the help message with available commands and options.
Command: html2rss help
Version
Section titled “Version”Displays the installed version of html2rss.
Command: html2rss --version
