【问题标题】:HTTP Error404 in pytubepytube 中的 HTTP Error404
【发布时间】:2021-10-01 15:17:19
【问题描述】:

它应该是一个 youtube 下载器,但每当我尝试运行代码时,我都会得到“urllib.error.HTTPError: HTTP Error 404: Not Found”,即使使用的 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")

【问题讨论】:

  • 可以分享一下网址吗?
  • youtu.be/arQySiQLsbw m.youtube.com/watch?v=arQySiQLsbw(同一视频的不同链接)我什至尝试了不同视频的多个视频链接,但对我不起作用
  • 这是 pytube 的一个错误,它以前发生过并已修复,但看起来它可能已被重新引入
  • 您可以随时查看另一个库,例如youtube_dl 或 ytpy
  • youtube_dl 是一个很好的选择,因为 pytube 知道这个反复出现的问题。

标签: python python-3.x youtube urllib3 pytube


【解决方案1】:

我的错误已解决,是 pytube 模块出现错误如果有人看到任何代码的 HTTP 错误,请使用 2 个测试用例:

正确检查链接 重新安装 pytube(如果 pytube 不起作用安装 pytube3 但在卸载 pytube 之后) 谢谢大家!

【讨论】:

    猜你喜欢
    • 2021-10-05
    • 1970-01-01
    • 2013-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-09
    • 2019-11-11
    • 2022-12-18
    相关资源
    最近更新 更多