[BUG] 'NoneType' object has no attribute 'span'
See original GitHub issuearr = yt.streams.filter(only_video=True, file_extension='mp4')
line 292, in streams
return StreamQuery(self.fmt_streams)
File "...\Python39\lib\site-packages\pytube\__main__.py", line 177, in fmt_streams
extract.apply_signature(stream_manifest, self.vid_info, self.js)
File "...\Python39\lib\site-packages\pytube\extract.py", line 409, in apply_signature
cipher = Cipher(js=js)
File "...\Python39\lib\site-packages\pytube\cipher.py", line 44, in __init__
self.throttling_array = get_throttling_function_array(js)
File "...\Python39\lib\site-packages\pytube\cipher.py", line 323, in get_throttling_function_array
str_array = throttling_array_split(array_raw)
File "...\Python39\lib\site-packages\pytube\parser.py", line 158, in throttling_array_split
match_start, match_end = match.span()
AttributeError: 'NoneType' object has no attribute 'span'
Pytube version: 11.0.1
Python 3.9.7
Issue Analytics
- State:
- Created 2 years ago
- Reactions:14
- Comments:48 (2 by maintainers)
Top Results From Across the Web
pytube: AttributeError: 'NoneType' object has no attribute 'span'
The issue is that the regex expects a function with an argument, but I guess youtube added some src that includes non-paramterized functions....
Read more >[BUG] 'NoneType' object has no attribute 'span' #1218 - GitHub
You can do this by running python -m pip install git+https://github.com/pytube/pytube . Sometimes, the pypi library repository is not up to date ...
Read more >[Solved] AttributeError: 'NoneType' object has no attribute 'span'
To Solve AttributeError: 'NoneType' object has no attribute 'span' Error There are issue is that the regex expects a function with an argument...
Read more >[Example code]-pytube: 'NoneType' object has no attribute 'span'
Found a fix on github: NoneType object has no attribute 'span'. Just replace the function get_throttling_function_name with:
Read more >How do I fix : attributeerror: 'nonetype' object has no attribute ...
When ever you get a problems that involves a message such as " 'nonetype' object has no attribute ..." it means the same...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please re open this issue, I encountered the same error
seems to happen, because YouTube added functions without parameters in the javascript. e.g.:
So in my opinion the best fix would be to allow the regex to accept these too. That is, change the regex
function\([^)]+\)
tofunction\([^)]*\)
. The*
allows the function to have no parameters.So https://github.com/pytube/pytube/blob/f06e0710dcf5089e582487fee94f7bb0afbf7ba9/pytube/parser.py#L152 should be changed to
Any opinion about that?