Skip to main content

extract

Extracts news items from an HTML page and renders them in the chosen format.

newsworker extract URL [OPTIONS]
OptionAliasDefaultDescription
--format-fjsonOutput format: json, jsonfeed, rss, atom, csv, html, markdown, yaml.
--output-o(stdout)Write the result to a file instead of printing it.
--spec-sPath to a YAML spec produced by analyze.
--limit-nMaximum number of items to emit.
--max-pages1Follow up to N "next" links, merging items across pages.
--sinceOnly items on or after this date (YYYY-MM-DD).
--untilOnly items on or before this date (YYYY-MM-DD).
--full-textfalseFollow each item link and extract the article body into content (newsworker[fulltext]).
--fileLocal HTML file (- for stdin). Requires --base-url.
--base-urlAbsolute HTTP(S) URL used to resolve links in local HTML.
--undatedfalseOpt in to the undated listing fallback.
--renderfalseForce Playwright rendering (newsworker[browser]).
--explain / --explain-jsonfalsePrint extraction diagnostics.
--user-agent(built-in)Override the User-Agent used for fetching.
--language(auto)Override the auto-detected feed language (e.g. en, fr).
--proxyProxy URL for outgoing requests.
--timeout30HTTP request timeout in seconds.
--headerExtra HTTP header Key: Value (repeatable).
--cookiesPath to a Netscape/Mozilla cookie jar file.
--insecurefalseDisable TLS certificate verification for this run.
--ignore-robotsfalseFetch even when robots.txt disallows it.
--json-logsfalseEmit logs as structured JSON.
--no-cachefalseBypass the spec and content caches for this run.
--refreshfalseForce re-fetching the page, ignoring cached content.
--config-c(default)Path to a settings YAML file.
--verbose-vfalseVerbose logging.

Examples:

newsworker extract "https://example.com/news"
newsworker extract "https://example.com/news" -f rss
newsworker extract "https://example.com/news" -f atom -o feed.xml
newsworker extract "https://example.com/news" -s example.yaml -f rss
newsworker extract --file archive/page.html --base-url https://example.com/news/ -f json

See output formats, local input, undated listings, and diagnostics.