fwenzel / copy-shorturl

A Firefox extension to quickly create a short URL for the current page and copy it to the clipboard.
https://addons.mozilla.org/addon/copy-shorturl
Apache License 2.0
35 stars 15 forks source link

Youtube special shortener (youtu.be) is not applied #130

Closed 64kramsystem closed 2 years ago

64kramsystem commented 2 years ago

I have the option "Use special case URL formats for known sites enabled"; for example, github.com URLs are shortened to git.io.

However, this doesn't happen for Youtube URLs, which, instead of being shortened to youtu.be are shortened to the my default shortener.

Example: https://www.youtube.com/watch?v=mPtouOS0gxE is not shortened to https://youtu.be/mPtouOS0gxE.

fwenzel commented 2 years ago

Thank you! I will check this. It is possible Youtube changed their website in a way that breaks copy shorturl :-/

fwenzel commented 2 years ago

I cannot confirm - the example here is correctly shortened for me to youtu . be.

Can you show me the add-on settings? Mine look like this:

image
64kramsystem commented 2 years ago

Hello! Thanks for the quick reply :)

These are my preferences:

image

I've also tested with all the other addons disabled, in order to avoid interference.

If nothing obvious pops up, I'll try to debug it. I suppose that the addon works by pattern matching the source URL, so I should be able to display the input value in a popup. I'm not a JS/addons programmer, so this may take a bit :smile:

fwenzel commented 2 years ago

I'll try with your settings - very good chance that I made a little mistake somewhere.

Oh! Perhaps the "24" makes it get shortened anyway. I will try.

fwenzel commented 2 years ago

Ah yes! This is exactly what happens:

The add-on looks at the main URL and turns it into https://youtu.be/mPtouOS0gxE which is longer than 24 characters, so it sends it to the shortening service.

Two options:

I am almost thinking not force-shortening special URLs is the most expected behavior.

64kramsystem commented 2 years ago

Ah yes! This is exactly what happens:

The add-on looks at the main URL and turns it into https://youtu.be/mPtouOS0gxE which is longer than 24 characters, so it sends it to the shortening service.

Two options:

* you make the number higher, and it won't force-shorten this URL, _or_

* I change the code so that special-case URLs (currently: amazon, github, youtube) are never force-shortened.

I am almost thinking not force-shortening special URLs is the most expected behavior.

Ah! I misunderstood the meaning of that setting :man_facepalming:.

I change the code so that special-case URLs (currently: amazon, github, youtube) are never force-shortened.

I've just increased the value, so for my case, nothing to change :smile: Regarding the other option, I have no idea what would be the reaction of the userbase :grin:

Thanks again for the attention :smile: Issue can be closed for me!