Skip to main content

Python 3 library for downloading YouTube Videos.

Project description

This is a pytube fork created for specific purpose

This fork was created for the specific purpose of fixing a pytube bug #1594. This fix will be used for my specific project. I have not done testing to ensure other functionality of the package still work with this change. If you decide to use please know their could be issues with the code not working properly going forward.

pytube logo

pypi

Actively soliciting contributors!

Have ideas for how pytube can be improved? Feel free to open an issue or a pull request!

pytube

pytube is a genuine, lightweight, dependency-free Python library (and command-line utility) for downloading YouTube videos.

Documentation

Detailed documentation about the usage of the library can be found at pytube.io. This is recommended for most cases. If you want to hastily download a single video, the quick start guide below might be what you're looking for.

Description

YouTube is the most popular video-sharing platform in the world and as a hacker, you may encounter a situation where you want to script something to download videos. For this, I present to you: pytube.

pytube is a lightweight library written in Python. It has no third-party dependencies and aims to be highly reliable.

pytube also makes pipelining easy, allowing you to specify callback functions for different download events, such as on progress or on complete.

Furthermore, pytube includes a command-line utility, allowing you to download videos right from the terminal.

Features

  • Support for both progressive & DASH streams
  • Support for downloading the complete playlist
  • Easily register on_download_progress & on_download_complete callbacks
  • Command-line interfaced included
  • Caption track support
  • Outputs caption tracks to .srt format (SubRip Subtitle)
  • Ability to capture thumbnail URL
  • Extensively documented source code
  • No third-party dependencies

Quickstart

This guide covers the most basic usage of the library. For more detailed information, please refer to pytube.io.

Installation

Pytube 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 pytube

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

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

Using pytube 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 pytube import YouTube
 >>> YouTube('https://youtu.be/2lAe1cqCOXo').streams.first().download()
 >>> yt = YouTube('http://youtube.com/watch?v=2lAe1cqCOXo')
 >>> 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:

$ pytube https://youtube.com/watch?v=2lAe1cqCOXo

You can also do the same for a playlist:

$ pytube https://www.youtube.com/playlist?list=PLS1QulWo1RIaJECMeUT4LFwJ-ghgoSH6n

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

pytube_local_nima-12.1.3.tar.gz (67.5 kB view details)

Uploaded Source

Built Distribution

pytube_local_nima-12.1.3-py2-none-any.whl (57.5 kB view details)

Uploaded Python 2

File details

Details for the file pytube_local_nima-12.1.3.tar.gz.

File metadata

  • Download URL: pytube_local_nima-12.1.3.tar.gz
  • Upload date:
  • Size: 67.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for pytube_local_nima-12.1.3.tar.gz
Algorithm Hash digest
SHA256 31d43c33d8312687008e02d6c582e42e05a683df6cee8016084f61d9883bf93e
MD5 ffe6c88f1ab52a5706c380617bc81635
BLAKE2b-256 ec888e74aa5240eb01ef85805127d1332a7b050f6d9d564a8ca9f0569e8cd548

See more details on using hashes here.

File details

Details for the file pytube_local_nima-12.1.3-py2-none-any.whl.

File metadata

File hashes

Hashes for pytube_local_nima-12.1.3-py2-none-any.whl
Algorithm Hash digest
SHA256 91a19ec627478b0f41f9d9c64be114a2207b7d9843219d2e69c2d6842272de5c
MD5 ccc89d37d7437aab6cab1c8680081dda
BLAKE2b-256 f84624d52f0f4e8b9dd77c4d6748d2c61bd6280e124271891c08f8f08f48dd79

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