mchangrh / sb-slash

Sponsorblock with discord slash commands
https://sb-slash.mchang.workers.dev/invite
GNU General Public License v3.0
6 stars 6 forks source link

ShareUnsubmitted links don't work correctly when pasted into Discord #62

Closed AcesFullOfKings closed 2 years ago

AcesFullOfKings commented 2 years ago

I used /shareunsubmitted and it generated this URL:

https://www.youtube.com/watch?v=56J0wOTll5c#segments=[%7B%22segment%22:[0,7.947],%22category%22:%22intro%22,%22actionType%22:%22skip%22%7D]

When this link is pasted into a discord channel, notice the white un-linked ] on the end:

image

Without that bracket, clicking the link doesn't correctly load the segment. This can be resolved in general without damaging the URL by appending an ampersand:

https://www.youtube.com/watch?v=56J0wOTll5c#segments=[%7B%22segment%22:[0,7.947],%22category%22:%22intro%22,%22actionType%22:%22skip%22%7D]&

So the bot should probably automatically add the & so that when it's pasted in discord it works correctly when clicked. It's easy to miss the white ]

Demo here: https://discord.com/channels/603643120093233162/603643205552177155/1014877479548227614

Veeno commented 2 years ago

This is a Discord-side issue which can be resolved by surrounding the URL with <>, like so: <https://www.youtube.com/watch?v=56J0wOTll5c#segments=[%7B%22segment%22:[0,7.947],%22category%22:%22intro%22,%22actionType%22:%22skip%22%7D]> or with () if embedding is desired: (https://www.youtube.com/watch?v=56J0wOTll5c#segments=[%7B%22segment%22:[0,7.947],%22category%22:%22intro%22,%22actionType%22:%22skip%22%7D])

AcesFullOfKings commented 2 years ago

Yes, it's a discord issue. The URL is valid and should be fully linked, which is their bug. However, as the bot runs in discord, it should really produce links which can be pasted into a discord channel without knowing the secret backdoor modification needed to make them work. I chose ampersand because it doesn't change the url at all, but any good solution would produce links which can be copy-pasted/clicked in a discord channel without being broken by their formatting

AcesFullOfKings commented 2 years ago

sorry, didn't mean to close this when I saved the comment

mchangrh commented 2 years ago

shareunsubmitted generates a link in an embed for a reason. The problem is that youtube will nuke any parameters or the # if any of them aren't formatted correctly, making the entire thing useless. I'll see what valid parameters I can get away with