Many videos or audio streaming websites either do not provide an offline feature or require a premium account to save files offline. In this article, I will show you how to free download videos from YouTube and other websites using command prompt.
You may think it may be difficult to memorize all the parameters for command prompt, but it is not. When you get it set up, it is super easy. What’s amazing about this is that you can download video and audio from hundreds of websites with a single command.
In this post, I will show you how to use yt-dlp (a youtube-dl fork with additional features and fixes) on Windows. If you want to use yt-dlp on a Mac, you can refer to this post.
The setup
This will require you to download an open source program for the official site. If you use Mac or Linux, you need to install it by running a few lines of commands. Let take Windows as an example.
Step 1. Go to the GitHub to download the latest release of yt-dlp. Just click on yt-dlp.exe to download it.
Step 2. Location the downloaded file and move it to your user folder. It should look like this: C:\Users\YourName.
Step 3. Add yt-dlp to System Path (Optional):
If you want to be able to run yt-dlp from any command prompt without specifying its full path, you can add the folder containing yt-dlp.exe to your system’s PATH environment variable. Here’s how:
- Right-click on “This PC” (or “My Computer”) and select “Properties.”
- Click on “Advanced system settings” on the left.
- Click the “Environment Variables” button.
- Under “System variables,” scroll down and find the “Path” variable. Select it and click “Edit.”
- Click “New” and add the path to the folder containing yt-dlp.exe.
- Click “OK” to close all the windows.
That’s all for the setup. If you can also rename the file to something shorter, so you do not need to type all these characters when you want to download a file.
Download YouTube a video or multiple videos with a command
Now actually, you can download any YouTube video, playlist, all videos from a user, etc. As mentioned, it also supports audio downloading, so you can also download free music from SoundCloud, BandCamp, MixCloud, etc. you can also download a music playlist with a single command.
Step 1. Type Windows + R key to bring up Run command.
Step 2. Type “cmd” without quotes and press Enter.
Step 3. Within the command prompt window, type “yt-dlp.exe [Page URL of the media you want to download]”. In the screenshot, I tried to download SoundCloud music tracks. If you have add yt-dlp to path, you only need to type”yt-dlp [URL]”.
After that, you will see downloading progress and estimate the remaining time. If you have renamed the program name, then you should change the command you input accordingly.
By default, the program will save the downloaded file to the user location. If you need to change that, you need to know a little bit more about the available parameters for this program.
Get FFmpeg
If you want to download 4K/8K YouTube videos with audio, you also need to install FFmpeg. It is a command-line tool to convert multimedia files between formats. It supports the most obscure ancient formats up to the cutting edge. You don’t have to learn how to use it unless you want to convert some files. You just need to download FFmpeg and open the FFmpeg folder and copy everything from the Bin subfolder to your user folder where the YouTube-DL.exe are placed.
Other useful parameters
In order to customize the downloading experience, there are a few common use parameters that you need to know. Well, you can use command “yt-dlp.exe –help” to see all the available parameters.
Specify download location path
To specify the location path for saving the downloaded file. For example, D:\downloader\youtube\, then you should type:
yt-dlp.exe -o D:\downloader\youtube\%(title)s.%(ext)s https://www.youtube.com/watch?v=AbPegF5zbv8
Of course, you should change the download link to the one that you want to download.
Specify file format
You can use -F to list all the available format that you can download and use -f to select one format to download to your PC.
Authentication options
If the video you want to download is not publically available, you need to use the authentication option to download the video. For example, to download Facebook private video, use the command like in the screenshot below.
-u, --username USERNAME Login with this account ID
-p, --password PASSWORD Account password. If this option is left
out, youtube-dl will ask interactively.
-2, --twofactor TWOFACTOR Two-factor authentication code
-n, --netrc Use .netrc authentication data
--video-password PASSWORD Video password (vimeo, smotri, youku)
--cookies-from-browser BROWSER[+KEYRING][:PROFILE][::CONTAINER]
Conclusion
That’s how you can easily download YouTube videos from the command line. Many other websites are supported. You just need to input the simple command to download all the video and audio from hundreds of websites. It is definitely not as difficult as you expected.
If You still think this is too complicated, you can use a GUI tool, Allavsoft, which has pretty similar features to yt-dlp, but with a nice interface. If you have any questions or something I miss, please leave it in the comments section.
D:\UDEMY>youtube-dl -u [email protected] -p xxxxxxxxxxxxx “https://www.udemy.com/course/complete-linux-training-course-to-get-your-dream-it-job”
[udemy:course] Downloading login popup
ERROR: Unable to download webpage: HTTP Error 403: Forbidden (caused by HTTPError()); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the –verbose flag and include its complete output.
Regards
[email protected]
You can only download the content you have paid for.
Please can I use the app to download paid content on Udemy without paying for it on Udemy
i got an error with captcha , i save the coockies but still (cleaning cache too).
LOAI SIDDIG,
You missied one step, move youtube-dl.exe to your user folder, C:\Users\DELL
Hi Dear, I tried to follow your step to download a course from Udemy. I used the same way you mentioned , First I download the “youtube-dl.exe” then I run it “. Second, I opened cmd and typed:
C:\Users\DELL>”youtube-dl.exe [https://www.udemy.com/course/spss-statistics-foundation-course-from-scratch-to-advanced/]”
BUT all the times it gave me this message :
The filename, directory name, or volume label syntax is incorrect.
please help.
As the Error message suggested, you should report this issue on the youtube-dl page.
This does not work with the latest paid-for Udemy courses. Here’s the command I’m using with right username/password:
C:\Users\Mike>youtube-dl.exe -u [email protected] -p password https://www.udemy.com/course/new-comptia-a-2019-certification-1001-the-total-course/learn/lecture/15033166#overview
[udemy:course] Downloading login popup
ERROR: Unable to download webpage: HTTP Error 403: Forbidden (caused by HTTPError()); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the –verbose flag and include its complete output.