python - 无法在 Python 3 中使用 pytube 从 YouTube 下载视频
问题描述
from pytube import YouTube
yt = YouTube("https://www.youtube.com/watch?v=9bZkp7q19f0")
yt = yt.streams.first()
yt.download('Downloads')
我正在使用 pytube 从 YouTube 下载视频,但它引发了以下错误
Traceback (most recent call last):
File "E:/Python/landchecks/download_video", line 2, in <module>
yt = YouTube("https://www.youtube.com/watch?v=9bZkp7q19f0")
File "E:\Python\landchecks\venv\lib\site-packages\pytube\__main__.py", line 88, in __init__
self.prefetch_init()
File "E:\Python\landchecks\venv\lib\site-packages\pytube\__main__.py", line 97, in prefetch_init
self.init()
File "E:\Python\landchecks\venv\lib\site-packages\pytube\__main__.py", line 143, in init
mixins.apply_descrambler(self.player_config_args, fmt)
File "E:\Python\landchecks\venv\lib\site-packages\pytube\mixins.py", line 96, in apply_descrambler
for i in stream_data[key].split(',')
KeyError: 'url_encoded_fmt_stream_map'
解决方案
推荐阅读
- selenium - 如何在 verifyElementPresent 中使用条件语句
- java - Maven vert.x jdbc 项目无法在类路径上找到 c3p0.properties 文件来配置 c3p0 重试尝试
- mercurial - Conda 和 conda-forge 安装所有 conda 环境中可用的命令
- swift - Web 请求后返回 NSOutlineView 的 numberOfChildrenOfItem
- continuous-integration - Monorepo 中多个项目的 Travis 配置
- php - 在 Laravel 5.8 中,如何在包中定义模型工厂?
- python - 如何删除 matplotlib 集合
- ruby-on-rails - 安装 Ruby on Rails 时出现 SQLite gem 问题
- javascript - 如何修复 JavaScript/Solidity 中的“Uncaught (in promise) TypeError”
- sdn - Ping 不适用于手动设置流规则