yt2mp4
Download YouTube videos and playlists as MP4 files (and other formats)
Get geckodriver
Linux (Debian)
sudo apt install wget ffmpeg firefox-esr -y
wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
sudo tar xvzf geckodriver-v0.30.0-linux64.tar.gz -C /usr/bin/
chmod +x /usr/bin/geckodriver
rm geckodriver-v0.30.0-linux64.tar.gz
Other
Figure it yourself
Installation
From PyPI
pip3 install yt2mp4
From GitHub
pip3 install git+https://github.com/donno2048/yt2mp4
Usage
In Python
from yt2mp4 import download
download("dQw4w9WgXcQ", outname='output.mp4') # dowload video from https://www.youtube.com/watch?v=dQw4w9WgXcQ and name it output.mp4
# will also work:
# download("dQw4w9WgXcQ", outname='output.mp4', binary_path=path) # use a different binary path
# download("youtube.com/watch?v=dQw4w9WgXcQ", output="output.mov")
# download("youtu.be/dQw4w9WgXcQ")
# download("www.youtube.com/watch?v=dQw4w9WgXcQ", output="output.mov")
# download("music.youtube.com/watch?v=dQw4w9WgXcQ", output="output.mov")
# download("https://www.youtube.com/watch?v=dQw4w9WgXcQ", output="output.mov")
# download("https://music.youtube.com/watch?v=dQw4w9WgXcQ", output="output.mov")
# download("https://youtu.be/dQw4w9WgXcQ")
In cmd
# each of those will convert to another format
yt2mp4 # or python3 -m yt2mp4
yt2webm
yt2mkv
yt2flv
yt2wmv
yt2avi
yt2mov
yt2m4v
yt2mp3
Download playlist
For this you will have to configure a YouTube API key
Get API key
- Go to the Developer console dashboard and click on CREATE PROJECT, you can name the project and then press CREATE
- Now go to the Credentials tab and click on CREATE CREDENTIALS and choose API key, copy the API key you see and save it somewhere safe, then you can click on CLOSE
- Now go to the YouTube API tab and click on ENABLE
In Python
from yt2mp4 import download_playlist
download_playlist(id, api_key)
'''
- the first argument is the id of the playlist, you can pass either of the following forms
- https://www.youtube.com/watch?v=***********&list=PLAYLIST_ID
- https://www.youtube.com/playlist?list=PLAYLIST_ID
- PLAYLIST_ID
- the second argument is the API key
- the third is the extension, the default value is 'mp4'
- the fourth one is the fps, the default value is 60
- the last one is the binary path to the geckodriver
'''
In cmd
# each of those will convert to other formats
ytp2mp4
ytp2webm
ytp2mkv
ytp2flv
ytp2wmv
ytp2avi
ytp2mov
ytp2m4v
ytp2mp3
Supported formats
- mp4
- webm
- mkv
- flv
- wmv
- avi
- mov
- m4v
- mp3 (auto format as audio)
Metadata
Release files for yt2mp4 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yt2mp4-1.0.5.tar.gz | 4.7 kB | Without provenance | Details for yt2mp4-1.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yt2mp4-1.0.5-py3-none-any.whl | Python 3 | none | any | Details for yt2mp4-1.0.5-py3-none-any.whl |
Total release size: 9.6 kB
Release files / yt2mp4-1.0.5.tar.gz
| Download URL | yt2mp4-1.0.5.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2dfd2c3919516d3e56cd4db76ab7d7ababc23054bd4c70f48c51572f39eff4ef
|
|
BLAKE2b-256 checksum How to use checksums |
d64862a7e0a5b278313a615ec556ff1975a980d6a971fcc508464762d2537293
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.3
|
Release files / yt2mp4-1.0.5-py3-none-any.whl
| Download URL | yt2mp4-1.0.5-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8538f04f1d9321596e1165df6cd750f20f543b91861be7185bd7711d84b622a
|
|
BLAKE2b-256 checksum How to use checksums |
249c05858e3bcd62e71bec119d95f1b91b78cca751219a1f6608508bd082d8dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.3
|
Security for yt2mp4 1.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.