This program is a python packages with command line interface to download the highest available quality of non progressive YouTube video up to specified maximum resolutions (by default is 1080p). This program was made using Pytube and also ffmpeg to combine and convert media files.
To download youtube video in default directory you just need to type pytd
followed by YouTube Video's URL like this command:
$ pytd https://youtu.be/dQw4w9WgXcQ
it's also possible to downloads more than one files at a time, just paste all of YouTube video's URLs you want to download separated by spaces
$ pytd https://youtu.be/dQw4w9WgXcQ https://youtu.be/4MoRLTAJY_0
if you want to download it to current working directory you can do it by just adding -d
flag
$ pytd -d https://youtu.be/dQw4w9WgXcQ
Sometimes you don't really want to download both video and audio, maybe you only want audio because you just want to listen to the music. By default pytd will download both audio and video then merge it into one .mp4 file after it was downloaded. You can download only audio by using -a
flag, pytd then will convert that audio file to .mp3
$ pytd -a https://youtu.be/dQw4w9WgXcQ
to only downloading video, use -v
tag
$ pytd -v https://youtu.be/dQw4w9WgXcQ
These tags can be joined together, for example if you want to download only audio file to the current working directory you can use the following command:
$ pytd -da https://youtu.be/dQw4w9WgXcQ
If you want to change something like maximum resolutions, audio bitrate, or video codec you can use
pytd --set-config [OPTION] [NEW VALUE]
command. Although you need to know what options are available first.
To do this, use
$ pytd --config list
to list all available options.
You can also see what the current value of specific option, for example:
$ pytd --config max_res
>>> 1080
And if you want to change maximum resolution to 720p you just have to type:
$ pytd --set-config max_res 720
>>> max_res Updated to 720
To reset configuration back to default, you can use the following command:
$ pytd --set-config default
>>> [path to pytdconfig.ini] were reset to default
Note: this will delete your old configuration and replace it with the default one, make sure that you know this before yout do it.
I made this program to make my life easier whenever I want to download videos from YouTube. Although there are plenty of web based service for downloading YouTube videos, I always feels the process of opening their website and selecting the video quality are a bit slow and honestly quite tedious, because I'm usually always downloads more than one video at a time. If by any chances you want to try this program, I hope you'll like it.
This program were made using python language using pytube API and ffmpeg for processing media files. Hence this program required:
- Python 3.8 or above
- Python pip already installed
- pytube
- git
- ffmpeg
if you haven't installed python and pip yet, you can follow guide available at official websites of python here: https://www.python.org/
Many linux distro already come pre-installed with python (and also pip), git, and ffmpeg. If any of the three haven't been installed in your machine, you could look at your distro's repositories for those packages and install it from there. Because we will using pip for the installation, pytube will automatically installed when we install pytd.
If all the pre-requisites already met, then you can install pytd with the following command:
$ python -m pip install git+https://github.com/perfect-less/Python-YouTube-Downloader
or
$ pip install git+https://github.com/perfect-less/Python-YouTube-Downloader
NOTE: To make installation in windows easier, I did make batch installation scripts which you could download from the release section of this repo. Follow instructions on "For Windwows (Installation with Scripts)."
The first thing to do for windows installation is to install python and pip (please follow the guidance at https://www.python.org/). But since windows didn't come pre-installed with ffmpeg
. We need to install it ourself and then add it to our PATH variables.
- Download ffmpeg for windows here: https://ffmpeg.org/download.html
- Extract it somewhere on your computer
- find the
bin
folder inside extracted folder from step 2, note the path to saidbin
folder - Click on
Start Menu
->Settings
->System
->About
- Click
System Info
and thenAdvance System Settings
- Click on
Environment Variables...
- Select
Path
on the upper section and then clickEdit
Click
New and then clickBrowse
, add the path tobin
folder in the step number 3Ok
on everything and congratulations, nowffmpeg
was added to thePath
- You can confirm it by opening command-prompt and type
ffmpeg --version
We also need git to install the program which can be downloaded from https://git-scm.com/
With all prerequisites met, we can install pytd with the following command:
$ python -m pip install git+https://github.com/perfect-less/Python-YouTube-Downloader
You still need to install python and pip first for this install process to work.
Please download the installation scrips on the release section of this repository. After you've downloaded the installation scrips, please follow these steps:
- Extract the zip file into your computer
- Enter the
pytd install
folder - Run
PYTD_INSTALLER.bat
, you can run it in cmd or just double click on it. - Follow the instructions on the scrips until it finished
To uninstall pytd
you have to run the PYTD_UNINSTALL.bat
as Administrator.