I know firefox has the very useful “Copy clean Link” option in the context menu, but I would like a similar feature for copying links from any other software, like spotify for example. So I am looking for some software that hooks into the clipboard pipeline, and cleans any URL that gets added. I tried googling for something like it, but was completely unsuccessful. Does anyone have a clue how I might go about achieving this?

Thanks in advance :)

Edit: I found out about klipper’s actions, which provide the option to run a command when a string that matches a regex is added to the clipboard buffer. I am not sure how to properly use this though, so any help is appreciated!

  • enkers@sh.itjust.works
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    13 hours ago

    That’d be cool. Whenever I’m sharing a YT link, I’m always a bit suspicious of what info the youtu.be URL is hiding, so I paste it into a browser to get a clean URL.

    Maybe this is silly, but I’d be cool to do that automatically.

    • ivn@jlai.lu
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      8 hours ago

      Well for youtube it’s quite easy, there are only 4 useful parameters that I can think of, the video id v, the playlist id list and index if it’s a playlist and the time t if you’re sending a specific time in the video. Everything else can be removed. Here’s what uBlock Origin with the AdGuard URL Tracking filter list:

      ! Youtube
      $removeparam=embeds_referring_euri,domain=youtubekids.com|youtube-nocookie.com|youtube.com
      $removeparam=embeds_referring_origin,domain=youtubekids.com|youtube-nocookie.com|youtube.com
      $removeparam=source_ve_path,domain=youtubekids.com|youtube-nocookie.com|youtube.com
      ||youtube.com^$removeparam=pp