AttributeError: 'YouTube' object has no attribute 'get_videos'

AttributeError: 'YouTube' object has no attribute 'get_videos'

我在尝试从 python 下载 YouTube 视频时遇到此错误 AttributeError: 'YouTube' object has no attribute 'get_videos'

最后一行导致错误。

import pytube

link = ""
yt = pytube.YouTube(link)
videos = yt.get_videos()

谢谢!

import pytube
link = "https://www.youtube.com/watch?v=mpjREfvZiDs"
yt = pytube.YouTube(link)
stream = yt.streams.first()
stream.download()

试试上面的代码。 Here and here 类似的代码不起作用。

from pytube import YouTube
yt = YouTube("Please copy and paste the video link here")
print(yt.title)
stream = yt.streams.first()
stream.download()