Skip to content

Failure to get streams from YouTube object. #456

Open
@uukelele-scratch

Description

@uukelele-scratch

🛑 DO NOT REMOVE OR SKIP THIS ISSUE TEMPLATE 🛑

Issues with incomplete or missing information will be closed automatically.


🐞 Bug Description

Failure to get streams from YouTube object. Using po_token and visitorData.

>>> from pytubefix import YouTube as Video
>>> v = Video("https://www.youtube.com/watch?v=dQw4w9WgXcQ", use_po_token=True)
>>> v
<pytubefix.__main__.YouTube object: videoId=dQw4w9WgXcQ>
>>> v.streams
You can use the tool: https://github.com/YunzheZJU/youtube-po-token-generator, to get the token
Enter with your visitorData: Cgs5*****************************
Enter with your po_token: MnSteH******************************************************
Traceback (most recent call last):
  File "<pyshell#10>", line 1, in <module>
    v.streams
  File "C:\Users\robus\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\pytubefix\__main__.py", line 636, in streams
    self.check_availability()
  File "C:\Users\robus\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\pytubefix\__main__.py", line 316, in check_availability
    status, messages = extract.playability_status(self.vid_info)
  File "C:\Users\robus\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\pytubefix\__main__.py", line 425, in vid_info
    innertube_response = innertube.player(self.video_id)
  File "C:\Users\robus\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\pytubefix\innertube.py", line 871, in player
    return self._call_api(endpoint, query, self.base_data)
  File "C:\Users\robus\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\pytubefix\innertube.py", line 778, in _call_api
    response = request._execute_request(
  File "C:\Users\robus\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\pytubefix\request.py", line 35, in _execute_request
    return urlopen(request, timeout=timeout)  # nosec
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.752.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 189, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.752.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 495, in open
    response = meth(req, response)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.752.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 604, in http_response
    response = self.parent.error(
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.752.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 533, in error
    return self._call_chain(*args)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.752.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 466, in _call_chain
    result = func(*args)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.13_3.13.752.0_x64__qbz5n2kfra8p0\Lib\urllib\request.py", line 613, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

🔢 Code Snippet

Shown above


🎯 Expected Behavior

Expected to see streams list.


📸 Screenshots or Logs


🖥️ Environment Details

Fill in the details below about your setup:

  • Operating System: Windows 11
  • Python Version: 3.13.2
  • Pytubefix Version: 8.8.5

📋 Additional Context

N/A


🚀 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