Skip to main content

Clean Links

Release Build status codecov Commit activity License

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.

Metadata

Release files for clean_links 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clean_links 0.2.2
File Size Uploaded Provenance
clean_links-0.2.2.tar.gz 38.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for clean_links 0.2.2
File Interpreter ABI Platform
clean_links-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 78.7 kB

Security for clean_links 0.2.2

Provenance

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page