Download Youtube video’s with Python

In this post, we are going to take a look at the Pytube3 library. This library allows you to download Youtube videos with just 2 lines of Python code.

Features of pyTube

We recommend to use pyTube as it is being maintained. pyTube also has a lot of great features, some of them have been listed down below:

  • Support for Both Progressive & DASH Streams
  • Support for downloading 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

Install pyTube

First, we need to make sure, that we have pyTube installed on our system. We can install pyTube by performing the following PIP command:

$ pip install pytube3 --upgrade

The command above, will download and install the latest version of pytube3.

Download Youtube video

The code which allows you to download a Youtube video with pytube is as following:

from pytube import YouTube

Share this information
About Reza Rafati 3184 Articles
Founder of