retrouser955 / discord-player-youtubei

Super charging your bot. dpy is a tiny extractor module to test the validity of youtubei.js in discord-player version 7.
https://discord-player.js.org
Creative Commons Zero v1.0 Universal
25 stars 6 forks source link

Youtube link with "list" search param errors out #13

Open iTsMaaT opened 3 months ago

iTsMaaT commented 3 months ago

Trying this link for example:

https://www.youtube.com/watch?v=KltK-3QHIjI&list=OLAK5uy_lc3hcbsPXaYpKLrdowf5RS7hGgyegqFx4

Throws this error

[18-07-2024 15:32:43.161 -   ERROR] ERR_NO_RESULT [Error]: [ERR_NO_RESULT] No results found for "[object Object]" (Extractor: N/A)
    at Proxy.<anonymous> (C:\Users\[user]\OneDrive\Bureau\WD-40\node_modules\discord-player\dist\index.js:324:25)
    at _Player.play (C:\Users\[user]\OneDrive\Bureau\WD-40\node_modules\discord-player\dist\index.js:5632:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.execute (C:\Users\[user]\OneDrive\Bureau\WD-40\Commands\text\music\play.js:127:23)
    at async handleCommand (C:\Users\[user]\OneDrive\Bureau\WD-40\events\client\messageCreate.js:212:21)

Here are the debug logs:

Searching https://www.youtube.com/watch?v=KltK-3QHIjI&list=OLAK5uy_lc3hcbsPXaYpKLrdowf5RS7hGgyegqFx4
Search engine set to autoSearch, fallback search engine set to autoSearch
Protocol https detected in query
Could not find an extractor that supports https protocol. Falling back to default behavior...
Query type identified as autoSearch
Checking cache...
Cache miss for query https://www.youtube.com/watch?v=KltK-3QHIjI&list=OLAK5uy_lc3hcbsPXaYpKLrdowf5RS7hGgyegqFx4
Executing extractors...
Executing extractor com.retrouser955.discord-player.discord-player-youtubei...
Extractor com.retrouser955.discord-player.discord-player-youtubei executed successfully!
Executing metadata query using com.retrouser955.discord-player.discord-player-youtubei extractor...
Metadata query was successful!
Adding data to cache...
Searching https://www.youtube.com/watch?v=KltK-3QHIjI&list=OLAK5uy_lc3hcbsPXaYpKLrdowf5RS7hGgyegqFx4
Search engine set to auto, fallback search engine set to autoSearch
Protocol https detected in query
Could not find an extractor that supports https protocol. Falling back to default behavior...
Query type identified as youtubePlaylist
Checking cache...
Cache miss for query https://www.youtube.com/playlist?list=OLAK5uy_lc3hcbsPXaYpKLrdowf5RS7hGgyegqFx4
Executing extractors...
Executing extractor com.retrouser955.discord-player.discord-player-youtubei...
Extractor com.retrouser955.discord-player.discord-player-youtubei executed successfully!
Executing metadata query using com.retrouser955.discord-player.discord-player-youtubei extractor...
Failed to find result using appropriate extractor. Querying all extractors...
Executing extractor com.retrouser955.discord-player.discord-player-youtubei...
Executing extractor com.discord-player.spotifyextractor...
Executing extractor com.discord-player.applemusicextractor...
Executing extractor com.discord-player.soundcloudextractor...
Executing extractor com.discord-player.vimeoextractor...
Executing extractor com.discord-player.reverbnationextractor...
Executing extractor com.discord-player.deezerextractor...
Executing extractor com.discord-player.tidalextractor...
Executing extractor com.discord-player.attachmentextractor...
Failed to query metadata query using N/A extractor.

The issue seems to be related to the fact that it is not a playlist link, but the link of a song inside of a playlist, which causes issues.

retrouser955 commented 3 months ago

After some testing, I've discovered that it is a discord-player bug.

import { YoutubeiExtractor } from "discord-player-youtubei"
import { QueryResolver } from "discord-player"

const resolver = QueryResolver.resolve("https://www.youtube.com/watch?v=KltK-3QHIjI&list=OLAK5uy_lc3hcbsPXaYpKLrdowf5RS7hGgyegqFx4")

console.log(resolver)

The following code returns a the query type of youtubePlaylist which is total not the case. I'll quick patch this for now using the extractor itself but I recommend you also open an issue on the discord-player github.

retrouser955 commented 3 months ago

1.1.11!

twlite commented 3 months ago

After some testing, I've discovered that it is a discord-player bug.

import { YoutubeiExtractor } from "discord-player-youtubei"
import { QueryResolver } from "discord-player"

const resolver = QueryResolver.resolve("https://www.youtube.com/watch?v=KltK-3QHIjI&list=OLAK5uy_lc3hcbsPXaYpKLrdowf5RS7hGgyegqFx4")

console.log(resolver)

The following code returns a the query type of youtubePlaylist which is total not the case. I'll quick patch this for now using the extractor itself but I recommend you also open an issue on the discord-player github.

this url resembles a video referenced to a playlist (basically a video that is a part of the playlist where next song is also the part of that playlist)

it is up to the extractor to resolve playlist or video in this situation.

retrouser955 commented 3 months ago

Next version will fetch both!

retrouser955 commented 2 months ago

Youtube has been killing me with these security measures. I am going to finally make this feature this week.