'can't get Youtube video with pytube library

I coding a youtube video downloader if I using Youtube() to get video it's doesn't work

my code:

from pytube import YouTube
import os
yt = YouTube("https://www.youtube.com/watch?v=-7F40MVG0Wc")
print(yt.title)
stream = yt.streams.first()
stream.download()

in the third line I get a lot of errors

errors I get:

Traceback (most recent call last):
  File "d:\Projects\Youtube Video Downloader\index5.py", line 3, in <module>
    yt = YouTube("https://www.youtube.com/watch?v=-7F40MVG0Wc")

How can me fix this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source