A simple Python package for downloading videos and playlists from YouTube
Project description
YouTube Monk
A YouTube video and playlist downloader made in Python.
Report Bug
-
Request Feature
Installing the library
To install the library from PyPi, just run this command:
pip install yt-monk
Usage
Import the library and define the downloader
object:
import yt_monk
downloader = yt_monk.Downloader()
Setting the options:
You can set the options using keyword arguments when defining the object:
downloader = yt_monk.Downloader(quality='720', codec='av1')
or you can set it using the options.useCustom
function:
downloader = yt_monk.Downloader()
downloader.options.useCustom(quality='720', codec='av1')
Here are all the options you can set:
codec -> "h264"
, "av1"
, "vp9"
quality -> "max"
, "2160"
, "1440"
, "1080"
, "720"
, "480"
, "360"
, "240"
, "144"
file_name -> this can be set to any valid filename. you can use placeholders: <videoTitle>
, <selectedQuality>
, <selectedCodec>
file_type -> the file type can be either "video"
or "audio"
audio_format -> "mp3"
, "ogg"
, "wav"
, "opus"
mute_audio -> True
or False
overwrite_files -> this tells the program to overwrite existing files: True
or False
overwrite_directories -> this tells the program to overwrite existing directories: True
or False
download_directory -> the directory that the downloaded files will be saved to. you can use placeholder for default download directory like C:\users\name\Downloads\
on windows: <defaultDirectory>
ask_for_input -> if enabled, the code will ask whether or not to overwrite a file or a directory: True
or False
Using JSON options file:
Alternatively, you can use a json file to set the options. You can download an example options.json
file here. Then just tell the code to use the JSON file:
downloader = yt_monk.Downloader(json_path=r'path/to/options.json')
or you can do it like this:
downloader = yt_monk.Downloader()
downloader.options.useJson(json_path=r'path/to/options.json')
Downloading a video:
video_url = 'https://www.youtube.com/watch?v=9bZkp7q19f0'
downloader.downloadVideo(video_url)
Downloading a playlist:
playlist_url = 'https://www.youtube.com/playlist?list=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi'
downloader.downloadPlaylist(playlist_url)
License
Distributed under the MIT License. See LICENSE.txt
for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for yt_monk-0.1.1a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31b68b7d6d2bde3d0e5b11d594e5a1b613355dadb321478f02a842ed10436eda |
|
MD5 | 59bcb0768da1cdad88fd986726a27175 |
|
BLAKE2b-256 | 6e8ccf192a923dd9d82ffdbbd5be802fe36ee9ec95acca237c962a4488da03ef |