这是我尝试下载任何官方视频时总是遇到的错误,但在使用某些在线下载应用程序时会下载相同的视频。
KeyError Traceback (most recent call last)
~\anaconda3\lib\site-packages\pytube\extract.py in apply_descrambler(stream_data, key)
--> 297 for format_item in formats
~\anaconda3\lib\site-packages\pytube\extract.py in <listcomp>(.0)
296 }
--> 297 for format_item in formats
298 ]
KeyError: 'url'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
<ipython-input-1-796467b30bec> in <module>
7 import cv2
8
----> 9 video = YouTube('https://www.youtube.com/watch?v=tDq3fNew1rU')
~\anaconda3\lib\site-packages\pytube\__main__.py in __init__(self, url, defer_prefetch_init, on_progress_callback, on_complete_callback, proxies)
90 if not defer_prefetch_init:
91 self.prefetch()
---> 92 self.descramble()
94 def descramble(self) -> None:
~\anaconda3\lib\site-packages\pytube\__main__.py in descramble(self)
130 if not self.age_restricted and fmt in self.vid_info:
131 apply_descrambler(self.vid_info, fmt)
--> 132 apply_descrambler(self.player_config_args, fmt)
134 if not self.js:
~\anaconda3\lib\site-packages\pytube\extract.py in apply_descrambler(stream_data, key)
299 except KeyError:
300 cipher_url = [
--> 301 parse_qs(formats[i]["cipher"]) for i, data in enumerate(formats)
302 ]
303 stream_data[key] = [
~\anaconda3\lib\site-packages\pytube\extract.py in <listcomp>(.0)
299 except KeyError:
300 cipher_url = [
--> 301 parse_qs(formats[i]["cipher"]) for i, data in enumerate(formats)
302 ]
303 stream_data[key] = [
KeyError: 'cipher'
所以任何人都可以帮助我解决这个错误