module ScrapeFailureReport
Overview
Classify scrape results (url, HTTP status, body size) and report failures per host. Everything is read from the CSV; no request is made.
Defined in:
scrape_failure_report.crConstant Summary
-
CLASSES =
["ok", "empty", "redirect", "blocked", "not found", "client error", "server error", "no response", "other"] -
Fixed print order. "other" holds 100 to 199, which no class above covers.
-
REQUIRED =
["url", "status", "bytes"] of ::String -
USAGE =
"usage: scrape-failure-report results.csv [--min-urls 1]\nCSV columns: url, status, bytes. Reads your own scrape log and makes no request. The minimum urls per host is set by you. More: https://www.onegtmlab.dev/tool-directory/research-and-scraping" -
VERSION =
"1.0.0"
Class Method Summary
-
.analyze(text : String) : Report
Row numbers count the header as row 1.
- .classify(status : Int32, bytes : Int64) : String
-
.cli(args : Array(String), stdout : IO, stderr : IO) : Int32
Command line entry.
-
.host_of(url : String) : String | Nil
Text between "://" and the next "/", "?" or "#", lowercased, without a leading "www.".
-
.parse_csv(text : String) : Array(Array(String))
Small CSV reader: comma separated, double quoted fields may hold commas, line breaks and "" for a quote mark.
- .pct(part : Int32, whole : Int32) : String
- .render(report : Report, min_urls : Int32 = 1) : String
- .table(rows : Array(Array(String))) : String
Class Method Detail
Command line entry. Returns the exit code: 0 ok, 1 bad input or file, 2 usage.
Text between "://" and the next "/", "?" or "#", lowercased, without a leading "www.". A port is kept.
Small CSV reader: comma separated, double quoted fields may hold commas, line breaks and "" for a quote mark. Returns rows of raw cell strings.