本文介绍了AttributeError:“ YouTube”对象没有属性“ get_videos”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试从python下载YouTube视频时,遇到此错误 AttributeError:'YouTube'对象没有属性'get_videos'
。
While trying to download a YouTube video from python, I come across this error 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()
尝试上面的代码。
和类似的代码无效。
Try above code.Here and here similar code which does not work.
这篇关于AttributeError:“ YouTube”对象没有属性“ get_videos”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!