youtube-dl
Pulling audio from public sources
What is youtube-dl?
YouTube-dl is a command-line tool for downloading videos and playlists from YouTube and many other sites. It allows users to download videos for offline viewing and supports a wide range of platforms and websites.
Do I need youtube-dl?
RKHM is fully functional without youtube-dl. With youtube-dl you can download videos from YouTube and convert those videos to mp3 using FFmpeg then serve the mp3 file instead of video to your users. This process will be done just once for each track as the result mp3 is saved and used for later user requests.
Is youtube-dl legal?
Using youtube-dl or yt-dlp to download from YouTube is only legal for research purposes and personal use. YouTube's terms don't allow downloading videos to serve them again, so don't enable this on a public or commercial site. You are responsible for following the copyright law of your country and your server's country.
How do I enable youtube-dl?
First, you have to install youtube-dl on your server & fully test it. Then go to Setting → General → External Tools → youtube-dl and enter the path to youtube-dl (or yt-dlp). Then open Content → Music → Automation and tick Active in the Youtube Download group
How do I know youtube-dl is working?
The External Tools page has a Test link next to the youtube-dl path. Use it

How do I speed-up youtube-dl?
The download and conversion speed of a YouTube video to MP3 largely relies on your server's capabilities. However, users can enhance performance by switching to improved forks of youtube-dl, such as yt-dlp, to achieve faster downloads.
Handling YouTube access limits
[New in 2.0.69] Pass cookies to your youtube-dl:
Fully documented here by yt-dlp: https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp
Open your browser, login to YouTube using an alternative account ( don't use your main account ). Use available browser extension to export your cookies from youtube.com. Rename the file to yt_cookies.php and upload it to ~rkhm/files/protected/yt_cookies.php. The youtube-dl field on the External Tools page then confirms that yt_cookies.php is uploaded

Network configuration
Requests from a VPS may encounter provider rate limits or access restrictions. Keep yt-dlp current, review its error output, and follow YouTube’s current terms for your use case. To route downloads through a proxy, enter it in youtube-dl proxy on the External Tools page (for example socks5://user:pass@1.2.3.4:1080). A proxy changes the network route; it doesn't guarantee that a download will work.