Moode Forum
Youtube-DL - Printable Version

+- Moode Forum (http://moodeaudio.org/forum)
+-- Forum: moOde audio player (http://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (http://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- 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 :
Code:
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
Abort.



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
http://rf.proxycast.org/1432470654304657408/10212-09.05.2018-ITEMA_21673566-6.mp3
(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 Last.fm.

YouTube Begins Blocking Stream-Ripping Sites
https://www.techdirt.com/articles/20190710/13302742554/youtube-begins-blocking-stream-ripping-sites.shtml


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

I do occasionally see the issue talked about here
https://forum.volumio.org/youtube-for-volumio-t6608-140.html#p64269

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.

YT Play API

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

Code:
Cast a Tiny Desk stream by Sylvan Esso into "YouTube Play" playlist
http://moode.ip/yt-play/?type=cast&src=https://www.youtube.com/watch?v=mhyD2qchkEw


[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.
Compose..Message...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 ...

Code:
#EXTM3U
#EXTINF:-1, Gentle Whispering ASMR ... Fetching, Please Wait
http://localhost/yt-play/?type=stream&src=-1

#EXTINF:-1, Gentle Whispering ASMR - Cleansing Crystals with Sage
http://localhost/yt-play/?type=stream&src=https://www.youtube.com/watch?v=Hc0MJjcZm40

#EXTINF:-1, Gentle Whispering ASMR ... Done, Go to Playlists > YouTube_Play
http://localhost/yt-play/?type=stream&src=1

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.


Documentation


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 Playlist_load.sh


Code:
sudo youtube-dl -f 140 -j $1 > /var/www/yt-play/source.json
url=$(sudo python source_url.py)
title=$(sudo python source_title.py)

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 ..

[attachment=888]

M.A.L.P ...

[attachment=889]