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-dlornpm install @distube/ytdl-core- add
DP_FORCE_YTDL_MOD="play-dl"orDP_FORCE_YTDL_MOD="@distube/ytdl-core"in your.envfile
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.1make the stream url download bottleneck and the music is not playing smoothlyplay-dlcan 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-corefork (https://github.com/Androz2091/discord-player#streaming-library)npm i @distube/ytdl-core@latestDP_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-extytdl-core@distube/ytdl-coreplay-dlyt-streamIf
ytdl-coreis not working, try another lib (process.env.DP_FORCE_YTDL_MODsupports all of these libs).