discord-player: YouTube stream fails with could not extract stream for this track
Discord Player throws could not extract stream for this track
when trying to stream youtube source. This affects all the extractors that depend upon youtube streaming:
- spotify extractor
- apple music extractor
- youtube extractor
Update 1
Streaming works upon removing ytdl-core
and installing play-dl
. This seems to be node-ytdl-core issue as mentioned in https://github.com/fent/node-ytdl-core/issues/1197. As a workaround, follow these steps:
npm install play-dl
ornpm install @distube/ytdl-core
- add
DP_FORCE_YTDL_MOD="play-dl"
orDP_FORCE_YTDL_MOD="@distube/ytdl-core"
in your.env
file
If npm
doesn’t work, clear npm cache and try again, or switch to another package manager like yarn
.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 5
- Comments: 19 (2 by maintainers)
Downgrading to ytdl-core@4.9.1 worked for me
You don’t have to modify
node_modules
. SetDP_FORCE_YTDL_MOD="play-dl"
environment variable to prioritize specific lib.https://github.com/fent/node-ytdl-core/issues/1216
Downgrading to
ytdl-core@4.9.1
make the stream url download bottleneck and the music is not playing smoothlyplay-dl
can play normal youtube link but it doesn’t support live stream url (Error: Could not extract stream for this track
)My solution Using
@distube/ytdl-core
fork (https://github.com/Androz2091/discord-player#streaming-library)npm i @distube/ytdl-core@latest
DP_FORCE_YTDL_MOD="@distube/ytdl-core"
environment variableThis should make your bot play youtube stream smoothly and play live stream normally
We support the following youtube streaming libs:
youtube-ext
ytdl-core
@distube/ytdl-core
play-dl
yt-stream
If
ytdl-core
is not working, try another lib (process.env.DP_FORCE_YTDL_MOD
supports all of these libs).