我编写了这段代码来制作 Python 视频下载器: from pytube import *
# where to save
from pytube import YouTube
SAVE_PATH = "C:/Downloads"
# link of the video to be downloaded
link = input('Copy and paste your link here: ')
try:
yt: YouTube = YouTube(link)
except:
print("Connection Error")
mp4files = yt.filter('mp4')
yt.set_filename = input('What do u want to name it: ')
d_video = yt.get(mp4files[-1].extension, mp4files[-1].resolution)
try:
d_video.download(SAVE_PATH)
except:
print("Some Error!")
print('Task Completed!')
在我运行它之后,它要求我输入我想要它下载的链接,就像我想要的那样,在我输入链接之后,它显示了这个错误:
mp4files = yt.filter('mp4')
NameError: name 'yt' is not defined
我如何解决它 ???