Python: Download Youtube video in the simplest way with pytube ver. 2

Last Updated on December 26, 2021 by shibatau

Let me show you how to download a Youtube video in the simplest way with pytube. You can learn about pytube here:

https://pytube.io/en/latest/user/streams.html

https://github.com/pytube/pytube

You can use pytube in a python script but it is simpler to use the command-line interface. The streams downloaded contain the audio and video in a single file. They are called “progressive download”,  resolutions 720p at highest.

In the terminal run the following commands if you have created a virtual environment with Anaconda.

1.Open the virtual environment.

conda activate YOURENVIRONMENT 

2.Install pytube

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

3.Download the Youtube video file at your home directory

pytube URL 

You will get a video at the highest progressive quality, though it may be the highest of all. If you want to get the highest quality video, Dash video files, see the tutorial:

https://pytube.io/en/latest/user/streams.html

 

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.