get-pytube / pytube3

A lightweight, dependency-free Python 3 library (and command-line utility) for downloading YouTube Videos.
https://pytube3.readthedocs.io
Other
180 stars 55 forks source link

KeyError: 'formats' error on certain live feeds #74

Closed Ircama closed 4 years ago

Ircama commented 4 years ago

Installation (Python 3.6.9, pytube3-9.6.4):

pip3 uninstall -y pytube3
pip3 install git+https://github.com/get-pytube/pytube3
python3

Test:

from pytube import YouTube
YouTube('https://www.youtube.com/watch?v=5YceQ8YqYMc')

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".local/lib/python3.6/site-packages/pytube/__main__.py", line 92, in __init__
    self.descramble()
  File ".local/lib/python3.6/site-packages/pytube/__main__.py", line 132, in descramble
    apply_descrambler(self.player_config_args, fmt)
  File ".local/lib/python3.6/site-packages/pytube/extract.py", line 281, in apply_descrambler
    formats = json.loads(stream_data["player_response"])["streamingData"]["formats"]
KeyError: 'formats'
Ircama commented 4 years ago

Ref. https://github.com/nficano/pytube/issues/609