Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ashkrosh/9c91d2c9f39591550058d5cf71cc5dad to your computer and use it in GitHub Desktop.
Save ashkrosh/9c91d2c9f39591550058d5cf71cc5dad to your computer and use it in GitHub Desktop.
Popclip Clean Link
# 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