当尝试运行我的小型测试脚本时,Pytube 十分之五会向我发送此错误。
这是脚本:
import pytube
import urllib.request
from pytube import YouTube
yt = YouTube('https://www.youtube.com/watch?v=3NCyD3XoJgM')
print('Youtube video title is: ' + yt.title + '! Downloading now!')
这是我得到的:
Traceback (most recent call last):
File "youtube.py", line 6, in <module>
yt = YouTube('https://www.youtube.com/watch?v=3NCyD3XoJgM')
File "C:\Users\test\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pytube\__main__.py", line 91, in __init__
self.prefetch()
File "C:\Users\test\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pytube\__main__.py", line 183, in prefetch
self.js_url = extract.js_url(self.watch_html)
File "C:\Users\test\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pytube\extract.py", line 143, in js_url
base_js = get_ytplayer_config(html)["assets"]["js"]
KeyError: 'assets'
我很困扰。我尝试重新安装 Python 加 pytube 但我似乎无法解决这个问题。越来越令人困惑的是,该脚本一半的时间有效,但另一半则无效。
慕斯王
回首忆惘然
慕姐4208626
繁华开满天机
慕桂英3389331
慕桂英546537
相关分类