Walkyst / lavaplayer-fork

Apache License 2.0
173 stars 68 forks source link

No matches found using ytsearch with query including special characters #54

Closed Hydro001 closed 2 years ago

Hydro001 commented 2 years ago

Description

Hi,

When using ytsearch with a query containing "é" or "à" or any "special" character, for exemple Video détaillée, i get : No matches found and when looking at the request it replaces "é" with "Θ" for exemple, it replaces other special characters too, so i think that the problem comes from lavaplayer not handling UTF-8 characters correctly or something like that.

Thanks.

Error (It's using lavalink but even when doing the query directly to lavaplayer it doesn't work) :

2022-06-25 23:58:07.312  INFO 13696 --- [  XNIO-1 task-1] l.server.player.AudioLoaderRestHandler   : Got request to load for identifier "ytsearch:Hugo DΘcrypte - Annonces de Macron dΘtaillΘes, dΘputΘs accusΘs, trΘsor α 17 milliards d'Ç... Actus du jour"
2022-06-25 23:58:07.533  INFO 13696 --- [ader-2-thread-1] lavalink.server.player.AudioLoader       : No matches found

Output of java -version:

java version "17.0.2" 2022-01-18 LTS
Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)

Version used: 1.3.97.1 (Latest)

Walkyst commented 2 years ago

This is your lavalink client sending that query to lavaplayer, just tried Video détaillée search request and everything fine

devoxin commented 2 years ago

For clarification, an issue was made on Lavalink's repo. Multiple attempts were made by different users with different findings.

What we've found:

With regards to that last point, if you test the full query that Hydro has been using, in the linked issue: Annonces de Macron détaillées, députés accusés, trésor à 17 milliards d'€, there are no results. Same if you search the exact same video title Le discours à 20h de Macron résumé, députés accusés, trésor à 17 milliards d'€... Actus du jour, yet searching via the YT website displays the desired video.

Shortening the query to a handful of keywords works absolutely fine, though.

Walkyst commented 2 years ago

Try make same request what LP do

https://youtubei.googleapis.com/youtubei/v1/search?key=AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w

{"context":{"client":{"clientName":"ANDROID","clientVersion":"16.24"}},"query":"Le discours à 20h de Macron résumé, députés accusés, trésor à 17 milliards d'€... Actus du jour","params":"EgIQAQ=="}
devoxin commented 2 years ago

{"context":{"client":{"clientName":"ANDROID","clientVersion":"16.24"}},"query":"Le discours à 20h de Macron résumé, députés accusés, trésor à 17 milliards d'€... Actus du jour","params":"EgIQAQ=="}

This doesn't appear to return any results.

Walkyst commented 2 years ago

So there is answer

devoxin commented 2 years ago

Not quite. Personally, I would've expected LP to return this

Hydro001 commented 2 years ago

So there is no way to fix this if i understand correctly ?

devoxin commented 2 years ago

Update to the issue, I have been informed that LP potentially sets a video filter (presumably to weed out livestreams in search results). This coincides with the behaviour I've seen on the YT website itself, where setting a video filter removes the result from search, so I suppose there's genuinely no issue here.

So there is no way to fix this if i understand correctly ?

@Hydro001 Your character encoding issue is caused by your client, you will have to contact the library maintainer about this. I suppose it's my bad, as I originally thought your issue was because this video wouldn't show up in search results at all, I hadn't realised your issue was queries like Video détaillée returning no results.

I have personally tested my own (Python) library and had no issues finding results, and the query was printed in console correctly.

Hydro001 commented 2 years ago

I wasn't talking about Video détaillée, it's Annonces de Macron détaillées, députés accusés, trésor à 17 milliards d'€ that's bothering me, sorry if i was unclear

Hydro001 commented 2 years ago

And even when using no client it doesn't work

Hydro001 commented 2 years ago

Searching Video détaillée gives me result as usual, it's Annonces de Macron détaillées, députés accusés, trésor à 17 milliards d'€ that doesn't

devoxin commented 2 years ago

Works if you use less keywords. I both do, and don't know why the longer query doesn't work. The reason why it doesn't work is because Lavaplayer apparently applies a video filter to searching (presumably to filter out live-streams?). Setting this filter returns no results. Removing this filter should, in theory, return results. This behaviour is inline with the YT website's. However, I don't know why this is the case - as the result is definitely a video, although there's not really a lot that can be done here to fix this issue, without introducing breaking changes.

Walkyst commented 2 years ago

presumably to filter out live-streams

Not really, after that YouTube updated to InnerTube, search start work differently and adding to response things like New for you, People also watched for keeping how it previusly work this filter was added

Hydro001 commented 2 years ago

Works if you use less keywords. I both do, and don't know why the longer query doesn't work. The reason why it doesn't work is because Lavaplayer apparently applies a video filter to searching (presumably to filter out live-streams?). Setting this filter returns no results. Removing this filter should, in theory, return results. This behaviour is inline with the YT website's. However, I don't know why this is the case - as the result is definitely a video, although there's not really a lot that can be done here to fix this issue, without introducing breaking changes.

I don't know if it's a good idea to slice the query because i'm extracting the spotify track title and searching it on Youtube, wouldn't slicing it make my programm less trustable for the results it gives ?

Hydro001 commented 2 years ago

Just a question, does doing an axios request on the /loadtracks?identifier=video_id endpoint makes a request to Youtube or is it just encoding the song, and if it does make a request, can i just tell it to only encode the track (Only give me the track property) and not the other info ?