Clean Links
Decide whether two links point at the same resource — so you can
de-duplicate and count links shared across feeds (a Nuzzel-style use case).
Shorteners hide the destination and per-share tracking parameters mean the final
URLs rarely match as strings; clean-links follows the redirects, strips the
cruft, and compares what's left.
Using an AI coding agent? See
llms.txt— an LLM-oriented reference covering the full API, the persistent-cache recipe, and the behavioral contracts (caching, TTLs, rate limits, error handling) that function signatures don't reveal.
Install with:
pip install clean_links
Are two shortened, tracking-tagged links the same article?
>>> from clean_links import are_equivalent_sync
>>> are_equivalent_sync(
... "https://bit.ly/some-short-link",
... "https://trib.al/another-one",
... )
True
Or count how many links in a batch point at the same thing:
>>> from clean_links import group_sync
>>> groups = group_sync([
... "https://bit.ly/some-short-link",
... "https://trib.al/another-one",
... "https://example.com/unrelated",
... ])
>>> {key: len(members) for key, members in groups.items()}
{'https://www.bloomberg.com/news/articles/...': 2, 'https://example.com/unrelated': 1}
These calls make live network requests to follow the redirects. The library is
async-first — drop the _sync suffix for the coroutine API — and an
Engine with a SqliteStore resolves each link once and reuses it across runs.
See the documentation here.
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 clean_links-0.2.2.tar.gz.
File metadata
- Download URL: clean_links-0.2.2.tar.gz
- Upload date:
- Size: 38.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.4.1 CPython/3.12.14 Linux/6.17.0-1022-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02a7112a44e7479bef8b55acfa9f78f0fd10321576088ebceb80caa4ce70c253
|
|
| MD5 |
ebac69b47554a87c39968bc898d05e18
|
|
| BLAKE2b-256 |
28a2d483f996d98c2eb0ef75b9bf57e9af6b9a3ea200dfb55eb792e5d125435e
|
File details
Details for the file clean_links-0.2.2-py3-none-any.whl.
File metadata
- Download URL: clean_links-0.2.2-py3-none-any.whl
- Upload date:
- Size: 40.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.4.1 CPython/3.12.14 Linux/6.17.0-1022-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2201b7195b61c4c0d9508ae82ee98cf65cafeaced0094e44d1b18cf8995a9660
|
|
| MD5 |
a8ec8272facce25091227aaf04e17abc
|
|
| BLAKE2b-256 |
719edc9c8b15d275fa0c95400580598b23350a94cb9456824af15b03ee8b2049
|