Minimal URL extraction / classification / HTTP check pipeline.
Project description
urlcheck-smith
A compact, fast URL analysis pipeline:
- Extract URLs from arbitrary text files
- Classify domains using suffix-based “site runner” rules (government, edu, private, etc.)
- Optional HTTP checks (status, redirect, CAPTCHA/human-check heuristic)
- Output results as CSV or JSONL
- Standalone URL classifier (
classify-url) - Batch classification mode (
classify) - Supports rule presets (Japan/EU/global), custom YAML rules, explain mode, quiet mode
- Classification: Assigns categories (e.g., government, education) based on domain suffix rules.
- HTTP Verification: Checks reachability and captures status codes.
- Soft 404 Detection: Identifies pages that return a
200 OKstatus but contain "Page Not Found" text. - Human-Check Detection: Flags URLs that likely lead to CAPTCHA or bot-detection screens.
Features in Detail
Soft 404 Detection
Many websites are configured to return a standard 200 OK status even when a page is missing, often displaying a custom "not found" message to users. urlcheck-smith detects this by scanning the first 2000 characters of the response for common markers like:
- "page not found"
- "error 404"
- "the page you requested cannot be found"
If a marker is found, the soft_404_detected field in the output is set to True, allowing you to filter out these "ghost" pages from your results.
Installation (development)
python3 -m venv .venv
. .venv/bin/activate
pip install -e .[dev]
pytest
Commands Overview
1. scan — extract → classify → (optional) HTTP check
CSV output (default)
urlcheck-smith scan sample.txt -o urls.csv
JSONL output
urlcheck-smith scan sample.txt \
--no-http \
--format jsonl \
-o urls.jsonl
Skip HTTP check
urlcheck-smith scan notes.txt --no-http -o urls_wo_status.csv
Custom rules
urlcheck-smith scan urls.txt \
--rules my_rules.yaml \
-o result.csv
Built-in rule presets
urlcheck-smith scan urls.txt --preset japan -o out.csv
urlcheck-smith scan urls.txt --preset eu -o out.csv
urlcheck-smith scan urls.txt --preset global -o out.csv
2. classify-url — classify a single URL
Default (JSON)
urlcheck-smith classify-url https://www.soumu.go.jp/
Explain mode
urlcheck-smith classify-url https://www.soumu.go.jp/ --explain
Output example:
{
"url": "https://www.soumu.go.jp/",
"base_url": "www.soumu.go.jp",
"category": "government",
"explain": {
"matched_suffix": ".go.jp",
"category": "government"
}
}
Quiet mode (machine-friendly)
urlcheck-smith classify-url https://www.soumu.go.jp/ --quiet
Presets & custom rules
urlcheck-smith classify-url https://www.gov.uk/ --preset eu
urlcheck-smith classify-url https://policy.example.com/ --rules org_rules.yaml
3. classify — batch classify (no HTTP check)
Input file should contain one URL per line.
CSV output
urlcheck-smith classify urls.txt -o classified.csv
JSONL output
urlcheck-smith classify urls.txt --format jsonl -o out.jsonl
Quiet mode
urlcheck-smith classify urls.txt --quiet
Explain mode
urlcheck-smith classify urls.txt --explain -o out.jsonl
Rule System
Custom rule file example
suffix_rules:
- suffix: ".go.jp"
category: government
- suffix: ".example.com"
category: internal
default_category: private
Built-in presets
--preset japan--preset eu--preset global
Each corresponds to a YAML file under urlcheck_smith/data/.
Development
make install
make test
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file urlcheck_smith-0.2.0.tar.gz.
File metadata
- Download URL: urlcheck_smith-0.2.0.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40a68be4c627deb2db047b85e53ad73cb2312c9cad53f1d0008266377e815742
|
|
| MD5 |
f5103424b4266bebacda6e3c36249879
|
|
| BLAKE2b-256 |
97ed37f18655e10b773ec28f89c419fb204b3eaba9cf7a90587730a9904d311d
|
File details
Details for the file urlcheck_smith-0.2.0-py3-none-any.whl.
File metadata
- Download URL: urlcheck_smith-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c7367d3ae36347ae679e234a76d6b8c432f9f844218e10bdc52406faae0806d
|
|
| MD5 |
985ceb05253c549fd75b1475eadecd1a
|
|
| BLAKE2b-256 |
83d8e5174cd8946df38fe1635bcc9f8e0ca8a7e7d39af1a524cadf16135b75ea
|