Ever needed a tutorial or just download non copyrighted material from YouTube to watch or listen offline?
YouTube-dl is a command-line tool which is open source and can be used to download videos from YouTube, Facebook, and other popular sites, see the full list here.
NOTE: Keep in mind some media contains copyrighted material.
Make a directory on your desktop or anywhere you like. Get a copy of youtube-dl.exe and copy the file in to your directory.
C:\Users\Username\Desktop\youtube-dl
Create new text file and rename to download.ps1 (How to file extensions in the same directory.
Get a copy of FFmpeg latest build for your windows architecture. Copy root folder in the zip file and copy over to your directory and rename it to FFmpeg.
Edit download.ps1 with the editor of your choice. The code below downloads any YouTube video and converts to MP3 format(Requires FFmpeg or avconv).
Skip if you are familiar with commands.
if(![System.IO.File]::Exists('ffmpeg/bin/ffmpeg.exe')){
break
}
Write-Host "####################################`n## Youtube-dl Powershell script ##`n## by bitxo.se ##`n####################################" -ForegroundColor Red
$yturl = Read-Host -Prompt 'Enter YouTube URL'
Write-Host "URL: $yturl" -ForegroundColor Red -BackgroundColor Yellow
.\youtube-dl.exe --ffmpeg-location "ffmpeg/bin" -f bestaudio --extract-audio --audio-format mp3 $yturl
PAUSE
By now your directory should look something like
If you skipped Step 4 you can run this command in Powershell in the same directory as youtube-dl.exe and your other files.
youtube-dl.exe --ffmpeg-location "ffmpeg/bin" -f bestaudio --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=p4M3Gle4NQ4
[========]
Update your system
sudo apt-get update
The easy method is installing from the apt repository.
sudo apt-get install youtube-dl
Or using pip.
sudo apt-get install python-pip
sudo pip install youtube-dl
If you wish to download a song from the channel NoCopyrightSounds and convert to MP3 format (Requires FFmpeg or avconv).
sudo apt-get install ffmpeg
Before jumping straight to it read the the options youtube-dl has.
youtube-dl -h
Command: ytdl-mp3 your-url-here
alias ytdl-mp3="sudo youtube-dl --extract-audio --audio-format mp3 $@"
Command: ytdl-cache
alias ytdl-cache="youtube-dl --rm-cache-dir"
A front-end GUI for youtube-dl for those who dislike the terminal
pip install youtube-dlg
FFmpeg or avconv needed for this example. The argument --audio-format converts the video file to audio only, --audio-format the audio format in mp3, m4a etc and last the url.
youtube-dl --extract-audio --audio-format mp3 https://www.youtube.com/watch\?v\=IX2NQ1lq4ZM
Do you have another FFmpeg build for Windows? Zeranoe no longer builds.