Skip to main content

Python 3 library for downloading YouTube Videos.

Project description

utub3

YouTube is the world's most popular video hosting service, and you might come across a situation where you need a video download script. There is a utub3 for this purpose.

Utub3 is a lightweight, dependency-free Python library and command-line utility for downloading YouTube Videos.

Utub3 also simplifies piping by allowing you to set callback functions for various download events, such as progress or completion.

In addition, utub3 includes a command line utility that allows you to download videos directly from the terminal.

Quickstart

Installation

utub3 requires an installation of Python 3.6 or greater, as well as pip. (Pip is typically bundled with Python installations.)

To install from PyPI with pip:

$ python -m pip install utub3

Sometimes, the PyPI release becomes slightly outdated. To install from the source with pip:

$ python -m pip install git+https://github.com/pchchv/utub3

Using utub3 in a Python script

To download a video using the library in a script, you'll need to import the YouTube class from the library and pass an argument of the video URL. From there, you can access the streams and download them.

 >>> from utub3 import YouTube
 >>> YouTube('https://youtu.be/HxCcKzRAGWk').streams.first().download()
 >>> yt = YouTube('http://youtube.com/watch?v=HxCcKzRAGWk')
 >>> yt.streams
  ... .filter(progressive=True, file_extension='mp4')
  ... .order_by('resolution')
  ... .desc()
  ... .first()
  ... .download()

Using the command-line interface

Using the CLI is remarkably straightforward as well. To download a video at the highest progressive quality, you can use the following command:

$ utub3 https://youtube.com/watch?v=HxCcKzRAGWk

You can also do the same for a playlist:

$ utub3 https://www.youtube.com/watch?v=UP2XoGfhJ1Y&list=RDUP2XoGfhJ1Y&start_radio=1&t=3s

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

utub3-0.2.2.tar.gz (52.2 kB view details)

Uploaded Source

File details

Details for the file utub3-0.2.2.tar.gz.

File metadata

  • Download URL: utub3-0.2.2.tar.gz
  • Upload date:
  • Size: 52.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for utub3-0.2.2.tar.gz
Algorithm Hash digest
SHA256 c493162a12544c694a1756b73d0dca98a97daa4d539df410bfbe5f2ceddbd3c4
MD5 c15497aca1887ac05187c02776c7cd86
BLAKE2b-256 dd35c3af8f43aa479647324f953e5a292ad92c398fc7cc1f8240004066ced4f3

See more details on using hashes here.

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