import pytube
link = 'https://youtu.be/WvISLQMd8BM'
save_path = 'c:Temp'
pytube.YouTube(link).streams.first().download(save_path)
Windows 10 and Python 3.7
Traceback (most recent call last):
File "C:/MyWork/PythonEdu/_DownloadTube/Issue.py", line 7, in
pytube.YouTube(link).streams.first().download(save_path)
File "C:UsersIngeneerAppDataLocalProgramsPythonPython37libsite-packagespytube__main__.py", line 88, in __init__
self.prefetch_init()
File "C:UsersIngeneerAppDataLocalProgramsPythonPython37libsite-packagespytube__main__.py", line 97, in prefetch_init
self.init()
File "C:UsersIngeneerAppDataLocalProgramsPythonPython37libsite-packagespytube__main__.py", line 143, in init
mixins.apply_descrambler(self.player_config_args, fmt)
File "C:UsersIngeneerAppDataLocalProgramsPythonPython37libsite-packagespytubemixins.py", line 96, in apply_descrambler
for i in stream_data[key].split(',')
KeyError: 'url_encoded_fmt_stream_map'
Fixed, #537
I am getting the same error on Ubuntu 18 Python 3.7
Python 3.7.5 (default, Nov 7 2019, 10:50:52)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pytube import YouTube
>>> yt = YouTube('http://youtube.com/watch?v=B0CuLzsivzA')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/pytube/pytube/__main__.py", line 88, in __init__
self.prefetch_init()
File "/opt/pytube/pytube/__main__.py", line 97, in prefetch_init
self.init()
File "/opt/pytube/pytube/__main__.py", line 143, in init
mixins.apply_descrambler(self.player_config_args, fmt)
File "/opt/pytube/pytube/mixins.py", line 96, in apply_descrambler
for i in stream_data[key].split(',')
KeyError: 'url_encoded_fmt_stream_map'
This solved it, for me.
https://github.com/nficano/pytube/issues/467#issuecomment-567560796
@rosin55 fixed in my Python 3 only fork: https://github.com/hbmartin/pytube3
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
I am getting the same error on Ubuntu 18 Python 3.7