scrape-failure-report v1.0.0

Crystal CLI and library: classifies scrape results by HTTP status (ok, empty, blocked, not found, server error) and shows failure rates per host from a CSV.

scrape-failure-report

Crystal command line tool and library. Give it a CSV from your own scrape log (url, HTTP status, body size) and it sorts every result into a class and shows where the failures sit per host. The tool makes no request; it only reads the file. The host is the text between "://" and the next "/", "?" or "#", lowercased, with a leading "www." removed and the port kept. Classes: ok (200 to 299 with bytes above 0), empty (200 to 299 with 0 bytes), redirect (300 to 399), blocked (401, 403, 429), not found (404, 410), client error (any other 400 to 499), server error (500 to 599), no response (status 0 or empty). A status from 100 to 199 is counted as other and shown only when it occurs. A failure is everything except ok, so empty and redirect count as failures. Percentages have 1 decimal. Per host (sorted by failures, highest first, then host): urls, failures, failure share and the most common failure class (ties go to the alphabetically first class name, a dash when the host has no failures). The last line lists the hosts where every url failed, taken over all hosts.

Part of the OneGTMLab free GTM tools. Background on the idea: research and scraping APIs.

Install

shards build   # then ./bin/scrape-failure-report

Use

Input: CSV with the columns url, status and bytes, any order, header case does not matter. An empty status means no response and an empty bytes cell means 0. Option: --min-urls N or --min-urls=N (default 1, set by you) hides hosts with fewer urls from the per-host table and says how many were hidden. A status that is not a whole number or is outside 0 and 100 to 599, a bad bytes value, a url without "://" (the message names the row, the header counts as row 1), a missing column, an empty file or a missing file stops the run with a message and exit 1.

$ bin/scrape-failure-report sample.csv
urls: 10

class         urls  share
ok            2     20.0%
empty         1     10.0%
redirect      1     10.0%
blocked       2     20.0%
not found     1     10.0%
client error  0     0.0%
server error  1     10.0%
no response   2     20.0%

host              urls  failures  failure share  most common failure
example.com       4     3         75.0%          blocked
example.net       2     2         100.0%         blocked
example.net:8080  2     2         100.0%         no response
example.org       2     1         50.0%          redirect

hosts where every url failed: example.net, example.net:8080

Test

crystal spec

Offline, no network calls, no dependencies beyond the language runtime. MIT licensed.

Repository

scrape-failure-report

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • about 1 hour ago
  • November 29, 2026
License

MIT License

Links
Synced at

Sun, 29 Nov 2026 03:44:34 GMT

Languages