Moode Forum
Youtube-DL - Printable Version

+- Moode Forum (
+-- Forum: moOde audio player (
+--- Forum: Support (
+--- Thread: Youtube-DL (/showthread.php?tid=196)

Pages: 1 2

Youtube-DL - Talisker - 05-20-2018

Hi Every Body,
I'm really a newbie in Moode Audio solution, I'm using the lastest version with the Allo DigitOne Player.
I would like to send some internet stream to Moode (MPD), for listening a podcast or a youtube song.
I'm wondering if it's ok to install youtube-dl on the pi ? and push url from a MPD Client ?
List of packages modified or added are available below :
pi@moode:~ $ sudo apt-get install youtube-dl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
 libdvdnav4 libdvdread4 liblua5.2-0 libva-wayland1 mpv python3-pkg-resources rtmpdump
Suggested packages:
 libdvdcss2 python3-setuptools
The following NEW packages will be installed:
 libdvdnav4 libdvdread4 liblua5.2-0 libva-wayland1 mpv python3-pkg-resources rtmpdump youtube-dl
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,075 kB of archives.
After this operation, 7,982 kB of additional disk space will be used.
Do you want to continue? [Y/n] n

RE: Youtube-DL - Talisker - 05-20-2018

Podcasting works pretty well, from Moode interface like a normal Radio URL or by using a client like gmpclient, add url like the one below
(French Podcast from FranceInter Radio : 2 Channels, 44,1 kHz, 128 kbps)
Usually URL of podcasting are available from rss feeds so it will be interesting to have a screen to convert rss feeds entry to a play entries.
For Youtube, we need a decoder for the stream ...

RE: Youtube-DL - duracell80 - 11-25-2019

Encoding not needed. Access the stream as if it were Spotify or

YouTube Begins Blocking Stream-Ripping Sites

RE: Youtube-DL - duracell80 - 11-25-2019

I do occasionally see the issue talked about here

With the stream cutting off towards the end, some inspecting of that URL could reveal something but I suspect this is Google's intentional limitation. I also thought about trying to detect the stream length and if it's less than an average pop song like 3:30, refuse to get the m4a.

RE: Youtube-DL - duracell80 - 11-29-2019

Phew that was some intense coding and figuring out but I have an API to YouTube DL working ... essentially using playlists and a proxy in /var/www/ to YouTube.


My favorite part about this is "casting audio to Moode"

Cast a Tiny Desk stream by Sylvan Esso into "YouTube Play" playlist

[attachment=884] [attachment=882] [attachment=883] [attachment=885]

RE: Youtube-DL - DRONE7 - 11-29-2019

Quote:Compose a file with the first stream as a message that appears in Moode's player.

Maybe it would be useful to make this a FAQ Guide in the appropriate sub-forum... Cool

Perhaps with a cli step by step how-to.... Smile

Looking forward to the simple how-to... Big Grin

RE: Youtube-DL - TookaFace - 11-29-2019

Well done !

RE: Youtube-DL - duracell80 - 11-29-2019

There's some documentation on the git page and I'll work on a how to for the appropriate thread. It should be as simple as writing a playlist with YouTube urls in it prefixed with localhost like ...

#EXTINF:-1, Gentle Whispering ASMR ... Fetching, Please Wait

#EXTINF:-1, Gentle Whispering ASMR - Cleansing Crystals with Sage

#EXTINF:-1, Gentle Whispering ASMR ... Done, Go to Playlists > YouTube_Play

The first playlist item clears the YouTube_Play playlist (otherwise you'd get stale URL's) and offers the chance to use the title as a message that appears in the player. A message like "Contacting YouTube ... please wait". It's not required but is a nice UX touch. The last item triggers mpc to clear and load and play YouTube_Play. So yeah you'd want to keep the last item (?src=1)

The more items in the playlist the longer you'll have to wait for the audio to start playing. It typically takes about 10 to 30 seconds per url.

It's really not a simple process.


To make it work on localhost run the install script and that's all the cli commands you need to run.

RE: Youtube-DL - Tim Curtis - 11-29-2019

How are the url's obtained?

RE: Youtube-DL - duracell80 - 11-29-2019

(11-29-2019, 02:32 PM)Tim Curtis Wrote: How are the url's obtained?

With youtube-dl by "playing a playlist". Let's say you have a TEDTalk playlist with the API calls, you have to play that (silent) file, then It returns json file's with the url's to the audio streams and then generates a second playlist called YouTube_Play with those volatile links which mpc then plays.

More technically ... The URL is generated with

sudo youtube-dl -f 140 -j $1 > /var/www/yt-play/source.json
url=$(sudo python
title=$(sudo python

sudo echo "#EXTINF:-1, YouTube: "${title} >> /var/www/yt-play/yt.m3u
sudo echo ${url} >> /var/www/yt-play/yt.m3u
sudo cp -f /var/www/yt-play/yt.m3u /var/lib/mpd/playlists/YouTube_Play.m3u

It's like a two stage process. The player is playing the first list which generates the second. The process works with an mpc client too.

The contents of that generated playlist look like this ..


M.A.L.P ...