Skip to main content Switch to mobile version findbrokenlinks 1.0.0 Async broken-link crawler with pluggable checks and reporters
pip install findbrokenlinks Copy PIP instructions
Async crawler that finds links on a website whose behavior in a browser would not match user expectations: 404s, network failures, redirects to weird places, "soft 404" pages where a CMS returns 200 but says "not found".
Built around pluggable checks and reporters — adding a new control or output format means dropping a file with an @register decorator. No core edits needed.
Crawl modes: page (single page), internal (same domain), or internal+external (recurse internal, validate external) — --mode.
Seven built-in checks — flag HTTP errors, network failures, redirect chains, redirects to the home page, two soft-404 detectors (regex patterns + baseline probing), and an anti-bot block detector so WAF challenges from Cloudflare / DataDome / PerimeterX / Imperva / Akamai / DDoS-Guard and login walls (401) don't masquerade as broken links.
Polite-but-well-formed HTTP: keeps an honest User-Agent, but pairs it with standard Accept and Accept-Language headers so WAFs don't treat us as malformed traffic.
Doesn't parse JS as HTML: bodies are only HTML/plaintext; JS, CSS, JSON aren't read, and HTMLExtractor double-checks Content-Type before invoking bs4 — so JavaScript string literals can't become fake findings.
Nine output formats: csv, tsv, json, jsonl, html, markdown, junit (XML), sarif, grouped-json. Emit multiple at once with --format a,b,c.
grouped-json reporter collapses findings by final_url — one record per distinct broken target with the source-page list preserved as a count plus a small sample. On a real crawl of a 7800-page site, a single broken footer link generated 7800 findings; grouped-json compresses that to one record (97% reduction in our test case).
Incremental report writing: when a single streamable format is selected (csv, tsv, jsonl), each finding is appended to the output as soon as it is discovered — you can tail -f the report while the crawl runs.
Polite by default: respects robots.txt, rate-limited (token bucket), bounded concurrency, configurable timeouts and redirect caps.
Bandwidth-efficient: streams responses — binary content (PDFs, archives, images) is never downloaded, only its status code is checked. Text bodies are capped (default 1 MB) so a runaway HTML page can't exhaust memory.
HTML coverage beyond : also checks , , .
Extensible: new check = one file + @register. Same for report formats.
CI-friendly: exit code 1 when a finding reaches --fail-on (default error), 3 when the crawl itself failed, so CI can tell the two apart; JUnit output slots into CI test reports (GitHub Actions, GitLab, Jenkins). SARIF output is one result per check and broken target; for GitHub Code Scanning it needs --sarif-anchor, see "CI integration" below.
GitHub Action: one step that writes a job summary, annotates the top broken targets and leaves a SARIF report for Code Scanning, see "GitHub Action" below.
Requires Python 3.11+. From PyPI:
pipx install findbrokenlinks # CLI in its own venv # or pip install findbrokenlinks In GitHub Actions, the action needs no installation step: see GitHub Action.
From a clone, for development:
git clone https://github.com/as-mnt/findbrokenlinks cd findbrokenlinks make install # .venv/ with the package in editable mode # or make install-dev # + pytest, ruff, mypy, starlette (for integration tests) In a clone the command is .venv/bin/findbrokenlinks.
# Crawl a site, internal pages + validate external links, TSV to stdout findbrokenlinks https://example.com # Single page mode, HTML report findbrokenlinks https://example.com --mode page \ --format html -o report.html # Streaming JSONL — findings appear in the file as soon as they are discovered findbrokenlinks https://example.com --format jsonl -o report.jsonl & tail -f report.jsonl | jq . # Emit several formats at once findbrokenlinks https://example.com \ --format csv,json,html,markdown --output-dir reports/ # Run as a Python module python -m findbrokenlinks https://example.com --mode internal In a clone, via Makefile shortcuts (override URL=… on the command line):
make run URL=https://example.com make run-page URL=https://example.com make run-internal URL=https://example.com make run-html URL=https://example.com OUT_DIR=reports make run-jsonl URL=https://example.com OUT_DIR=reports # streaming JSONL make run-multi URL=https://example.com OUT_DIR=reports make run-json URL=https://example.com FLAGS=--insecure # forward extra CLI flags GitHub Action
- uses: as-mnt/findbrokenlinks@v1 with: url: https://docs.example.org The step installs findbrokenlinks from the action's own checkout into a separate virtualenv (the job's Python and PATH are left alone) and crawls the site. It writes a job summary with the totals and the top broken targets, ::error and ::warning annotations for those targets, and the grouped-json and sarif reports. It fails when a finding reaches fail-on, with the CLI's exit codes. It runs on Linux and macOS runners, not on Windows.
@v1 follows the latest 1.x release. For a fixed version, give a release tag (@v1.0.0) or its commit SHA.
A published site, every week
name: Links on: schedule: - cron: "0 6 * * 1" # Mondays at 06:00 UTC workflow_dispatch: permissions: contents: read jobs: links: runs-on: ubuntu-latest steps: - uses: as-mnt/findbrokenlinks@v1 id: links with: url: https://docs.example.org formats: html - uses: actions/upload-artifact@v7 if: always() && steps.links.outputs.report-dir != '' with: name: link-report path: ${{ steps.links.outputs.report-dir }} No checkout: the action does not read the repository. A broken link fails the run, and GitHub notifies whoever last changed the schedule. The reports, the HTML one among them, are an artifact of the run. In a public repository GitHub turns scheduled workflows off after 60 days without activity in it.
A documentation site built in the same job
name: Docs on: pull_request: push: branches: [main] permissions: contents: read jobs: links: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: actions/setup-python@v7 with: python-version: "3.12" - run: pip install mkdocs - run: mkdocs build - name: Serve the site run: | python -m http.server 8000 --directory site & curl --silent --retry 10 --retry-connrefused --retry-delay 1 \ --output /dev/null http://localhost:8000/ - uses: as-mnt/findbrokenlinks@v1 with: url: http://localhost:8000/ mode: internal The server started in the background keeps running for the steps after it; curl waits until it answers. mode: internal checks the site's own pages and links and leaves external ones to the weekly run: a pull request should not fail because another site is down. It also leaves alone the links to the published site, such as with site_url set in mkdocs.yml: a page new in the pull request is not published yet.
name: Links on: schedule: - cron: "0 6 * * 1" workflow_dispatch: permissions: contents: read security-events: write jobs: links: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: as-mnt/findbrokenlinks@v1 id: links with: url: https://docs.example.org fail-on: never - uses: github/codeql-action/upload-sarif@v4 with: sarif_file: ${{ steps.links.outputs.sarif-file }} category: findbrokenlinks/docs.example.org Each check and broken target is one alert, attached to line 1 of the workflow file (or of sarif-anchor); the message has the URL and a sample of the pages that link to it. An alert stays the same alert from run to run and is closed by the first run that no longer finds it. fail-on: never keeps the run green, the alerts being the result; the step still fails when the crawl does (exit code 3), and then the upload is skipped: a partial report would close alerts it did not get to. category keeps these results apart from other analyses, CodeQL's for one; give each site its own. Code Scanning is free for public repositories; a private one needs GitHub Code Security.
findbrokenlinks [options] URL: http:// or https:// with a host (and a port 1-65535) Scope: --mode {page,internal,internal+external} default: internal+external --depth N default: 0 (unlimited) --max-pages N default: 10000 (0 = unlimited); safety cap against unbounded URL spaces (session IDs, calendars, search facets) --use-sitemap seed from /sitemap.xml Network: --rate-limit RPS default: 5 --concurrency N default: 10 --timeout SECONDS default: 15 --max-redirects N default: 10 --max-body-bytes N default: 1048576 (1 MB) — cap on text bodies; non-text responses are never downloaded --user-agent UA default: findbrokenlinks/ (+https://github.com/as-mnt/findbrokenlinks) --ignore-robots --insecure, -k disable TLS certificate verification (like curl -k). NOTE: an incomplete chain (server missing its intermediate CA) is already crawled by default and reported as a NETWORK_ERROR *warning* — this flag is for other cert problems (expired, self-signed, wrong host) and suppresses ssl/ssl_chain findings entirely. Checks: --enable-checks code1,code2 --disable-checks code1,code2 --redirect-chain-threshold N default: 3 --patterns PATH user soft-404 patterns YAML (checked at startup) --no-soft404-probe --fail-on {error,warning,never} lowest severity that makes the exit code 1 (default: error); never: exit 0 whatever is found Output: --format fmt[,fmt...] csv|tsv|json|jsonl|html|markdown|junit|sarif|grouped-json (default: tsv); streaming formats: csv, tsv, jsonl --output PATH, -o PATH default: stdout (single format only). Supports placeholders {host}, {date}, {time}, {ts}, {format}, {ext}. --output-dir DIR directory for multi-format output. Defaults to reports/{host}_{date}_{time}/ when omitted. Files inside the dir are named {format}.{ext}. --sarif-anchor PATH sarif: attach every result to line 1 of this file, relative to the repository root (e.g. mkdocs.yml); needed for GitHub Code Scanning Misc: -v / --verbose --log-file PATH Built-in checks
The probe-based detector requests a random nonexistent URL per host at startup and remembers the response (status, normalized text, hash). Any 2xx response whose body matches the baseline is flagged, and so is a link that redirects to where the nonexistent URL ended up. A link to a home page (/) is not flagged when it ends up on its own host, or where the home page of the host it ends up on does: a www. alias, say. Another host's / that lands on a not-found page is.
The probe also requests the home page (/). If it has the same body as the nonexistent URL, bodies on that host tell a missing page from a real one in nothing, so they are not compared: instead of a warning on every page you get one info finding on the home page that says so. The redirect comparison still works there.
Single-page apps (SPAs). A client-rendered app (Next.js, React Router, etc.) typically serves the same index.html shell with 200 OK for every path — including the homepage and genuinely nonexistent URLs — and renders the "not found" state in the browser via JavaScript. Since this crawler doesn't execute JS, every page looks identical at the HTTP layer, and broken internal links on such a host can't be detected by HTTP status alone. That is what the one info finding above tells you. Sites like example.com, which serve the same page with 404 for every unknown path, get the same finding. --no-soft404-probe turns the probe off altogether (no requests).
Every reporter produces the same fields per finding:
source_page — page where the link was found
link_url — the link's target URL
final_url — where the request actually ended up after redirects
anchor — link text or alt attribute
tag — a / img / script / link / seed
status — HTTP status (empty on network error)
redirect_chain — list of intermediate URLs
issue_codes — which checks fired
severity — error / warning / info
details — human-readable explanation
HTML and Markdown reports additionally group findings by source page.
junit and sarif leave out info findings. In them every entry asks for a fix: a failed test, an alert in GitHub Code Scanning. An info finding is a note about the site, such as "content is not compared on this host" (SOFT_404_PROBE); the other formats keep it.
Extending: add a new check
No core edits required. Create src/findbrokenlinks/checks/my_check.py:
from findbrokenlinks.checks.base import Check, CheckContext, register from findbrokenlinks.models import FetchResult, Issue, LinkRef @register class SlowResponseCheck(Check): code = "SLOW_RESPONSE" severity = "warning" def evaluate(self, link: LinkRef, fetch: FetchResult, ctx: CheckContext) -> Issue | None: if fetch.elapsed_ms > 5_000: return Issue(self.code, self.severity, f"slow: {fetch.elapsed_ms:.0f}ms", {"ms": fetch.elapsed_ms}) return None That's it. The package auto-discovers every submodule under checks/ on import, so dropping the file is enough — no __init__.py edits required. Your check is now available everywhere, and can be toggled via --enable-checks SLOW_RESPONSE / --disable-checks SLOW_RESPONSE.
Extending: add a new output format
Same pattern. Create src/findbrokenlinks/reporters/my_reporter.py:
from findbrokenlinks.models import Finding from findbrokenlinks.reporters.base import Reporter, register @register class MyReporter(Reporter): name = "myfmt" file_ext = "myx" def render(self, findings: list[Finding]) -> str: ... Drop the file under reporters/ — same auto-discovery applies — and you can now pass --format myfmt.
Extending: custom soft-404 patterns
Built-in patterns live in src/findbrokenlinks/patterns/builtin.yaml. Add your own without forking — pass --patterns my_patterns.yaml:
- name: my_cms_404 target: title # title | h1 | body | raw regex: '(?i)not here' target picks the search surface:
title / h1 — text of those elements
body — full page text after BeautifulSoup get_text() — markup stripped
raw — the unaltered HTML body, including tags, attributes, and server signatures that text extraction would erase
User patterns are merged with the built-in set (Composite).
seed URL ──► Crawler (asyncio.Queue + N workers) │ ├─► Fetcher ──► httpx.AsyncClient (rate-limited, robots-aware) ├─► HTMLExtractor (bs4 + lxml) ├─► Checks (Strategy + Registry, per-finding evaluation) └─► Reporter (Strategy + Registry, multiple formats) Design patterns used:
Strategy + Registry — Check and Reporter ABCs with @register-driven plug-in collections
Producer–Consumer / Worker Pool — asyncio.Queue + N workers
Composite — built-in + user soft-404 patterns merged
Factory — get_reporter(name) resolves a format string
Pipeline — Fetcher → Extractor → Checks → Reporter
Observer — on_finding callback drives incremental report writing for streaming formats (csv, tsv, jsonl)
See docs/context.md for the up-to-date design and rationale. docs/plan.md is the day-0 approved plan, kept as a baseline against which to read the change log.
make install-dev # set up dev environment make check # ← run before pushing: lint + typecheck + tests # (mirrors the GitHub Actions pipeline) make test # run the test suite (~10s) make test-unit # unit tests only (skip live-server integration) make test-integration # only the live-server integration test make lint # ruff make typecheck # mypy make package # build sdist + wheel, twine check, smoke-test the # wheel in a clean venv (mirrors CI job `package`) make clean # nuke venv, caches, build artifacts, generated reports Tests run against a local Starlette server with known-broken routes and a static fixture site (tests/fixtures/site/) — no network access required for CI.
3 takes precedence over 1: an incomplete report can't vouch for the site. --fail-on warning also fails on the warning-level checks: anti-bot blocks, redirect chains, redirects to the home page, both soft-404 detectors and an incomplete TLS certificate chain. --fail-on never keeps the job green and leaves the verdict to the report.
On any CI, the CLI and its exit code are enough. In GitHub Actions, say:
- run: pip install findbrokenlinks - run: findbrokenlinks https://your-site.example --mode internal+external \ --format junit -o link-check.xml - uses: mikepenz/action-junit-report@v4 if: always() with: report_paths: link-check.xml Uploading the SARIF output to GitHub Code Scanning needs --sarif-anchor PATH. Without it, results are located by page URL, and Code Scanning rejects the whole upload when an artifactLocation.uri is an http(s):// URL rather than a repository file (SARIF URI scheme "https" did not match the checkout URI scheme "file"). With it, every result is attached to line 1 of that repository file (mkdocs.yml, say), and the URLs are in the message. There is one result per check and broken target, so a dead link in a site-wide footer is one alert, not one per page. An alert keeps its identity from run to run through a fingerprint of the check and the target: the message, the anchor file and its first line may change. The GitHub Action does this by default, see Alerts in Code Scanning.
CHANGELOG.md — what changed, release by release
docs/task.md — original problem statement and decisions
docs/plan.md — the implementation plan as approved on day 0 (historical snapshot — see docs/context.md for what actually ships)
docs/context.md — implementation snapshot, file layout, how to extend each subsystem
docs/roadmap.md — plan for 1.0.0: PyPI package and GitHub Action
Author: findbrokenlinks contributors
Both files in this release have provenance metadata.
MIT View SPDX License List
broken links link checker crawler soft 404 ci
Development Status 5 - Production/Stable
Intended Audience Developers
Operating System OS Independent
Programming Language Python :: 3
Topic Internet :: WWW/HTTP :: Site Management :: Link Checking
Software Development :: Quality Assurance
Release files for findbrokenlinks 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 183.5 kB
Release files / findbrokenlinks-1.0.0.tar.gz
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Security for findbrokenlinks 1.0.0
Both files in this release have been uploaded with provenance metadata.
With provenance findbrokenlinks-1.0.0.tar.gz Nov 29, 2026
Attestation for findbrokenlinks-1.0.0.tar.gz
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Nov 29, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation




