Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yt_monk-0.1.1a2.tar.gz (11.7 kB view hashes)

Uploaded Source

Built Distribution

yt_monk-0.1.1a2-py3-none-any.whl (8.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page