{"_id":"@bodaso/tidy-url","name":"@bodaso/tidy-url","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@bodaso/tidy-url","version":"0.0.1","description":"Cleans/removes tracking or garbage parameters from URLs","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"test":"ts-node test.ts","build":"tsc && webpack && ts-node src/postbuild.ts","prepare":"npm run build","version":"git add -A src","postversion":"git push && git push --tags"},"repository":{"type":"git","url":"git+https://github.com/bodaso/tidy-url.git"},"keywords":["tidy","clean","sanitize","url","website","tracking","remove","junk"],"author":"","license":"MIT","bugs":{"url":"https://github.com/bodaso/tidy-url/issues"},"homepage":"https://github.com/bodaso/tidy-url#readme","devDependencies":{"@types/node":"^22.2.0","@typescript-eslint/eslint-plugin":"^8.0.1","@typescript-eslint/parser":"^8.0.1","eslint":"^9.9.0","prettier":"^3.3.3","ts-loader":"^9.5.1","ts-node":"^10.9.2","typescript":"^5.5.4","webpack":"^5.93.0","webpack-cli":"^5.1.4"},"_id":"@bodaso/tidy-url@0.0.1","gitHead":"d351278e5abc2b41a86bf601c6c1829299bc9d19","_nodeVersion":"20.16.0","_npmVersion":"10.8.1","dist":{"integrity":"sha512-nLwv3mAi6/5fviotAdZanqyIyOsNRfr6n62fiTiNCBRbTnQVdWunOq2uimDOPeJmc2xF0NWeFspZH4dzWwVooQ==","shasum":"141d6a7d4304461da7ee10165f38f259f4c7903b","tarball":"https://registry.npmjs.org/@bodaso/tidy-url/-/tidy-url-0.0.1.tgz","fileCount":37,"unpackedSize":186343,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID9LrQkC/HXEtz79e47H8R6LWK8r0yVWQatVY26+V96IAiBXEqKs/Cb/p32yS0bLGrxQLZmLO+1GjCiiwXTcdQH7fw=="}]},"_npmUser":{"name":"bodaz","email":"bodazhao@gmail.com"},"directories":{},"maintainers":[{"name":"bodaz","email":"bodazhao@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tidy-url_0.0.1_1723328661558_0.20634585720257181"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-10T22:24:21.473Z","0.0.1":"2024-08-10T22:24:21.763Z","modified":"2024-08-10T22:24:22.025Z"},"maintainers":[{"name":"bodaz","email":"bodazhao@gmail.com"}],"description":"Cleans/removes tracking or garbage parameters from URLs","homepage":"https://github.com/bodaso/tidy-url#readme","keywords":["tidy","clean","sanitize","url","website","tracking","remove","junk"],"repository":{"type":"git","url":"git+https://github.com/bodaso/tidy-url.git"},"bugs":{"url":"https://github.com/bodaso/tidy-url/issues"},"license":"MIT","readme":"# [![Tidy-URL](text-logo.png)](#)\n\nA Node Package & Userscript that removes tracking or garbage parameters from URLs making them shorter, cleaner and a lot nicer to read.\n\n[![NPM](https://img.shields.io/npm/v/tidy-url)](https://www.npmjs.com/package/tidy-url)\n[![NPM](https://img.shields.io/npm/dt/tidy-url)](https://www.npmjs.com/package/tidy-url)\n[![NPM](https://img.shields.io/npm/types/tidy-url)](https://www.npmjs.com/package/tidy-url)\n\n## Install:\n\nYou can use this automatically in the browser with the [userscript](https://github.com/DrKain/tidy-url/wiki/Userscript).\n\n-   [Node Package Manager](https://github.com/DrKain/tidy-url/wiki/Node-Package) (NPM)\n-   [Browser](https://github.com/DrKain/tidy-url/wiki/Userscript) (userscript)\n-   [jsDelivr](https://github.com/DrKain/tidy-url/wiki/jsDelivr)\n\n## Get Started\n\n```sh\nnpm install @bodaso/tidy-url\n```\n\n```js\nimport { TidyURL } from '@bodaso/tidy-url';\n```\n\n### Usage\n\nThen pass it a URL and let the magic happen:\n\n```js\nconst link = TidyURL.clean('https://open.spotify.com/track/1hhZQVLXpg10ySFQFxGbih?si=-k8RwDQwTCK923jxZuy07w&utm_source=copy-link');\nconsole.log(link.url); // https://open.spotify.com/track/1hhZQVLXpg10ySFQFxGbih\n```\n\n### Validating\n\nYou can validate a URL using the `validate` function.\n\n```js\nTidyURL.validate('https://example.com'); // true\nTidyURL.validate('cat'); // false\nTidyURL.validate('google.com'); // false (protocol is required!)\n```\n\n### AMP & Redirects\n\nBy default, tidy-url will remove redirect parameters and AMP links if the rule supports it.  \nYou can disable this feature with `allowRedirects` and `allowAMP`.\nExamples:\n\n```ts\n// These are the defaults.\nTidyURL.config.setMany({\n    allowAMP: false,\n    allowRedirects: true\n});\n\nTidyURL.clean('https://www.google.com/amp/s/github.com');\nTidyURL.clean('https://steamcommunity.com/linkfilter/?url=https://github.com');\n// Result for both: https://github.com\n```\n\n_More info about AMP on [the wiki](https://github.com/DrKain/tidy-url/wiki/AMP-Links)_.\n\n### Note\n\nYou will always receive a valid response, even if nothing was modified. For example:\n\n```js\nconst link = TidyURL.clean('https://duckduckgo.com/this-is-fine');\n\nlink.url; // https://duckduckgo.com/this-is-fine\nlink.info.reduction; // 0 (percent)\n```\n\n### Supported Sites\n\nYou can view all custom supported sites [here](https://github.com/DrKain/tidy-url/wiki/Supported-Sites).  \nHowever, the global rules will be enough to work with thousands of sites around the internet. You should be able to pass any URL for cleaning.  \nRequest direct support for a website [here](https://github.com/DrKain/tidy-url/issues/new?assignees=&labels=&template=add-website.md&title=Website%3A+example.com)\n\n### Response\n\nThe response will always be an object with details of what was cleaned or modified in the URL.  \nThis can be used for debugging, testing or a simple way of letting users know they could have sent a shorter link.\n\n```json\n{\n    \"url\": \"https://open.spotify.com/track/1hhZQVLXpg10ySFQFxGbih\",\n    \"info\": {\n        \"original\": \"https://open.spotify.com/track/1hhZQVLXpg10ySFQFxGbih?si=-k8RwDQwTCK923jxZuy07w&utm_source=copy-link\",\n        \"reduction\": 47,\n        \"difference\": 47,\n        \"replace\": [],\n        \"removed\": [\n            {\n                \"key\": \"utm_source\",\n                \"value\": \"copy-link\"\n            },\n            {\n                \"key\": \"si\",\n                \"value\": \"-k8RwDQwTCK923jxZuy07w\"\n            }\n        ],\n        \"match\": [\n            {\n                \"rules\": [\"si\", \"utm_source\", \"context\"],\n                \"replace\": [],\n                \"redirect\": \"\",\n                \"name\": \"spotify.com\",\n                \"match\": \"/open.spotify.com/i\"\n            }\n        ],\n        \"decoded\": null,\n        \"isNewHost\": false,\n        \"fullClean\": true\n    }\n}\n```\n\n### Example\n\nTurn these monstrosities:\n\n```\nhttps://poetsroad.bandcamp.com/?from=search&search_item_id=1141951669&search_item_type=b&search_match_part=%3F&search_page_id=1748155363&search_page_no=1&search_rank=1&search_sig=a9a9cbdfc454df7c2999f097dc8a216b\n\nhttps://www.audible.com/pd/Project-Hail-Mary-Audiobook/B08G9PRS1K?plink=GZIIiCHG0Uo5V8ND&ref=a_hp_c9_adblp13nmpxxp13n-mpl-dt-c_1_2&pf_rd_p=164101a8-2aab-4c5e-91ee-1f39e10719e6&pf_rd_r=2Q5R6VH8HJAD48PSQRS4\n\nhttps://www.amazon.com/Alexander-Theatre-Sessions-Poets-Fall/dp/B08NT852YT/ref=sr_1_1?dchild=1&keywords=Poets+of+the+fall&qid=1621684985&sr=8-1\n\nhttps://open.spotify.com/track/1hhZQVLXpg10ySFQFxGbih?si=-k8RwDQwTCK923jxZuy07w&utm_source=copy-link\n\nhttps://www.aliexpress.com/item/1005001913861188.html?spm=a2g0o.productlist.0.0.b1c55e86sFKsxH&algo_pvid=b4648621-2371-4d1e-9a9c-89b4d6c59395&algo_expid=b4648621-2371-4d1e-9a9c-89b4d6c59395-0&btsid=0b0a556816216865399393168e562d&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_\n\nhttps://www.google.com/search?q=cat&source=hp&ei=AwGpYKzyE7uW4-EPy_CnSA&iflsig=AINFCbYAAAAAYKkPE4rmSi0Im0sHgmOVb3DYosyq2B0B&oq=cat&gs_lcp=Cgdnd3Mtd2l6EAMyBQguEJMCMgIILjICCAAyAggAMgIILjICCAAyAggAMgIILjICCC4yAgguOggIABDqAhCPAToLCC4QxwEQowIQkwI6CAguEMcBEKMCUNgEWIQHYMwIaAFwAHgAgAHIAYgB2ASSAQMyLTOYAQCgAQGqAQdnd3Mtd2l6sAEK&sclient=gws-wiz&ved=0ahUKEwjs_9PdrN3wAhU7yzgGHUv4CQkQ4dUDCAY&uact=5\n\nhttps://www.emjcd.com/links-i/?d=eyJzdXJmZXIiOiIxMDAzMDQ3Mjg5ODMzODAxMDI6VlBTbFlUN3JBeHpsIiwibGFzdENsaWNrTmFtZSI6IkxDTEsiLCJsYXN0Q2xpY2tWYWx1ZSI6ImNqbyF4aTU5LXZ0Zm1nOTkiLCJkZXN0aW5hdGlvblVybCI6Imh0dHBzOi8vd3d3LnZ1ZHUuY29tL2NvbnRlbnQvbW92aWVzL2RldGFpbHMvTW9vbmxpZ2h0LVNlYXNvbi0xLzEzMzEyMCIsInNpZCI6IltzdWJpZF92YWx1ZV0iLCJ0eXBlIjoiZGxnIiwicGlkIjo5MDExNjczLCJldmVudElkIjoiMGFjZGE1ZDdmNzNlMTFlYzgyYWM3NDliMGExYzBlMGUiLCJjalNlc3Npb24iOiIyZjBjNGNjYi1lNmVmLTQ0YzItYjIzYy02NzNjZjY2MTZlMTYiLCJsb3lhbHR5RXhwaXJhdGlvbiI6MCwicmVkaXJlY3RlZFRvTGl2ZXJhbXAiOmZhbHNlLCJjakNvbnNlbnRFbnVtIjoiTkVWRVJfQVNLRUQifQ%3D%3D\n\nhttps://www.youtube.com/redirect?event=video_description&redir_token=QCFCLUhqbUVVVVc2Vm53OGdFMi15NU1vSzloWkZveGcyUXxBQ3Jtc0tsR143azQxRVpxZ3lUampXUEkyaTdpdy1reU1OVGcyb3pmOUhzU22Ldm5QZ0tueEMzMy1TQTA1Mm85SEpCUW14UHlq11ZCUVlhU3QzdW52U2Uyd01pbTVINDRjNlhf124ySEZqMHBJbnFEWDdiMTNUVQ&q=https%3A%2F%2Ftomscott.com%2F&v=k7fXbdRH9v4\n```\n\nInto these:\n\n```\nhttps://poetsroad.bandcamp.com/\n\nhttps://www.audible.com/pd/Project-Hail-Mary-Audiobook/B08G9PRS1K\n\nhttps://www.amazon.com/Alexander-Theatre-Sessions-Poets-Fall/dp/B08NT852YT\n\nhttps://open.spotify.com/track/1hhZQVLXpg10ySFQFxGbih\n\nhttps://www.aliexpress.com/item/1005001913861188.html\n\nhttps://www.google.com/search?q=cat\n\nhttps://www.vudu.com/content/movies/details/Moonlight-Season-1/133120\n\nhttps://tomscott.com/\n```\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome and greatly appreciated!  \nFeel free to check [issues page](https://github.com/DrKain/tidy-url/issues).\nIf you find a website that is not supported, please create an issue and I'll be more than happy to add it.\n\n## 👤 Author\n\nThis project was made by **Kain (ksir.pw)**  \nFeel free to contact me if you have any trouble with this package.\n\n-   Website: [ksir.pw](https://ksir.pw)\n-   Github: [@DrKain](https://github.com/DrKain)\n-   Discord: drkain\n","readmeFilename":"README.md"}