Created
May 2, 2025 17:48
-
-
Save ashkrosh/9c91d2c9f39591550058d5cf71cc5dad to your computer and use it in GitHub Desktop.
Popclip Clean Link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PopClip extension: Clean Link | |
name: Clean Link | |
icon: symbol:circle.slash | |
requirements: [url] | |
# Strip off tracking/query params and copy to clipboard | |
javascript: | | |
// Get the selected URL | |
let url = popclip.input.text | |
// remove everything from "?" onward | |
.replace(/(\?.*)$/, '') | |
// collapse Amazon /dp/… URLs to the ASIN path only | |
.replace(/(\/dp\/[A-Z0-9]+)(\/|$).*/, '$1'); | |
// Copy the cleaned URL onto the system pasteboard | |
popclip.copyText(url); | |
description: > | |
Remove tracking codes and affiliate paths from the selected URL, | |
then copy the cleaned URL to the clipboard. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment