sbot (Simple Archiver Bot) is a suckless web archiver written in C. It creates self-contained archives of websites with all resources (CSS, images, fonts) inlined as data URIs. Supports single-page archival in GWTAR (Gwern Web Tar Archive) format and recursive whole-site archival with navigable directory structure.
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: sbot [-v] [-r] url\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 | — | archiver.c | Entry point, page archiving, CSS inlining, link rewriting, crawl orchestration |
| Crawler | queue_, visited_ |
crawl.c | URL queue (BFS), visited set, URL normalization, path conversion |
| Fetcher | fetch_ |
fetch.c | HTTP fetching via libcurl, response management |
| Parser | reslist_, parse_ |
parse.c | HTML parsing, resource extraction, image inlining |
| Robots | robots_ |
robots.c | robots.txt fetching, parsing, and rule matching |
| Detect | detect_, siteinfo_ |
detect.c | CMS/framework detection (WordPress, Blogger, Hugo, Jekyll, Ghost, Drupal, MediaWiki) |
| Utilities | die, warn, x*, str_*, url_* |
util.c | Memory wrappers, string ops, URL helpers, base64, MIME types |
| Config | — | config.h | Compile-time constants (timeouts, limits, user agent) |
system() calls. Direct file I/O and libcurl only.make # build sbot binary
make clean # remove build artifacts
make install # install to /usr/local/bin
Dependencies: libcurl (via pkg-config)
# Single page archive (GWTAR format)
sbot https://example.com/article
# Whole site (recursive, depth 3)
sbot -r -d 3 https://example.com
# Verbose with custom output dir
sbot -v -r -o ./archive https://example.com
Co-Authored-By: Claude lines