Forum Archive

Pytube failing

ihf

Pytube was working fine but I suddenly started getting the following when downloading:

Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/B86CEE4E-E4A9-4BB4-9CA7-6E13BDA2C2A4/Pythonista3/Documents/youtube_dl.py", line 4, in
YouTube(appex.get_url()).streams.first().download()
File "/private/var/mobile/Containers/Shared/AppGroup/B86CEE4E-E4A9-4BB4-9CA7-6E13BDA2C2A4/Pythonista3/Documents/site-packages/pytube/main.py", line 81, in init

File "/private/var/mobile/Containers/Shared/AppGroup/B86CEE4E-E4A9-4BB4-9CA7-6E13BDA2C2A4/Pythonista3/Documents/site-packages/pytube/main.py", line 90, in prefetch_init
"""
File "/private/var/mobile/Containers/Shared/AppGroup/B86CEE4E-E4A9-4BB4-9CA7-6E13BDA2C2A4/Pythonista3/Documents/site-packages/pytube/main.py", line 117, in init
stream_maps.append('adaptive_fmts')
File "/private/var/mobile/Containers/Shared/AppGroup/B86CEE4E-E4A9-4BB4-9CA7-6E13BDA2C2A4/Pythonista3/Documents/site-packages/pytube/mixins.py", line 76, in apply_descrambler
for i in stream_data[key].split(',')
KeyError: 'url_encoded_fmt_stream_map'

This version also works fine on a Mac. Can anyone see what might be causing this problem?

Phuket2

@ihf , sorry I am no help. But did you try running under 2.7 in Pythonista?

zrzka

Google is your friend when you're lost. Second result leads to #188, then to comment 356410149 and then to pytube to 8.x releases.

  • Launch StaSh
  • pip remove pytube
  • pip install pytube
  • Kill & launch Pythonista

Should fix your issue.

ihf

That did it. Thanks!