WEBDUMP(1)

πŸ“¦
version 0.3 Β· 2 versions
, in nixpkgs unstable

πŸ’… WEBDUMP(1) β€” General Commands Manual πŸ’…

okay bestie, sit down, because we're about to talk about webdump and honestly? it's giving "quiet little utility that does SO much" and i'm obsessed ✨


🌸 NAME 🌸

webdump β€” convert HTML to plain-text. that's it, that's the whole vibe. HTML goes in, readable text comes out. iconic behavior fr fr πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

webdump [-8adiIlorx] [-b baseurl] [-s selector] [-u selector]
        [-w termwidth]

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: webdump reads UTF-8 HTML data from stdin, converts it, and writes the output as plain-text to stdout. it's literally a little HTML-to-text transformation station and it eats every time πŸ“

if the links in your feed are relative URLs, you can hand it a baseurl β€” but heads up, no cap: that must be an absolute URI πŸ‘‘

the options are as follows:


✨ OPTIONS ✨

  • -8 β€” use UTF-8 symbols for certain items like bullet items and rulers, so your output is ✨fancier✨. aesthetic upgrade, lowkey.
  • -a β€” toggle ANSI escape codes. this is what marks up your text with bold, italic, underline, etc. by default it is not enabled.
  • -b baseurl β€” base URL of links. it's used to make links absolute. the specified URL is always preferred over the value in a <base/> tag. main character energy: it wins every time πŸ’…
  • -d β€” deduplicate link references. when a duplicate link reference is found, reuse the same link reference number. no repeats, we love a sustainable queen 🌈
  • -i β€” toggle whether link reference numbers are displayed inline or not. by default it is not enabled.
  • -I β€” toggle whether URLs for link reference are displayed inline or not. by default it is not enabled. (yes it's a different flag from -i, look at the capitalization bestie, they are NOT twins πŸ™ˆ)
  • -l β€” toggle whether link references are displayed at the bottom or not. by default it is not enabled.
  • -o β€” toggle OSC 8 escape sequence to mark inline hyperlinks. by default it is not enabled.
⚠️ okay real talk: this feature can be insecure in some terminals. not me warning you ominously 😭 please know your terminal before you turn this on.
  • -r β€” toggle whether line-wrapping mode is enabled. by default it is not enabled. this uses the terminal width, which you can set with the -w option. wrap it up, literally 🎁
  • -s β€” CSS-like selectors. this sets a reader mode to show only content matching the selector. see the section "SELECTOR SYNTAX" for the syntax. you can specify multiple selectors by separating them with a comma. filtering, but make it fashion 🧚
  • -u β€” CSS-like selectors. this sets a reader mode to hide content matching the selector. see the section "SELECTOR SYNTAX" for the syntax. multiple selectors can be specified by separating them with a comma. blocking, but make it elegant πŸ’œ
  • -w termwidth β€” the terminal width. the default is 77 characters. yes, seventy-seven. specific king πŸ‘‘
  • -x β€” extract and write each resource (such as links and images) to file descriptor 3. the items are output per line in a TAB-separated format. the fields are: type TAB v|h TAB url NEWLINE. v or h indicates a visible or hidden element. side quest unlocked πŸ—οΈ

🌈 SELECTOR SYNTAX 🌈

some inspiration was taken from the CSS syntax, but ngl it's more limited. here's the matching rules, and yes they're specific:

  • Tag names are matched case-insensitive.
  • Classname and ID values are matched case-sensitive.

some examples, because examples are literally the best part:

  • "main" would match on the "main" tags.
  • "#someid" would match on any tag which has the id attribute set to "someid".
  • ".someclass" would match on any tag which has the class attribute set to "someclass".
  • "main#someid" would match on the "main" tag which has the id attribute set to "someid".
  • "main.someclass" would match on the "main" tags which has the class attribute set to "someclass".
  • "ul li" would match on any "li" tag which also has a parent "ul" tag.
  • "li@0" would match on any "li" tag which is also the first child element of its parent container. πŸ“Œ note that this differs from filtering on a collection of "li" elements. like, actually different. don't come for me, i'm just the messenger πŸ’€

🌟 EXIT STATUS 🌟

the webdump utility exits 0 on success, and >0 if an error occurs. simple, clean, communicates. we stan a predictable exit code 🫢


πŸ’– EXAMPLES πŸ’–

one β€” fetch a webpage using curl(1) and pipe the output to webdump enabling line-wrapping, and write output to the pager less(1):

url='https://codemadness.org/sfeed.html'
curl -s "$url" | webdump -r -b "$url" | less

two β€” pipe the HTML output to webdump enabling many options (unicode and markup, line-wrapping, link references). transform relative URLs to absolute URLs using the base URL. then pipe it to less(1) with the -R option to enable ANSI escape codes in this pager:

curl -s "$url" | webdump -8 -a -i -l -r -b "$url" | less -R

three β€” use a simple selector using the -s option to only show content in the "main" tag:

curl -s "$url" | webdump -s 'main' -8 -a -i -l -r -b "$url" | less -R

four β€” to write resources as TAB-separated lines from file descriptor 3 to a separate file while ignoring the regular standard output:

curl -s "$url" | webdump -x -b "$url" 3>urls >/dev/null

five β€” to use webdump as a HTML to text filter, for example in the mutt mail client, change in ~/.mailcap:

text/html; webdump -i -l -r < %s; needsterminal; copiousoutput

πŸ”₯ SEE ALSO πŸ”₯

curl(1), xmllint(1), xmlstarlet(1), ftp(1)

the whole friend group showed up πŸ’…


πŸ‘‘ AUTHORS πŸ‘‘

Hiltjo Posthuma <hiltjo@codemadness.org> β€” the mastermind, the moment, the icon πŸ’–


and that's the whole page bestie!! this one's brought to you by Debian, dated July 15, 2026 β€” original WEBDUMP(1) energy, general commands manual flavor, now with 100% more sparkle βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from