Skip to content

KeyError: 'results' #463

Open
Open
@OsymandiasII

Description

@OsymandiasII

🛑 DO NOT REMOVE OR SKIP THIS ISSUE TEMPLATE 🛑

Issues with incomplete or missing information will be closed automatically.


🐞 Bug Description

Provide a clear and concise description of the bug.

Hello
I am following the code given in the readme

from pytubefix import YouTube
from pytubefix.cli import on_progress

url = "url"

yt = YouTube(url, use_oauth=True, allow_oauth_cache=True, on_progress_callback=on_progress)
ys = yt.streams.get_highest_resolution()
ys.download()

however i get an error coming from pytubefix code

Traceback (most recent call last):
  File "/Users/timothemalandain/Desktop/Projets/ytDownloader.nosync/ytd/lib/python3.13/site-packages/pytubefix/__main__.py", line 771, in title
    contents = self.vid_details['contents'][
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        'singleColumnWatchNextResults'][
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        'results'][
        ^^^^^^^^^^
KeyError: 'results' 

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/timothemalandain/Desktop/Projets/ytDownloader.nosync/download_v.py", line 77, in <module>
    ys = yt.streams.get_highest_resolution()
         ^^^^^^^^^^
  File "/Users/timothemalandain/Desktop/Projets/ytDownloader.nosync/ytd/lib/python3.13/site-packages/pytubefix/__main__.py", line 715, in streams
    return StreamQuery(self.fmt_streams)
                       ^^^^^^^^^^^^^^^^
  File "/Users/timothemalandain/Desktop/Projets/ytDownloader.nosync/ytd/lib/python3.13/site-packages/pytubefix/__main__.py", line 353, in fmt_streams
    self.stream_monostate.title = self.title
                                  ^^^^^^^^^^
  File "/Users/timothemalandain/Desktop/Projets/ytDownloader.nosync/ytd/lib/python3.13/site-packages/pytubefix/__main__.py", line 803, in title
    raise exceptions.PytubeFixError(
    ...<4 lines>...
    ) from e
pytubefix.exceptions.PytubeFixError: Exception while accessing title of https://youtube.com/watch?v=boS3WJ7lxJM. Please file a bug report at https://github.com/JuanBindez/pytubefix

🔢 Code Snippet

Include the minimal code snippet that reproduces the issue.

from pytubefix import YouTube
from pytubefix.cli import on_progress

link = input("Enter the YouTube video URL: ")
#Download(link)

url = link

yt = YouTube(url, 'WEB_CREATOR',use_oauth=True, allow_oauth_cache=True, on_progress_callback=on_progress)
#print(yt.title)

ys = yt.streams.get_highest_resolution()
ys.download()

🎯 Expected Behavior

I want to download a video from youtube using pytubefix.


📸 Screenshots or Logs


🖥️ Environment Details

Fill in the details below about your setup:

  • **Operating System: MacOS 15.1
  • **Python Version: 3.13.0
  • **Pytubefix Version: 8.12.3

📋 Additional Context

Add any additional information or context that might help us resolve the issue.


🚀 Next Steps

Once submitted, we will triage the issue. Make sure to respond to follow-up questions to keep the process smooth.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status

    waiting

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions