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.
Scrape
Section titled “Scrape”Automatically discovers items from a page and prints the generated RSS or JSON Feed to stdout. (html2rss auto is a Thor alias.)
html2rss scrape https://example.com/articles ; \html2rss scrape https://example.com/articles --format jsonfeed ; \html2rss scrape https://example.com/articles --limit 10 ; \BOTASAURUS_SCRAPER_URL="http://localhost:4010" html2rss scrape https://example.com/protected --strategy botasaurus ; \html2rss scrape https://example.com/articles --items_selector ".post-card" ; \html2rss scrape https://example.com/articles --explain ; \html2rss scrape --input sample.html ; \html2rss scrape https://example.com/articles --input sample.htmlCommand: html2rss scrape [URL]
Available options:
--strategy: Optional request strategy (auto,default,botasaurus,local_file). Defaults toauto, which chooses an available fetch path based on scrape results. Use a concrete value only for diagnosis or strategy-specific controls.--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 scrape
Section titled “URL surface guidance for scrape”scrape 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
Section titled “Failure outcomes”When no extractable items are found, scrape 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 auto exhausts the available fetch paths without 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 auto can use the companion scraper.
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 scrape 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 is a Thor alias.)
html2rss apply single.yml ; \html2rss apply feeds.yml my-first-feed ; \html2rss apply single.yml --strategy auto ; \BOTASAURUS_SCRAPER_URL="http://localhost:4010" html2rss apply single.yml --strategy botasaurus ; \html2rss apply single.yml --max-redirects 5 --max-requests 6 ; \html2rss apply single.yml --params id:42 foo:bar ; \html2rss apply single.yml --input sample.htmlCommand: html2rss apply YAML_FILE [feed_name]
Available options:
--strategy: Request strategy override (auto,default,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,default,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.
Capture records the concrete strategy that produced the draft as a top-level strategy: so later html2rss apply can reproduce that fetch path.
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
