README
¶
pipolinkcheck
A concurrent website crawler that finds and reports broken links. It follows
a, img, link, script, video and source tags, then writes every
broken link it finds to a CSV report, while throttling requests and parallelizing
across multiple workers.
Works with any website — audit your site's links (see example.com).
Installation
Build the binary (requires Go 1.26+):
go build .
The resulting pipolinkcheck binary is ready to use. You can also build it
with make build.
Antivirus false positives
Unsigned Go binaries are frequently flagged by antivirus software as suspicious, even when they are completely clean. This is a known false positive caused by heuristics matching statically-linked Go executables.
The most common detection is Microsoft Defender's
Trojan:Win32/Wacatac.C!ml. The !ml suffix means it comes from a
machine-learning heuristic, not a malware signature, and it is widely reported
against freshly built Go binaries (especially when built with a very recent Go
toolchain, before antivirus vendors update their models). It is a false
positive: this repository only crawls and checks the links of websites.
If you get a Wacatac.C!ml detection, the fastest way to clear it is to
report the file to Microsoft's security team as a false positive:
- Rebuild the binary from this source so you can attest it is yours.
- Submit it to https://www.microsoft.com/wdsi/filesubmission (sign in with a Microsoft account), selecting "My submission was incorrectly detected as malware" and noting the build revision.
- Also add an exclusion in Defender for your local build directory so the binary is usable while Microsoft processes the report.
To confirm the binary you build is safe, rebuild from this source and compare the SHA-256 hash — a reproducible build from the same revision always produces the same bytes.
Usage
pipolinkcheck [options]
Run pipolinkcheck -h to see the full list of options:
Usage: pipolinkcheck [options]
Options:
-base <url> Base URL to start crawling from (default "https://example.com/")
-allowed <csv> Comma-separated list of allowed URL prefixes
-excluded <csv> Comma-separated list of excluded URL prefixes
-maxreqs <n> Maximum requests per second (default 20, clamped to 2-20)
-maxlinks <n> Maximum number of unique links to crawl (default 100000)
-workers <n> Number of parallel workers (default 0: auto-computed from CPUs, clamped to 2-16)
-output <path> Output CSV file path
-user-agent <s> User-Agent header sent with every request
-verbose detailed logging output for debugging and monitoring (default true)
-log-all log every visited link in the CSV result, not only broken ones
-insecure-tls skips TLS certificate verification (not recommended)
-no-external skips checking links outside the allowed prefixes
-render render pages with Chrome before extracting links
-render-tabs <n> Number of Chrome tabs used concurrently with -render (default 2)
-chrome-profile <dir> Chrome user data directory for persistent cookies/login
-headed show the Chrome window (use for manual SAML/login)
-login open Chrome to the base URL for manual login, then exit
Options
| Flag | Default | Description |
|---|---|---|
-base |
https://example.com/ |
URL to start crawling from |
-allowed |
root URL | Comma-separated URL prefixes the crawler is allowed to visit; root-relative entries (e.g. /docs) are resolved against -base |
-excluded |
(none) | Comma-separated URL prefixes to skip; root-relative entries (e.g. /admin) are resolved against -base |
-maxreqs |
20 |
Maximum requests per second (automatically clamped to 2–20) |
-maxlinks |
100000 |
Maximum number of unique links to crawl before discovery stops (bounds memory usage) |
-workers |
0 |
Number of parallel workers (0 auto-computes from CPU count; clamped to 2–16) |
-output |
derived from URL | Output CSV file path (e.g. pipolinkcheck-www.example.com.csv) |
-user-agent |
Mozilla/5.0 (compatible; PipoLinkCheckBot/1.0) |
User-Agent header sent with each request |
-verbose |
true |
Log every crawled URL; use -verbose=false to silence |
-log-all |
false |
Write every visited link to the CSV result, not only broken ones; the .log stats file is unchanged |
-insecure-tls |
false |
Skip TLS certificate verification (only for self-signed sites; not recommended) |
-no-external |
false |
Skip checking links outside the allowed prefixes |
-render |
false |
Render pages with Chrome before extracting links (for JavaScript-generated pages) |
-render-tabs |
2 |
Number of Chrome tabs rendering pages concurrently (0 uses the default 2) |
-chrome-profile |
auto-detected | Chrome user data directory used to persist cookies/login |
-headed |
false |
Show the Chrome window (use for manual SAML/login) |
-login |
false |
Open Chrome at the base URL for manual login, then exit |
Any option listed under Options may also be set programmatically via
NewConfigWithOptions (see config.go) when embedding the crawler in your own
Go program.
Examples
Basic crawl
Crawl a site staying within its own domain (the root host is allowed by default):
pipolinkcheck -base https://example.com
Explicitly restrict the crawl to matching prefixes
Only follow URLs beginning with https://example.com/:
pipolinkcheck -base https://example.com -allowed https://example.com
Allow a site and all its subdomains:
pipolinkcheck -base https://example.com \
-allowed https://example.com,https://www.example.com,https://blog.example.com
Stray beyond the root host, e.g. also crawl a CDN that hosts images:
pipolinkcheck -base https://example.com \
-allowed https://example.com,https://cdn.example.net
If -allowed is omitted, the root URL is allowed by default. When you pass
-allowed, it replaces that default, so include the root host (and any other
prefixes) explicitly if you want them crawled.
Use root-relative prefixes
Prefixes may be written relative to the root URL — a leading / is resolved
against -base, so you don't have to repeat the full host:
pipolinkcheck -base https://example.com \
-allowed /docs,/api \
-excluded /admin,/tmp
This is equivalent to -allowed https://example.com/docs,https://example.com/api
and -excluded https://example.com/admin,https://example.com/tmp. Absolute
URLs work exactly as before.
Exclude parts of the site
Skip a section you know is heavy or has thousands of stale pages:
pipolinkcheck -base https://example.com -excluded https://example.com/archive,https://example.com/tmp
Allowed and excluded prefixes can be combined — excluded wins over allowed:
pipolinkcheck -base https://example.com \
-allowed https://example.com,https://cdn.example.net \
-excluded https://example.com/admin,https://cdn.example.net/private
Control crawling speed
Slow things down to be polite to the server / avoid rate limiting (clamped to a minimum of 2):
pipolinkcheck -base https://example.com -maxreqs 2
Speed up for a large site:
pipolinkcheck -base https://example.com -maxreqs 20
The value is automatically clamped to the 2–20 range, so out-of-range values are safe to pass.
Bound the number of crawled links
To keep memory usage bounded on very large sites, the crawler stops discovering
new links once it has queued -maxlinks unique URLs (100000 by default):
pipolinkcheck -base https://example.com -maxlinks 50000
Pass a larger value (or rely on the default) for extensive sites.
Choose the output file
pipolinkcheck -base https://example.com -output /tmp/broken-links.csv
If -output is omitted, a filename is derived from the URL
(pipolinkcheck-www.example.com.csv) and the crawler also writes a matching
stats log (pipolinkcheck-www.example.com.log).
Use a custom User-Agent
pipolinkcheck -base https://example.com \
-user-agent "Acme-SiteAudit/2.5 (+https://acme.example)"
Silence verbose per-URL logging
pipolinkcheck -base https://example.com -verbose=false
Log every visited link, not only broken ones
By default the CSV report contains only broken links. Add -log-all to write
every visited link to the CSV as well, with its HTTP status code. The CSV is
streamed continuously; the .log stats file is not modified by -log-all.
pipolinkcheck -base https://example.com -log-all
Crawl a site with a self-signed certificate
pipolinkcheck -base https://intranet.local -insecure-tls
Security note: only use
-insecure-tlsfor internal sites with self-signed / non-trusted certificates. Do not use it on public sites.
Crawl JavaScript-generated or authenticated pages
For pages whose links are generated by JavaScript, or for intranet sites behind SAML/SSO, use the Chrome renderer. First complete the login interactively:
pipolinkcheck -base https://intranet.example -login
Chrome opens with a persistent profile (auto-detected, or set with
-chrome-profile). After logging in, press Enter to close it, then run the
crawl with rendering enabled:
pipolinkcheck -base https://intranet.example -render
The login is reused on later runs: session cookies (the kind SAML/SSO providers
usually issue) are rewritten with an expiry and Chrome is closed gracefully, so
cookies, localStorage and IndexedDB are flushed to the profile. Note that
sessionStorage is per-tab and in-memory, so it is not carried across separate
runs.
Add -headed to watch the crawl in a visible Chrome window. In headed mode the
tool opens the base URL and waits for a SAML/SSO login to complete. It detects
the end of the flow automatically: as soon as Chrome lands back on an allowed
URL (and the page has finished loading), the crawl starts without any further
input. Press Enter to start the crawl immediately if detection cannot complete
(for example when the post-login page is outside the allowed prefixes).
Rendering is slower than plain HTTP crawling because each page waits for
JavaScript to settle.
Pages are rendered in several tabs at once: -render-tabs controls how many
(default 2). Raise it to speed up rendering at the cost of more CPU and memory:
pipolinkcheck -base https://intranet.example -render -render-tabs 4
All tabs open in the same Chrome window and share the same browser profile and login session.
A full example combining options
pipolinkcheck \
-base https://www.example.com \
-allowed https://www.example.com,https://static.example.com \
-excluded https://www.example.com/account,https://www.example.com/api \
-maxreqs 8 \
-user-agent "Acme-SiteAudit/2.5" \
-output /tmp/example-report.csv \
-verbose=false
Output
The crawler produces two files:
1. CSV report (-output path, .csv by default)
A semicolon-delimited (;) CSV with the following columns:
| Column | Description |
|---|---|
MIME Type |
Response Content-Type (e.g. text/html, image/png), or unknown when no response was received |
Source Page |
The page the broken link was discovered on |
Link Name |
Visible link text (hyperlinks) / alt or title attribute |
Selector |
A CSS-like path locating the element on the page (e.g. main#contents > section.block > p > a). Everything before <body> is omitted; class lists are capped at three classes per element; the full element depth is preserved |
Link |
The URL that was checked (broken, or every visited link with -log-all) |
Status Code |
HTTP status returned (e.g. 404), or one of the internal codes below when the link fails before an HTTP response |
Error message |
Human-readable description of the failure — the standard status description for HTTP errors (e.g. Not Found), or the textual error for internal failures (e.g. DNS, TLS, timeout) |
Internal error codes written to the Status Code column when a request fails
before any HTTP response is received:
| Code | Meaning |
|---|---|
1001 |
Building the HTTP request failed (e.g. malformed URL) |
1002 |
The HTTP request could not be completed (network/TLS/DNS error) |
1003 |
Processing the link panicked |
Example report:
MIME Type;Source Page;Link Name;Selector;Link;Status Code;Error message
text/html;https://www.example.com/;;main#contents > section.block > p > a;https://www.example.com/old-page.html;404;Not Found
image/png;https://www.example.com/;banner;header > div.logo > img;https://www.example.com/img/banner.png;500;Internal Server Error
text/html;https://www.example.com/contact;read more;footer > ul.footer-links > li > a;https://www.example.com/privacy;404;Not Found
The file is written with a UTF-8 BOM so it opens correctly in Excel/LibreOffice. Cells are escaped to prevent spreadsheet formula injection.
2. Stats log (<output>.log)
A human-readable crawl summary: visited resources by MIME type, links enqueued,
and a breakdown of broken links by MIME type and HTTP status code.
-log-all does not modify this file.
Development
make test # run tests with coverage profile
make race # run tests with the race detector enabled
make fmt # format code (requires gofumpt)
make coverage # generate coverage report
make build # build binary
make clean # remove build artifacts
The project includes unit tests for the crawler, config, result writer, stats, HTTP layer, HTML parsing, and verification helpers. CI runs the test suite (with coverage uploaded to Codecov) and the race detector on Linux, and builds binaries for Linux, macOS, and Windows.