
YouTube Downloader on Amazon AWS
If you are reading this then it is likely you have some interest in downloading videos from Amazon in a free and easy way
Well some really smart folks built out this Python program (script) that run on on Linux.
The script is named yt-dlp.
Easily download YouTube videos in Linux usingyt-dlp command line tool.
With this tool, you can also choose video format and video quality such as 1080p or 4K.
- Download videos from not only YouTube but other popular video websites like Dailymotion, Facebook etc
- Allows downloading videos in several available video formats such as MP4, WebM etc.
- You can also choose the quality of the video being downloaded. If the video is available in 4K, you can download it in 4K, 1080p, 720p etc
- Automatically pause and resume video downloads.
- Allows to bypass YouTube geo-restrictions
- Allows to download AUDIO only in various quality levels.
Attention!
Downloading videos from websites could be against their policies. It’s up to you if choose to download videos.
Clearly the objective of this guide is educational and you must follow any and all laws in your respective jurisdiction regarding the use of such tools. The author of this article has no idea how the software was written or why.
Let’s Build It!
First off let’s cover some of the assumptions:
- You have an Amazon AWS account and are familar how to spin up a Linux Instance and all that goes with making that happen
- You have PuTTY ssh tool installed (free)(Windows)
- You can navigate a Linux command-line and follow instructions
Step One: Create an Ubuntu Linux Instance on Amazon AWS based on the Amazon AMI for 64bit Ubuntu 18.04
Naturally we will need an instance to run this on. Create an Ubuntu 64bit instance using the free level.
Get the secret key downloaded to your local machine
Load up a command line and connect as you would to any Amazon Linux Instance
Once you are at a command prompt on your Ubuntu Linux box you are ready to proceed to install
Step Two: Install yt-dlp & ffmpeg
sudo apt-get update sudo apt install python3-pip sudo pip3 install yt-dlp
sudo apt install ffmpeg
Step Three: Provide some basic yt-dlp command examples
Here’s as simple as it gets to download a video
yt-dlp https://www.youtube.com/watch?v=h2x4YTI6WeE
To download a playlist, just append the playlist URL to yt-dlp, like this:
yt-dlp https://www.youtube.com/playlist?list=PLIhvC56v63ILPDA2DQBv0IKzqsWTZxCkp
Download YouTube videos in various formats and quality size
yt-dlp -F <video_url>
And you will get similar output as below:
Setting language BlXaGWbFVKY: Downloading video webpage BlXaGWbFVKY: Downloading video info webpage BlXaGWbFVKY: Extracting video information Available formats: 37 : mp4 [1080x1920] 46 : webm [1080x1920] 22 : mp4 [720x1280] 45 : webm [720x1280] 35 : flv [480x854] 44 : webm [480x854] 34 : flv [360x640] 18 : mp4 [360x640] 43 : webm [360x640] 5 : flv [240x400] 17 : mp4 [144x176]
Now among the available video formats, just choose one that suits you. For example, if you want to download it in MP4 version and 1080p, you should use -f 37 as shown below:
yt-dlp -f 37<video_url>
Finally, here’s how to download the best quality video and best audio merged
yt-dlp -f 'bv*[height=1080][ext=mp4]+ba[ext=m4a]' --merge-output-format mp4 https://www.youtube.com/watch?v=h2x4YTI6WeE
In Closing
Here’s a link to GitHub page of the wizard that wrote the tool.
There you find the history of the tool and find details on the command set.
There you have it. If you have a reasonable handle on running Linux on AWS you can spin up an instance in under 10 minutes including the two line install and start downloading.
Once you are finished shutdown the instance and terminate it since you can get one up and running in no time.
Clearly you know you could run this on a VM or a Raspberry Pi but what for when you can spin up an AWS instance in under a minute!
Have fun discovering!