如何解决pytube 中的 HTTP 错误 404
它应该是一个 youtube 下载器,但是每当我尝试运行代码时,我都会收到“urllib.error.HTTPError:HTTP 错误 404:未找到”,即使使用的 url/链接是一个有效的 url/链接,它是可打开的使用任何浏览器。使用的ide:pycharm v2021.1.3 & pytube v10.9.3
from pytube import YouTube
link = input("Enter Link Here : ")
url = YouTube(link)
print("Downloading....")
video = url.streams.first()
video.download()
print("Downloaded")
#替代代码
from pytube import YouTube
link = input("Enter Youtube URL : ")
yt = YouTube(link)
videos = yt.streams.all()
# this will stream all the format available for the video
video = list(enumerate(videos))
# this will be index all the format in list starting with zero
for i in video:
print(i)
# this will print all the available format of video with proper index
print("Enter the desired option to download the format")
dn_option = int(input("Enter the option : "))
# ask user that which format he want to download
dn_video = videos[dn_option]
dn_video.download()
# for downloading the video
print("Downloaded successfully")
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。