Search code examples
pythonpytube

"KeyError: title" with PyTube


I have the following code:

from pytube import YouTube

yt = YouTube('https://www.youtube.com/watch?v=9bZkp7q19f0')
print(yt.title)

And am being thrown the following error

Traceback (most recent call last):
  File "C:\Users\tom\Desktop\Desktop\archiver.py", line 4, in <module>
    print(yt.title)
  File "C:\Users\tom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pytube\__main__.py", line 254, in title
    return self.player_config_args['title']
KeyError: 'title'

What is going wrong here?


Solution

  • A lot of people having this issue, one suggested thing to try is to make the following changes mentioned in this pull request.

    https://github.com/nficano/pytube/pull/435/files.