Skip to content

Dynamic Parameters

Use dynamic parameters when websites share the same structure but vary by URL or header values.

You can add dynamic parameters to the channel and headers values. This is useful for creating feeds from structurally similar pages with different URLs.

channel:
url: "https://domainname.tld/whatever/%<id>s.html"
headers:
X-Something: "%<foo>s"
selectors:
items:
selector: "article"
title:
selector: "h2"
url:
selector: "a"
extractor: "href"

You can then pass the values for these parameters when you run html2rss:

Terminal window
html2rss feed the_feed_config.yml --params id:42 foo:bar

  • The %<param>s syntax in the URL and headers is a placeholder for dynamic parameters.
  • You provide the actual values for these parameters at runtime using the --params option.
  • This allows you to reuse the same feed configuration for multiple similar pages or APIs.
  • Dynamic substitution applies to channel and headers. Selector definitions are not parameterized by this feature.
  • If a config references %<param>s and you do not provide a value, feed generation fails unless the caller supplies a fallback.
  • For shared config repositories such as html2rss-configs, it is common to store default parameter values alongside the config so examples, validation, and tests have concrete inputs.