Open
Description
🛑 DO NOT REMOVE OR SKIP THIS ISSUE TEMPLATE 🛑
Issues with incomplete or missing information will be closed automatically.
🐞 Bug Description
I receive errors when trying to fetch streams for any YouTube video. It happens across different clients, regardless of whether use_po_token=True is set or not.
🔢 Code Snippet
Include the minimal code snippet that reproduces the issue.
# Insert your code here
from pytubefix import YouTube
url = 'https://www.youtube.com/watch?v=0_6AK52kSVQ'
yt = YouTube(url=url, client='WEB')
stream = yt.streams.get_by_itag(137)
🎯 Expected Behavior
The expected behavior is to retrieve the specified video stream using its itag without any errors. The stream object should be returned successfully so I can proceed with downloading or processing the video.
📸 Screenshots or Logs
Traceback (most recent call last):
File "xxxxxxxxx", line 4, in
stream = yt.streams.get_by_itag(137)
^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pytubefix_main_.py", line 650, in streams
return StreamQuery(self.fmt_streams)
^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pytubefix_main_.py", line 287, in fmt_streams
extract.apply_signature(stream_manifest, self.vid_info, self.js, self.js_url)
File "C:\Python312\Lib\site-packages\pytubefix\extract.py", line 503, in apply_signature
discovered_n[initial_n] = cipher.get_throttling(initial_n)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pytubefix\cipher.py", line 39, in get_throttling
return self.js_interpreter.call_function(self.throttling_function_name, n)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pytubefix\jsinterp.py", line 1096, in call_function
return self.extract_function(funcname)(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pytubefix\jsinterp.py", line 261, in call
return self.func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pytubefix\jsinterp.py", line 1106, in resf
ret, should_abort = self.interpret_statement(code.replace('\n', ' '), var_stack, allow_recursion - 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pytubefix\jsinterp.py", line 579, in interpret_statement
ret, should_return = self.interpret_statement(sub_stmt, local_vars, allow_recursion)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pytubefix\jsinterp.py", line 773, in interpret_statement
ret, should_abort = self.interpret_statement(sub_expr, local_vars, allow_recursion)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pytubefix\jsinterp.py", line 814, in interpret_statement
local_vars[m.group('out')] = self.operator(
^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pytubefix\jsinterp.py", line 543, in operator
right_val = self.interpret_expression(right_expr, local_vars, allow_recursion)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pytubefix\jsinterp.py", line 1029, in interpret_expression
ret, should_return = self.interpret_statement(expr, local_vars, allow_recursion)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pytubefix\jsinterp.py", line 652, in interpret_statement
self.interpret_expression(item, local_vars, allow_recursion)
File "C:\Python312\Lib\site-packages\pytubefix\jsinterp.py", line 1029, in interpret_expression
ret, should_return = self.interpret_statement(expr, local_vars, allow_recursion)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\pytubefix\jsinterp.py", line 847, in interpret_statement
val = local_vars[m.group('in')]
~~~~~~~~~~^^^^^^^^^^^^^^^
File "C:\Python312\Lib\collections_init.py", line 1014, in getitem
return self.missing(key) # support subclasses that define missing
^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\collections_init.py", line 1006, in missing
raise KeyError(key)
KeyError: 'lP'
🖥️ Environment Details
Fill in the details below about your setup:
- Operating System: Windows 10
- Python Version: 3.12
- Pytubefix Version: 8.12.2
🚀 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
Labels
Projects
Status
waiting