sparser (Simple Parser) is a suckless tool that extracts external URLs from text-based files. It handles HTML, Markdown (MD/MDX), plain text, and other text files. It can process a single file, read from stdin, or recursively walk a directory tree. Outputs one URL per line to stdout.
Designed to pair with suploader for a pipeline: sparser -R /content | suploader -
All code in this project MUST follow the suckless.org coding style:
_POSIX_C_SOURCE 200809L)/* */ only, never //* adjacent to variable name: char *p, not char* pbool; use int (0/1)staticgrep ^funcname){ on its own line for functionsstaticstatic void
usage(void)
{
fprintf(stderr, "usage: sparser [-v] [-R] path\n");
exit(1);
}
{ on same line for control flow (if, for, while, switch)} on its own line unless continuing (else, do-while)_t suffix (reserved by POSIX)if, for, while, switch( or before )goto for cleanup/unwind, not nested ifsif (func() < 0)die() for fatal errors (prints message, exits)warn() for recoverable errors (prints, continues)| Module | Prefix | File | Responsibility |
|---|---|---|---|
| Main | — | sparser.c | Entry point, directory walking, file dispatch |
| Extract | extract_ |
extract.c | URL extraction from text content |
| Utilities | die, warn, x* |
util.c | Memory wrappers, string ops, error handling |
| Config | — | config.h | Compile-time constants |
make # build sparser binary
make clean # remove build artifacts
make install # install to /usr/local/bin
Dependencies: none (pure C99 + POSIX)
# Extract URLs from a single file
sparser page.html
# Recursive directory scan
sparser -R /content
# Read from stdin
cat file.md | sparser -
# Verbose (show file names being processed)
sparser -v -R /content
# Deduplicate output
sparser -u -R /content
# Pipeline with suploader
sparser -u -R /content | suploader -
Co-Authored-By: Claude lines