Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom button URL custom separators #217

Open
Kristjan-Ai opened this issue May 3, 2023 · 7 comments
Open

Custom button URL custom separators #217

Kristjan-Ai opened this issue May 3, 2023 · 7 comments

Comments

@Kristjan-Ai
Copy link

I wanted to change the custom button's behaviour to search for the currently playing song on spotify. So I changed the URL in the settings to this: https://open.spotify.com/search/[TrackTitle]%20[Artist]
The problem is that if the track title's or the artist's values contain spaces then the spaces turn into "+" signs and the spotify search includes these plus signs (see screenshot) and so it doesn't find the correct song.
I know that this is the correct/default behaviour and that this works for some or most websites.

It would be great if there was a setting for changing the "+" signs into any other string, for example "%20" so the spaces stay as spaces in the URL. Or you could just point me to the line of code where this is set and I can change it manually.

image

@Kristjan-Ai
Copy link
Author

I found issue #178 and set a virtual tag like this: ###<Title>\%20<Artist>
But it still doesn't work like in this example:
###some\/text with whitespace -> some/text%20with%20whitespace
The whitespaces still turn into + signs.

@sll552
Copy link
Owner

sll552 commented May 4, 2023

Does spotify handle %20 correctly?
Technically everything works as intended because + is defined as URL encoded whitespace. I use the standard C# URL encoder which works according to standards.
If spotify does not handle encoded URLs correctly that's unfortunate but I do not want to break the encoding because one site doesn't know how to parse their URLs correctly.

@Kristjan-Ai
Copy link
Author

Kristjan-Ai commented May 4, 2023

It's the same on deezer.com too.
It isn't actually as bad as I thought at first because spotify and deezer still find the correct songs.
The only downside is that you can't copy the text from the search bar and paste it in a text without manually replacing the + signs.

@sll552
Copy link
Owner

sll552 commented May 4, 2023

I will take a look, maybe there is an URL encoder that does exclusively use percent-encoding. This should help with compatibility

@sll552
Copy link
Owner

sll552 commented May 4, 2023

@Kristjan-Ai
Copy link
Author

Works, but what did you change?

@sll552
Copy link
Owner

sll552 commented May 4, 2023

I changed the encoder.
C# (or more dotnet) has a few different ones that also work differently. I originally used the one that was recommended in the docs, but the new one seems to be the most reliable one and is generally recommended by devs.
This change should not break anything so it will be included in the next release. Until that you can keep using the version I sent you, but the link will expire in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants