How to Create a Simple YouTube Download Program with a Progress Indicator in Python 3 with pytube

Python 3, pytube, os in Windows 10

Some of my friends live in an area that really struggles to get decent internet speeds in the afternoons and evenings. So much so that they can barely watch a YouTube video at 144p some days, and that is not particularly useful if they are trying to watch a video with code or some technical specs on the screen.

They really needed to download the videos, but really did not trust the programs available online to download videos for me without spamming them with advertising or adding some malicious malware to their beloved computers.

Fortunately, someone developed a Python 3 library to do just that – pytube.  In an earlier post I dive into some of the main aspects pytube:

How do I download YouTube videos with Python 3 using Pytube?

In this post, I am going to show you a quick app that can be run in the Python shell to download videos that features a progress indicator (not quite a progress bar).

I’ve intentionally kept the program fairly limited so you can focus on the important parts. I’ll show you the code and an example of what it looks like when it is running first and then give you the breakdown where you can focus on what you need to know and ignore the rest.

Continue reading “How to Create a Simple YouTube Download Program with a Progress Indicator in Python 3 with pytube”

How to Check a User’s Home Directory for a Folder – Python 3

Python 3, OS, Example in Windows 10

If you are creating a program for a user where you want to store or use a file in the users home directory, it is not as easy as simply preparing a fixed file location like:

C:\Users\yagisanatode\

Because if another user on another computer tries to use your program they will start getting errors because their home directory might be something else like:

C:\Users\batman\

You can, however, get the users home directory by using Python’s os.path.expanduser method.

Continue reading “How to Check a User’s Home Directory for a Folder – Python 3”