pytube 15.0.0


pip install pytube

  Latest version

Released: May 07, 2023


Meta
Author: Ronnie Ghose, Taylor Fox Dahlin, Nick Ficano
Requires Python: >=3.7

Classifiers

Development Status
  • 5 - Production/Stable

Environment
  • Console

Intended Audience
  • Developers

License
  • OSI Approved :: The Unlicense (Unlicense)

Natural Language
  • English

Operating System
  • OS Independent

Programming Language
  • Python :: 3.7
  • Python :: 3.8
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python

Topic
  • Internet
  • Multimedia :: Video
  • Software Development :: Libraries :: Python Modules
  • Terminals
  • Utilities

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
15.0.0 May 07, 2023
12.1.3 Mar 27, 2023
12.1.2 Dec 17, 2022
12.1.1 Dec 17, 2022
12.1.0 May 09, 2022
12.0.0 Feb 14, 2022
11.0.2 Dec 14, 2021
11.0.1 Aug 27, 2021
11.0.0 Aug 03, 2021
10.9.3 Jul 21, 2021
10.9.2 Jul 07, 2021
10.9.1 Jul 06, 2021
10.9.0 Jul 06, 2021
10.8.5 Jun 19, 2021
10.8.4 Jun 02, 2021
10.8.3 May 30, 2021
10.8.2 May 20, 2021
10.8.1 May 09, 2021
10.8.0 May 09, 2021
10.7.2 Apr 20, 2021
10.7.1 Apr 05, 2021
10.7.0 Apr 04, 2021
10.6.1 Mar 28, 2021
10.6.0 Mar 19, 2021
10.5.3 Mar 06, 2021
10.5.1 Feb 23, 2021
10.4.1 Dec 28, 2020
10.0.0 Nov 18, 2020
9.7.3 Nov 18, 2020
9.7.2 Nov 12, 2020
9.7.0 Oct 31, 2020
9.6.0 Feb 21, 2020
9.5.3 Oct 31, 2019
9.5.2 Sep 10, 2019
9.5.1 Jun 28, 2019
9.5.0 May 01, 2019
9.4.0 Jan 28, 2019
9.3.5 Nov 07, 2018
9.3.3 Oct 18, 2018
9.3.2 Oct 18, 2018
9.3.0 Oct 09, 2018
9.2.3 Sep 13, 2018
9.2.2 Apr 10, 2018
9.2.0 Apr 10, 2018
9.1.0 Mar 13, 2018
9.0.6 Feb 08, 2018
9.0.4 Feb 08, 2018
9.0.2 Feb 05, 2018
9.0.0 Feb 05, 2018
8.0.2 Jan 08, 2018
8.0.0 Jan 04, 2018
7.0.18 Oct 26, 2017
7.0.16 Oct 25, 2017
7.0.14 Oct 23, 2017
7.0.12 Oct 23, 2017
7.0.10 Oct 17, 2017
7.0.9 Oct 14, 2017
7.0.8 Oct 13, 2017
7.0.6 Oct 12, 2017
7.0.4 Oct 11, 2017
7.0.2 Oct 11, 2017
7.0.0 Oct 09, 2017
6.4.2 Jul 11, 2017
6.4.0 Jul 11, 2017
6.3.0 Jun 11, 2017
6.2.2 Feb 08, 2017
6.2.1 Feb 07, 2017
6.1.11 Aug 11, 2016
6.1.10 Jun 24, 2016
6.1.8 Feb 15, 2016
6.1.5 Dec 20, 2015
6.1.4 Dec 04, 2015
6.1.3 Oct 21, 2015
6.1.2 Oct 20, 2015
6.1.0 Oct 20, 2015
6.0.2 Oct 07, 2015
6.0.1 Oct 06, 2015
6.0.0 Oct 06, 2015
5.1.0 Sep 21, 2015
0.4.2 Sep 17, 2015
0.4.1 Sep 12, 2015
0.3.3 Sep 12, 2015
0.3.1 Sep 06, 2015
0.3.0 Sep 06, 2015
0.2.1 Aug 19, 2015
0.2.0 Sep 28, 2014

Wheel compatibility matrix

Platform Python 3
any

Files in release

No dependencies