Summary:
Create a new notebook with 2 simple commands in a code block:
!pip install yt-dlp
!yt-dlp {youtube-link}
The downloaded file will appear in the /content
folder on your Google Colab VM.
The 'bestvideo+bestaudio' format will be used by default.
Example yt-dlp commands:
#List formats
!yt-dlp -F {youtube-link}
#download audio-only mp3
!yt-dlp bestaudio -x --audio-format mp3 {youtube-link}
Notes
Let's say you want to:
- Download a YouTube video,
- In a particular format, e.g. H.264 video with AAC audio or audio-only MP3.
Option 1 - Video Downloader sites
- Full of spam and ads. Don't install their malware, BTW.
- Don't always work.
Option 2 - yt-dlp in Windows Subsystem for Linux
- Works extremely well...
- ... until it doesn't. YouTube blocks you eventually and starts thowing 403 Forbidden errors.
- Oh, and transcoding is slow if you have a potato PC like I do.
Option 3 - Use Google Colab.
Use a Google VM to download from Google.
- Even the most basic Python environment runs with more compute and bandwidth than your home setup.
- You'll note the '!' executes shell commands in what is basically Linux.
- You don't have to install ffmpeg (or pip, or python) because it's already installed.
- You can discard the VM after use, making it harder to block.
Comments
Post a Comment