### Install govulncheck v1.7.0 Source: https://github.com/4q4r/wauploader/blob/main/docs/lint.md Install govulncheck v1.7.0 with the same pairing rule as golangci-lint: the binary must match the Go toolchain. ```sh go install golang.org/x/vuln/cmd/govulncheck@v1.7.0 ``` -------------------------------- ### Console output examples for save results Source: https://github.com/4q4r/wauploader/blob/main/docs/plan.md Example console messages for save operations. Success shows ✓ Сохранено with URL and archive link. Blocked URL shows ✗ Ошибка (error:blocked-url). Daily quota exceeded shows ? Квота исчерпана (error:too-many-daily-captures). Final summary line: Итог: сохранено N · пропущено N · отложено N · ошибок N. ```text ✓ Сохранено: https://example.com → https://web.archive.org/web/20260101010101/https://example.com ✗ Ошибка (error:blocked-url): https://… — URL в блок-листе Wayback ? Квота исчерпана (error:too-many-daily-captures) — задача отложена до завтра Итог: сохранено N · пропущено N · отложено N · ошибок N ``` -------------------------------- ### Reinstall golangci-lint with matching toolchain Source: https://github.com/4q4r/wauploader/blob/main/docs/lint.md Install golangci-lint v2.14.0 using the repo's own Go toolchain or the official install script. The binary must be built with the same Go version as the module (go 1.27) to avoid typecheck errors. ```sh # with the repo's own toolchain (recommended): go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.14.0 # or the official install script, pinned: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \ | sh -s -- -b "$(go env GOPATH)/bin" v2.14.0 golangci-lint version # must print v2.14.0 built with go1.27.x ``` -------------------------------- ### curl GET /save/ with cookies Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r1-spn2-report.md Anonymous GET capture that runs inline and redirects to the capture page. Extract snapshot URL from response headers Content-Location, Link rel="memento", or X-Cache-Key. Requires logged-in cookies for authenticated use. ```bash curl -X GET -H "Accept: application/json" --cookie "logged-in-sig=...;logged-in-user=..." https://web.archive.org/save/http://brewster.kahle.org/ ``` -------------------------------- ### Check golangci-lint version Source: https://github.com/4q4r/wauploader/blob/main/docs/lint.md Verify the installed golangci-lint version and its embedded Go toolchain. The binary must match the repo's Go version to avoid phantom typecheck errors. ```text golangci-lint has version 2.14.0 built with go1.27.2-... linux/amd64 ``` -------------------------------- ### GET /save/status/system Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r1-spn2-report.md Retrieves the system status of Save Page Now. Returns an ok status or an overload message, and may return HTTP 502 on critical problems. ```APIDOC ## [GET] /save/status/system ### Description Retrieves the system status of Save Page Now. Returns an ok status or an overload message, and may return HTTP 502 on critical problems. ### Method GET ### Endpoint /save/status/system ### Request Example GET /save/status/system ### Response #### Success Response (200) - **status** (string) - Either "ok" or a message indicating temporary overload. #### Response Example { "status": "ok" } #### Error Response (502) - **status** (string) - Message indicating a critical problem. #### Response Example { "status": "Save Page Now servers are temporarily overloaded. Your captures may be delayed." } ``` -------------------------------- ### wauploader status Source: https://github.com/4q4r/wauploader/blob/main/README.md Get the status of one SPN2 job, the user session, or the service. Exactly one selector is required. ```APIDOC ## [CLI] wauploader status [JOB_ID | --user | --system] ### Description Get the status of one SPN2 job, of the user session (`--user`) or of the service (`--system`). Exactly one selector is required. ### Usage ```bash wauploader status JOB_ID wauploader status --user wauploader status --system ``` ### Parameters #### Selectors - `JOB_ID` (string) - Required - The status of one SPN2 capture job. - `--user` (flag) - Required - The SPN2 session: how many jobs are available and how many are running. - `--system` (flag) - Required - The state of the SPN2 service. ### Response - For `JOB_ID`: status of the specified job. - For `--user`: number of available and running jobs. - For `--system`: state of the SPN2 service. ``` -------------------------------- ### GET /save/status/user Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r1-spn2-report.md Retrieves the user's current quota and processing count. A cache-buster query parameter is recommended to avoid stale responses. ```APIDOC ## [GET] /save/status/user ### Description Retrieves the user's current quota and processing count. A cache-buster query parameter is recommended to avoid stale responses. ### Method GET ### Endpoint /save/status/user ### Parameters #### Query Parameters - **_t** (integer) - Optional - Cache-buster (e.g., current epoch time) to avoid stale cache responses. ### Request Example GET /save/status/user?_t= ### Response #### Success Response (200) - **available** (integer) - Number of available captures. - **processing** (integer) - Number of captures currently processing. #### Response Example { "available": 12, "processing": 3 } ``` -------------------------------- ### GET /save/ Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r1-spn2-report.md Old-style endpoint to save a page anonymously. Runs the capture inline and returns a redirect to the capture page; the snapshot URL can be extracted from response headers. ```APIDOC ## [GET] /save/ ### Description Old-style endpoint to save a page anonymously. Runs the capture inline and returns a redirect to the capture page; the snapshot URL can be extracted from response headers. ### Method GET ### Endpoint https://web.archive.org/save/ ### Parameters #### Path Parameters - **URL** (string) - Required - The URL of the page to save. ### Request Example ``` curl -X GET -H "Accept: application/json" --cookie "logged-in-sig=...;logged-in-user=..." https://web.archive.org/save/http://brewster.kahle.org/ ``` ### Response #### Success Response (200) - **Content-Location** (string) - The snapshot URL in the format `/web/<14-digit-ts>/`. - **Link** (string) - Memento link header. - **X-Cache-Key** (string) - Cache key for the snapshot. #### Response Example ``` HTTP/1.1 302 Found Location: https://web.archive.org/web/20230101000000/http://example.com/ Content-Location: /web/20230101000000/http://example.com/ Link: ; rel="memento" X-Cache-Key: example.com ``` ### Error Handling - **429** - Rate limit exceeded (anonymous saves limited). - **509** - Session limit reached. - **RobotAccessControlException** - Robots.txt denial (soft-fail). ``` -------------------------------- ### Pre-flight check (GET s3.us.archive.org/?check_limit=1) Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r2-ia-s3-report.md Check if the account is over the upload limit before uploading. ```APIDOC ## [GET] s3.us.archive.org/?check_limit=1 ### Description Checks whether the account has exceeded its upload limit. Poll this endpoint before uploading. ### Method GET ### Endpoint https://s3.us.archive.org/?check_limit=1&accesskey=&bucket= ### Parameters #### Query Parameters - **check_limit** (integer) - Required - Set to 1. - **accesskey** (string) - Required - S3 access key. - **bucket** (string) - Required - Item identifier. ### Request Example (No request body.) ### Response #### Success Response (200) - **over_limit** (boolean) - True if the account is over the limit. #### Response Example { "over_limit": false } ``` -------------------------------- ### GET /services/tasks.php (List Tasks) Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r2-ia-s3-report.md Lists tasks by category (summary, catalog, history) with filtering criteria. Supports paging and streaming via limit=0. ```APIDOC ## [GET] /services/tasks.php ### Description Lists tasks by category (summary, catalog, history) with filtering criteria. Supports paging and streaming via limit=0. ### Method GET ### Endpoint https://archive.org/services/tasks.php ### Parameters #### Query Parameters - **identifier** (string) - Optional - Item identifier; required for history category; wildcard allowed except in history. - **task_id** (int) - Optional - Task ID; required for history category. - **server** (string) - Optional - Server name. - **cmd** (string) - Optional - Command name (e.g., archive.php, modify_xml.php, derive.php). - **args** (string) - Optional - Arguments. - **submitter** (string) - Optional - Submitter. - **priority** (int) - Optional - Priority (10..-10). - **wait_admin** (int) - Optional - Run state: 0=Queued, 1=Running, 2=Error, 9=Paused. - **status** (string) - Optional - Status. - **color** (string) - Optional - Color. - **submittime>** (datetime) - Optional - Submit time greater than. - **submittime<** (datetime) - Optional - Submit time less than. - **submittime>=** (datetime) - Optional - Submit time greater than or equal. - **submittime<=** (datetime) - Optional - Submit time less than or equal. - **summary** (int) - Optional - Set to 0 to exclude summary; default 1. - **catalog** (int) - Optional - Set to 1 to include catalog tasks. - **history** (int) - Optional - Set to 1 to include history tasks. - **limit** (int) - Optional - Page size (default 50, max 500); set to 0 for streaming. - **cursor** (string) - Optional - Opaque cursor for paging; URL-encode colon. - **rate_limits** (int) - Optional - Set to 1 to get rate limit info. - **task_log** (int) - Optional - Task ID to fetch log. ### Request Example GET https://archive.org/services/tasks.php?identifier=example&catalog=1&history=1 ### Response #### Success Response (200) - **success** (bool) - Indicates success. - **error** (string) - Error message if any. - **value** (object) - Contains task data; may include cursor for paging. #### Response Example { "success": true, "value": { "summary": { "queued": 1, "running": 2, "error": 0, "paused": 0 }, "catalog": [ { "task_id": 123, "cmd": "derive.php", "wait_admin": 0 } ], "history": [ { "task_id": 124, "cmd": "derive.php", "wait_admin": 2 } ], "cursor": "c:123456" } } ### Notes - Categories: summary (default), catalog, history. Combine with catalog=1&history=1. - Criteria are AND-combined; one value each; wildcard * or % allowed except in history. - History category requires identifier or task_id; identifier may not be wildcarded. - Paging: repeat identical request with cursor until no cursor returned. - limit=0 returns JSON Lines stream; each line has extra category field. - Run states: wait_admin 0=Queued, 1=Running, 2=Error, 9=Paused. - Rate limits: GET ?rate_limits=1&cmd=derive.php returns task_limits, tasks_inflight, tasks_blocked_by_offline. - Task log: GET ?task_log= returns text/plain with Last-Modified; 404 if not found; partial logs while running; owner-only. ``` -------------------------------- ### GET /save/status/{job_id} Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r3-priorart-report.md Polls the status of a previously submitted capture job. The client should poll this endpoint rather than holding a long timeout. ```APIDOC ## [GET] /save/status/{job_id} ### Description Polls the status of a previously submitted capture job. The client should poll this endpoint rather than holding a long timeout. ### Method GET ### Endpoint https://web.archive.org/save/status/{job_id} ### Parameters #### Path Parameters - **job_id** (string) - Required - The job ID returned from POST /save ### Request Example GET /save/status/abc123 ### Response #### Success Response (200) - **status** (string) - Status of the capture job (e.g., "pending", "success", "error") - **status_ext** (string) - Extended status code - **message** (string) - Human-readable message #### Response Example { "status": "success", "status_ext": "success", "message": "Capture completed" } ### Error Handling - **Job not found**: Returns an error if the job_id is invalid or expired. ``` -------------------------------- ### GET /metadata//metadata Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r2-ia-s3-report.md Reads only the metadata portion of an item. Useful for partial reads. ```APIDOC ## [GET] /metadata//metadata ### Description Reads only the metadata portion of an item. Useful for partial reads. ### Method GET ### Endpoint https://archive.org/metadata//metadata ### Parameters #### Path Parameters - **identifier** (string) - Required - The item identifier. ### Response #### Success Response (200) - **metadata** (object) - Item metadata. #### Response Example { "metadata": {} } ``` -------------------------------- ### GET /metadata/ Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r2-ia-s3-report.md Reads metadata and file listing for an item. Public for public items; requires authentication for restricted items. ```APIDOC ## [GET] /metadata/ ### Description Reads metadata and file listing for an item. Public for public items; requires authentication for restricted items. ### Method GET ### Endpoint https://archive.org/metadata/ ### Parameters #### Path Parameters - **identifier** (string) - Required - The item identifier. ### Response #### Success Response (200) - **metadata** (object) - Item metadata. - **files** (array) - List of files, each with fields: name, source, format, mtime, size, md5, crc32, sha1, etc. - **item_size** (number) - Total size of the item. - **files_count** (number) - Number of files. - **server** (string) - Server name. - **d1/d2** (string) - Data nodes. - **dir** (string) - Directory. - **workable_servers** (array) - List of workable servers. #### Response Example { "metadata": {}, "files": [], "item_size": 0, "files_count": 0, "server": "", "d1": "", "d2": "", "dir": "", "workable_servers": [] } ``` -------------------------------- ### GET /services/user.php?op=whoami Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r2-ia-s3-report.md Validate S3 keys without side effects by retrieving account information. This endpoint is used to check if provided keys are valid. ```APIDOC ## [GET] /services/user.php?op=whoami ### Description Validate S3 keys without side effects by retrieving account information. This endpoint is used to check if provided keys are valid. ### Method GET ### Endpoint https://archive.org/services/user.php?op=whoami ### Parameters #### Authentication - Requires S3 keys (low auth) - Required - S3 access and secret keys for authentication. ### Response #### Success Response (200) - **success** (boolean) - Indicates if the keys are valid. - **account** (object) - Account information. #### Response Example ```json { "success": true, "account": { "id": 12345, "screenname": "username" } } ``` ``` -------------------------------- ### GET /metadata//files/12 Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r2-ia-s3-report.md Reads a specific file by index from the files array. Useful for partial reads. ```APIDOC ## [GET] /metadata//files/12 ### Description Reads a specific file by index from the files array. Useful for partial reads. ### Method GET ### Endpoint https://archive.org/metadata//files/12 ### Parameters #### Path Parameters - **identifier** (string) - Required - The item identifier. - **index** (integer) - Required - The index of the file in the files array. ### Response #### Success Response (200) - **file** (object) - The file object at the given index. #### Response Example { "name": "", "source": "", "format": "", "mtime": "", "size": "", "md5": "", "crc32": "", "sha1": "" } ``` -------------------------------- ### GET /metadata/ Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r2-ia-s3-report.md Retrieve metadata for an item, including file checksums (md5, crc32, sha1, size) for post-upload verification. ```APIDOC ## [GET] /metadata/ ### Description Retrieve metadata for an item, including file checksums (md5, crc32, sha1, size) for post-upload verification. ### Method GET ### Endpoint `https://archive.org/metadata/` ### Parameters #### Path Parameters - **id** (string) - Required - The item identifier. ### Response #### Success Response (200) - **files** (array) - List of file objects. - **md5** (string) - MD5 checksum. - **crc32** (string) - CRC32 checksum. - **sha1** (string) - SHA1 checksum. - **size** (number) - File size in bytes. #### Response Example ```json { "files": [ { "md5": "d41d8cd98f00b204e9800998ecf8427e", "crc32": "00000000", "sha1": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "size": 0 } ] } ``` ``` -------------------------------- ### Metadata Read (GET /metadata/) Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r2-ia-s3-report.md Retrieve metadata for an Internet Archive item. Accepts either S3 keys or Internet Archive cookies for authentication, especially for restricted items. ```APIDOC ## [GET] /metadata/ ### Description Fetches metadata for a specified item. Authentication can be via S3 keys or cookies. ### Method GET ### Endpoint https://archive.org/metadata/ ### Parameters #### Path Parameters - **id** (string) - Required - The item identifier. #### Authentication - **S3 keys** - Required for restricted items - Provide via `access` and `secret` query parameters or headers. - **Cookies** - Accepted - Provide `logged-in-user` and `logged-in-sig` cookies. ### Request Example (No request body.) ### Response #### Success Response (200) - **metadata** (object) - Item metadata. - **files** (array) - List of files with `md5`, `crc32`, `sha1` fields. #### Response Example { "metadata": {}, "files": [ { "name": "file.txt", "md5": "...", "crc32": "...", "sha1": "..." } ] } ``` -------------------------------- ### Build and version check Source: https://github.com/4q4r/wauploader/blob/main/README.md Clones the repository, builds a static binary with CGO disabled, and prints the version. ```sh git clone https://github.com/4q4r/wauploader && cd wauploader make build # → ./wauploader (static binary, CGO_ENABLED=0) ./wauploader version ``` -------------------------------- ### wauploader init Source: https://github.com/4q4r/wauploader/blob/main/README.md Interactive login with email + password that writes the keys into the config. ```APIDOC ## [CLI] wauploader init ### Description Interactive login with email + password that writes the keys into the config. ### Usage ```bash wauploader init ``` ### Parameters None. ### Response Writes keys into the config. ``` -------------------------------- ### Make help and gate commands Source: https://github.com/4q4r/wauploader/blob/main/README.md Lists the available make targets and runs the full gate (check → vet → lint → test → vuln). Each step is its own blocking command. ```sh make help # list the targets make gate # FULL GATE: check → vet → lint → test → vuln (each step is its own blocking command) ``` -------------------------------- ### Batch upload with --auto-meta Source: https://github.com/4q4r/wauploader/blob/main/README.md Uploads PDFs with metadata derived from the file itself. Requires poppler-utils (pdfinfo, pdftotext) in PATH; without them the command fails with an explanation. Use --dry-run to preview the plan without network or journal changes. ```bash wauploader upload --auto-meta --identifier-scheme dir-nn-slug \ --collection opensource --mediatype texts --dry-run ./papers/*.pdf ``` -------------------------------- ### Upload directory tree with --key-from Source: https://github.com/4q4r/wauploader/blob/main/README.md Uploads a whole directory tree into one archive.org item, computing a key for every file using the {Path} placeholder. The directory name survives because the default base directory is the common parent of the given targets. Use --dry-run to preview the per-file plan before the live upload. ```bash wauploader upload ~/datasets/reports \ --item reports-dataset-2026 \ --key-from "{Path}" \ --collection opensource --mediatype data --dry-run ``` -------------------------------- ### Sketch go.mod for wauploader Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r4-libs-report.md Proposed go.mod for the wauploader module, specifying Go 1.27 and dependencies with versions. Exact versions resolve at build time; listed versions are today's verified latest and the compatibility floor. Note: go 1.27 assumes owner machines run 1.27.x; if older toolchains matter, drop to go 1.24. ```go module github.com/4q4r/wauploader go 1.27 // owner machines run go 1.27.x; Transport.Protocols needs ≥1.24 require ( github.com/google/uuid v1.6.0 github.com/pelletier/go-toml/v2 v2.4.3 github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.12.1 // test-only github.com/vbauerster/mpb/v8 v8.16.2 go.etcd.io/bbolt v1.5.0 golang.org/x/sync v0.24.0 golang.org/x/term v0.47.0 golang.org/x/time v0.16.0 ) ``` -------------------------------- ### Makefile lint target Source: https://github.com/4q4r/wauploader/blob/main/docs/plan.md Runs golangci-lint. ```makefile golangci-lint run ``` -------------------------------- ### CLI command surface for wauploader Source: https://github.com/4q4r/wauploader/blob/main/docs/plan.md Final CLI surface produced by Task 12. Commands: init, save, upload, status, jobs. Global flags --json and --dry-run. Exit codes: 0 all succeeded, 1 some failed/parked, 2 config/usage error, 3 auth error. --list FILE accepts one target per line, # comments, blank lines skipped. ```text wauploader init # Task 5 wauploader save (URL... | --list FILE) [save flags] # flags mirror spn2.Options 1:1: --capture-all --capture-outlinks --capture-screenshot --delay-wb-availability --force-get --skip-first-archive --outlinks-availability --email-result --if-not-archived-within DURATION --js-behavior-timeout N --capture-cookie COOKIE --use-user-agent UA --target-username U --target-password P --force # re-run even if journal says done wauploader upload (FILE... | --list FILE) --item ID [--key NAME] [upload flags] --collection C --mediatype M # required (fail-fast), no defaults (owner decision) --meta NAME=VALUE (repeatable) --title T --description D --no-derive --no-keep-old-version --interactive-priority --ignore-preexisting-bucket --verify --wait-derive --checksum-skip --identifier-from PATH_TEMPLATE # optional; else --item required wauploader status [JOB_ID | --user | --system] wauploader jobs [--state failed|queued|pending|done] [--clear] ``` -------------------------------- ### Makefile build target Source: https://github.com/4q4r/wauploader/blob/main/docs/plan.md Build target for wauploader. Uses CGO_ENABLED=0, trims path, sets version via -ldflags with -X ...version.Version=$(VER). ```makefile CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X ...version.Version=$(VER)" ``` -------------------------------- ### wauploader version Source: https://github.com/4q4r/wauploader/blob/main/README.md Display the build version. Also available as `wauploader -v` / `wauploader --version`. ```APIDOC ## [CLI] wauploader version ### Description Display the build version. Also available as `wauploader -v` / `wauploader --version`. ### Usage ```bash wauploader version wauploader -v wauploader --version ``` ### Parameters None. ### Response The build version. ``` -------------------------------- ### DetectUnknownKeys function signature Source: https://github.com/4q4r/wauploader/blob/main/docs/plan.md Declares the function that detects unknown configuration keys by decoding into a map and diffing against known key paths. ```go func DetectUnknownKeys(path string) ([]string, error) ``` -------------------------------- ### Config struct definition Source: https://github.com/4q4r/wauploader/blob/main/docs/plan.md Defines the main configuration structure with nested configs for auth, SPN2, upload, limits, and console. Includes comments describing field types and defaults. ```go type Config struct { Auth AuthConfig // s3_access, s3_secret, cookie_user, cookie_sig SPN2 SPN2Config // if_not_archived_within string; capture_all, capture_outlinks, capture_screenshot, delay_wb_availability, force_get, skip_first_archive, outlinks_availability, email_result bool; js_behavior_timeout int (default 5); auth_mode string ∈ {"auto","keys","cookies"} (default "auto": keys when present, else cookies) Upload UploadConfig // collection, mediatype string (REQUIRED, no defaults); queue_derive bool (default true); keep_old_version bool (default true); interactive_priority bool (default false) Limits LimitsConfig // save_per_minute (default 5), save_concurrency (default 4), upload_concurrency (default 2), per_host_concurrency (default 3), job_wait (default "20m") Console ConsoleConfig // reserved (color handled by flags/env) } ``` -------------------------------- ### wauploader upload --auto-meta Source: https://github.com/4q4r/wauploader/blob/main/README.md Batch upload PDFs with metadata derived from the file itself. Requires poppler-utils in PATH. ```APIDOC ## [CLI] wauploader upload --auto-meta ### Description Batch upload of PDFs with automatic metadata: 1 PDF = 1 item, everything in the item is derived from the file itself. Requires poppler-utils (pdfinfo, pdftotext) in PATH. ### Usage ```bash wauploader upload --auto-meta --identifier-scheme dir-nn-slug \ --collection opensource --mediatype texts --dry-run ./papers/*.pdf ``` ### Parameters #### Flags - `--auto-meta` (flag) - Required - Enable automatic metadata derivation from the PDF. - `--identifier-scheme` (string) - Required - Identifier scheme, e.g. `dir-nn-slug`. - `--collection` (string) - Required - Collection name. - `--mediatype` (string) - Required - Media type, e.g. `texts`. - `--dry-run` (flag) - Optional - Show the full plan without network or journal changes. - `--creator-source` (string) - Optional - Source for creator: `file` (default), `pdf`, or `both`. - `--title` (string) - Optional - Override derived title. - `--description` (string) - Optional - Override derived description. - `--meta` (string) - Optional - Override metadata by name (e.g. `--meta subject=x`). - `--item` (flag) - Incompatible with `--auto-meta`. - `--identifier-from` (string) - Incompatible with `--auto-meta`. - `--key` (string) - Incompatible with `--auto-meta`. - `--key-from` (string) - Incompatible with `--auto-meta`. ### File Name Convention Files must follow `NN_author_topic_words.pdf` (e.g. `01_schmitz_aristophanes_frogs.pdf`). `NN` is mandatory, second segment is author, rest is topic. ### Derived Metadata | Field | Source | | :-- | :-- | | Identifier | `--`: parent directory name + file's leading number (leading zeros stripped) + rest of name lowercased (non-alphanumeric runs become hyphen); longer than 80 chars cut at word boundary | | Title | PDF `Title`; junk titles fall back to human-readable topic from file name | | Creator | Selected by `--creator-source`: `file` (default) - author segment of file name; `pdf` - `Author` from PDF; `both` - file-name author first, then PDF `Author` | | Year | Year from PDF's `CreationDate` | | Description | First ~500 characters of first page's text (whitespace collapsed, via `pdftotext`); degenerate (empty first page) field dropped | | Subjects | Directory name + topic words of file name | | Language | First-page heuristic: `rus` at ≥30% Cyrillic, `eng` when Latin dominates, otherwise dropped | ### Overrides Explicit flags override derived metadata: `--title` replaces derived title, `--description` replaces derived description; every name given through `--meta` wins entirely for that name. ### Errors - Convention violation: error with explanation. - Cyrillic directory name: error. - Two files producing same identifier: error naming conflicting files. - Incompatible flags with `--auto-meta`: error. ### Response `--dry-run` shows full plan (identifier, title, creator, collection, language, year, subjects, description head) and touches neither network nor journal. ``` -------------------------------- ### Dry-run upload Source: https://github.com/4q4r/wauploader/blob/main/README.md Prints the full upload plan (target, identifier, key, derived metadata) without touching the network or journal. ```sh ./wauploader upload ./papers --item papers-2026 \ --key-from "{Path}" --collection opensource --mediatype texts --dry-run ``` -------------------------------- ### Query archive.org for wauploader 0.1.0 published items Source: https://github.com/4q4r/wauploader/blob/main/README.md Use this curl command to verify the 20 items published with wauploader 0.1.0 on 2026-10-20. The query returns 21 identifiers because one empty item shell (rejected PDF) is included. The response is JSON from archive.org's advancedsearch.php. ```sh curl -s 'https://archive.org/advancedsearch.php?q=scanner%3A%22wauploader+0.1.0%22&fl%5B%5D=identifier&rows=50&output=json' ``` -------------------------------- ### Config package function signatures Source: https://github.com/4q4r/wauploader/blob/main/docs/plan.md Declares the main exported functions for the config package: Default, Load, Validate, and MergeFlag. Includes comments on behavior for missing files and validation modes. ```go func Default() *Config func Load(path string) (*Config, error) // missing file = zero-config, not an error; parse errors carry TOML position, wrapped with Russian prefix func (c *Config) Validate(mode Mode) error // ModeSave | ModeUpload | ModeAny; Russian fail-fast messages func (c *Config) MergeFlag(fn func(*Config)) // flag-over-config hook ``` -------------------------------- ### Console package function signatures Source: https://github.com/4q4r/wauploader/blob/main/docs/plan.md Declares the main exported functions for the console package, including color output methods and a byte formatting helper. ```go func New(out, errOut io.Writer, isTTY bool, noColor bool) *Console func IsTTY(f *os.File) bool // via x/term IsTerminal func (c *Console) Infof(format string, a ...any) // cyan func (c *Console) Successf(format string, a ...any) // green func (c *Console) Warnf(format string, a ...any) // yellow func (c *Console) Errorf(format string, a ...any) // red → errOut func (c *Console) Dimf(format string, a ...any) // dim (hashes, ids) func (c *Console) JSON(v any) // one compact JSON object per call, colors never applied func FormatBytesRU(n int64) string // "1,5 ГБ" style: RU units Б/КБ/МБ/ГБ/ТБ, one decimal, comma separator ``` -------------------------------- ### Makefile vuln target Source: https://github.com/4q4r/wauploader/blob/main/docs/plan.md Runs govulncheck on all packages. ```makefile govulncheck ./... ``` -------------------------------- ### Bot Etiquette Guidelines Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r3-priorart-report.md Official guidelines for automated requests to archive.org. All automated requests must include a descriptive User-Agent, honor rate limits, and follow recommended practices for bulk operations. ```APIDOC ## Bot Etiquette Guidelines ### Description Official guidelines for automated requests to archive.org. All automated requests must include a descriptive User-Agent, honor rate limits, and follow recommended practices for bulk operations. ### Requirements - **User-Agent** - Must be descriptive, including tool name and version (for AI agents, include the model). - **Rate Limiting** - Honor `429` responses and `Retry-After` headers. - **Bulk Operations** - Add delays between requests. - **Checksums** - Use `--checksum` to avoid re-uploads. - **Backoff** - Implement exponential backoff on failures. - **Sandbox** - Use `test_collection` for testing; items are auto-removed after ~30 days. - **Permanent Collections** - Email info@archive.org to request permanent collections. ### Example User-Agent ``` User-Agent: wauploader/1.0 (AI agent; model: gpt-4) ``` ``` -------------------------------- ### Authenticate with archive.org Source: https://github.com/4q4r/wauploader/blob/main/README.md Interactively prompts for archive.org credentials, exchanges them for S3 keys and login cookies via the xauthn endpoint, and writes them to ~/.config/wauploader/wauploader.toml with mode 0600. The password is never persisted or printed. ```sh ./wauploader init ``` -------------------------------- ### PUT // Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r3-priorart-report.md Uploads a file to an Internet Archive item via the S3-compatible API. Supports multipart uploads and can create the item automatically if the x-archive-auto-make-bucket header is set. ```APIDOC ## [PUT] // ### Description Uploads a file to an Internet Archive item via the S3-compatible API. Supports multipart uploads and can create the item automatically if the x-archive-auto-make-bucket header is set. ### Method PUT ### Endpoint `https://s3.us.archive.org//` (bucket-style: `.s3.us.archive.org`) ### Parameters #### Path Parameters - **item** (string) - Required - The identifier of the item to upload to. - **file** (string) - Required - The name of the file to upload. #### Request Headers - **x-archive-auto-make-bucket** (string) - Optional - Set to `1` to create the item if it does not exist. - **x-archive-meta-** (string) - Optional - Metadata headers; use uri() encoding for non-ASCII and replace `--` with `_`. - **x-archive-size-hint** (integer) - Optional - Size hint in bytes for large items. - **x-archive-queue-derive** (string) - Optional - Set to `0` to skip the derive process for faster ingest. - **x-archive-interactive-priority** (string) - Optional - Set to `1` for express queue; avoid mixed settings on the same item. - **x-archive-keep-old-version** (string) - Optional - Set to `0` or `1` to control clobber semantics. - **x-archive-cascade-delete** (string) - Optional - Set to `1` to enable cascade delete. ### Request Example ``` PUT /myitem/myfile.txt HTTP/1.1 Host: s3.us.archive.org x-archive-auto-make-bucket: 1 x-archive-meta-title: My File x-archive-size-hint: 1024 x-archive-queue-derive: 0 Content-Length: 1234 [file content] ``` ### Response #### Success Response (200) - **ETag** (string) - The entity tag of the uploaded file. #### Response Example ``` HTTP/1.1 200 OK ETag: "abc123" ``` ### Error Handling - **307 Redirect** - Common; clients must handle redirects and preserve Authorization header (use `--location-trusted` with curl). - **429 Too Many Requests** - Honor `Retry-After` header and implement exponential backoff. ``` -------------------------------- ### Upload a file Source: https://github.com/4q4r/wauploader/blob/main/README.md Uploads a file to archive.org with required collection and mediatype flags, optionally verifying the upload and waiting for derivation. ```sh ./wauploader upload dump.tar.gz \ --item my-dump-2026 --collection test_collection --mediatype data \ --title "My dump" --verify --wait-derive ``` -------------------------------- ### Force HTTP/1.1 with Transport.Protocols (Go 1.24+) Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r4-libs-report.md Use this to force HTTP/1.1 for IA-S3, which only speaks HTTP/1.1 REST. Requires Go 1.24+; the machine toolchain is go 1.27.x. Disables HTTP/2 via Protocols and keeps ForceAttemptHTTP2 off. ```go tr := http.DefaultTransport.(*http.Transport).Clone() tr.Protocols.SetHTTP1(true) tr.Protocols.SetHTTP2(false) // IA-S3 speaks HTTP/1.1 REST only tr.ForceAttemptHTTP2 = false // keep off; Protocols is now the authority ``` -------------------------------- ### POST /save Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r1-spn2-report.md Submits a URL to the Wayback Machine for archiving. Requires authentication via S3 keys or cookies, or can be used anonymously with rate limits. ```APIDOC ## [POST] /save ### Description Submits a URL to the Wayback Machine for archiving. Requires authentication via S3 keys or cookies, or can be used anonymously with rate limits. ### Method POST ### Endpoint https://web.archive.org/save ### Parameters #### Request Body (application/x-www-form-urlencoded) - **url** (string) - Required - The URL to capture. - **capture_outlinks** (boolean) - Optional - Requires authentication. Capture outlinks. - **capture_screenshot** (boolean) - Optional - Requires authentication. Capture a screenshot. - **email_result** (string) - Optional - Requires authentication. Email the result to the given address. ### Headers - **Accept** (string) - Optional - Set to `application/json` to receive a JSON response; otherwise an HTML page is returned. - **Authorization** (string) - Optional - Format: `LOW :` for S3 key authentication. - **Cookie** (string) - Optional - Provide `logged-in-sig` and `logged-in-user` cookies for cookie-based authentication. ### Request Example ``` url=http%3A%2F%2Fexample.com ``` ### Response #### Success Response (200) - **url** (string) - The captured URL. - **job_id** (string) - The job identifier (opaque string, may be UUID or `spn2-<40 hex>`). #### Response Example ```json {"url":"http://brewster.kahle.org/", "job_id":"ac58789b-f3ca-48d0-9ea6-1d1225e98695"} ``` #### Error Response (non-2xx) - **message** (string) - Error description. - **status** (string) - Error status. - **status_ext** (string) - Extended error code. #### Error Response Example ```json {"message":"Cannot resolve host nxdomain.fake.tld.","status":"error","status_ext":"error:invalid-host-resolution"} ``` #### Dedup Response - **url** (string) - The URL. - **job_id** (null) - Null. - **message** (string) - Deduplication message. #### Dedup Response Example ```json {"url":"...","job_id":null,"message":"The same snapshot had been made 3 minutes ago. You can make new capture of this URL after 2 hours."} ``` ### Authentication - **S3 keys (LOW)**: Header `Authorization: LOW :`. Keys generated at https://archive.org/account/s3.php. - **Cookies**: Provide `logged-in-sig` and `logged-in-user` cookies from a logged-in archive.org session. Cookies expire after a few days. - **Anonymous**: No authentication, but subject to rate limits and IP blocklists. ### Rate Limits - **Authenticated**: 7 requests per minute, daily caps. - **Anonymous**: 3 requests per minute, daily cap of 200 requests, daily captured-bytes cap (500MB or 2GiB depending on doc version). - **Blocked IPs**: Spamhaus SBL/XBL blocklist (error:blocked-client-ip). Tor exit nodes are excluded. ``` -------------------------------- ### Makefile test target Source: https://github.com/4q4r/wauploader/blob/main/docs/plan.md Test target with race detector and parallel package limit. Uses GOTMPDIR to set temp dir. ```makefile GOTMPDIR=$(HOME)/.cache/go-tmp go test -race -p 2 ./... ``` -------------------------------- ### wauploader jobs Source: https://github.com/4q4r/wauploader/blob/main/README.md List journal records, optionally filtered by state, and optionally clear them. The listing is a human surface; `--json` does not apply. ```APIDOC ## [CLI] wauploader jobs [--state failed|queued|pending|done] [--clear] ### Description List the journal records. `--clear` deletes the filtered ones (all of them without a filter). The listing is a human surface — `--json` does not apply to it. ### Usage ```bash wauploader jobs wauploader jobs --state failed wauploader jobs --clear ``` ### Parameters #### Flags - `--state STATE` (string) - Optional - Filter by state: `failed`, `queued`, `pending` or `done`. - `--clear` (flag) - Optional - Delete the records matching the filter (all of them without a filter). ### Response List of journal records matching the filter. ``` -------------------------------- ### Save web pages Source: https://github.com/4q4r/wauploader/blob/main/README.md Saves one or more URLs to the archive. The --list option reads URLs from a file and skips those archived within the specified time window. ```sh ./wauploader save https://example.com https://example.org/page ./wauploader save --list urls.txt --if-not-archived-within "3d 5h 20m" ``` -------------------------------- ### POST /save Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r1-spn2-report.md Submits a new capture request to Save Page Now. The response contains a job_id in the JSON body, which is used for subsequent status polling. ```APIDOC ## [POST] /save ### Description Submits a new capture request to Save Page Now. The response contains a job_id in the JSON body, which is used for subsequent status polling. ### Method POST ### Endpoint /save ### Parameters #### Request Body - **job_id** (string) - Required - The job identifier returned in the response body. ### Request Example { "job_id": "" } ### Response #### Success Response (200) - **job_id** (string) - The job identifier for the submitted capture. #### Response Example { "job_id": "" } ``` -------------------------------- ### Simulate error with x-archive-simulate-error header Source: https://github.com/4q4r/wauploader/blob/main/docs/research/r2-ia-s3-report.md Use this curl command to test error handling by simulating a SlowDown error. The header value 'help' lists all simulatable errors. ```bash curl s3.us.archive.org -v -H x-archive-simulate-error:SlowDown ```