{"id":34023922,"url":"https://github.com/xojoc/cleanurl","last_synced_at":"2026-04-05T11:31:21.049Z","repository":{"id":62562547,"uuid":"456125905","full_name":"xojoc/cleanurl","owner":"xojoc","description":"Remove clutter from URLs and return a canonicalized version","archived":false,"fork":false,"pushed_at":"2024-06-03T10:08:59.000Z","size":79,"stargazers_count":21,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-05T11:18:24.906Z","etag":null,"topics":["url","url-normalization"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/cleanurl/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xojoc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-06T11:03:26.000Z","updated_at":"2025-06-18T15:09:37.000Z","dependencies_parsed_at":"2022-11-03T15:30:43.652Z","dependency_job_id":null,"html_url":"https://github.com/xojoc/cleanurl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xojoc/cleanurl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xojoc%2Fcleanurl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xojoc%2Fcleanurl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xojoc%2Fcleanurl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xojoc%2Fcleanurl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xojoc","download_url":"https://codeload.github.com/xojoc/cleanurl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xojoc%2Fcleanurl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31434624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T08:13:15.228Z","status":"ssl_error","status_checked_at":"2026-04-05T08:13:11.839Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["url","url-normalization"],"created_at":"2025-12-13T16:03:43.175Z","updated_at":"2026-04-05T11:31:21.042Z","avatar_url":"https://github.com/xojoc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cleanurl\nRemove clutter from URLs and return a canonicalized version\n\n# Install\n```\npip install cleanurl\n```\nor if you're using poetry:\n```\npoetry add cleanurl\n```\n\n# Usage\nBy default *cleanurl* retuns a cleaned URL without respecting semantics.\nFor example:\n\n```\n\u003e\u003e\u003e import cleanurl\n\u003e\u003e\u003e r = cleanurl.cleanurl('https://www.xojoc.pw/blog/focus.html?utm_content=buffercf3b2\u0026utm_medium=social\u0026utm_source=snapchat.com\u0026utm_campaign=buffe')\n\u003e\u003e\u003e r.url\n'https://xojoc.pw/blog/focus'\n\u003e\u003e\u003e r.parsed_url\nParseResult(scheme='https', netloc='xojoc.pw', path='/blog/focus', params='', query='', fragment='')\n```\n\nThe default parameters are useful if you want to get a *canonical* URL without caring if the resulting URL is still valid.\n\nIf you want to get a clean URL which is still valid call it like this:\n\n```\n\u003e\u003e\u003e r = cleanurl.cleanurl('https://www.xojoc.pw/blog/////focus.html', respect_semantics=True)\n\u003e\u003e\u003e r.url\n'https://www.xojoc.pw/blog/focus.html'\n```\n\n```celeanurl.cleanurl``` parameters:\n\n - ```generic``` -\u003e if True don't use site specific rules\n - ```respect_semantics``` -\u003e if True make sure the returned URL is still valid, altough it may still contain some superfluous elements\n - ```host_remap``` -\u003e whether to remap hosts. Example:\n```\n\u003e\u003e\u003e import cleanurl\n\u003e\u003e\u003e cleanurl.cleanurl('https://threadreaderapp.com/thread/1453753924960219145', host_remap=True).url\n'https://twitter.com/i/status/1453753924960219145'\n\u003e\u003e\u003e cleanurl.cleanurl('https://threadreaderapp.com/thread/1453753924960219145', host_remap=False).url\n'https://threadreaderapp.com/thread/1453753924960219145'\n```\n\nFor more examples see the [unit tests](https://github.com/xojoc/cleanurl/blob/main/src/test_cleanurl.py).\n\n\n# Why?\nWhile there are some libraries that handle general cases, this library has website specific rules that more aggresivly normalize urls.\n\n# Users\nInitially used for [discu.eu](https://discu.eu).\n\n[Discussions around the web](https://discu.eu/q/https://github.com/xojoc/cleanurl)\n\n# Who?\n*cleanurl* was written by [Alexandru Cojocaru](https://xojoc.pw).\n\n# License\n*cleanurl* is [Free Software](https://www.gnu.org/philosophy/free-sw.html) and is released as [AGPLv3](https://github.com/xojoc/cleanurl/blob/main/LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxojoc%2Fcleanurl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxojoc%2Fcleanurl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxojoc%2Fcleanurl/lists"}