PureDevOps Community

Pytube 'NoneType' object has no attribute 'span' - Python

Solution :1

Try in pytube/cipher.py on line 293:

You change

name = re.escape(get_throttling_function_name(js))

to

name = "iha"

Solution :2

you can also parser.py as

Found this issue, pytube v11.0.1. It’s a little late for me, but if no one has submitted a fix tomorrow I’ll check it out.

in C:\Python38\lib\site-packages\pytube\parser.py

Change this line:

152: func_regex = re.compile(r"function\([^)]+\)")

to this:

152: func_regex = re.compile(r"function\([^)]?\)")

The issue is that the regex expects a function with an argument, but I guess youtube added some src that includes non-paramterized functions.

and just forked pytube lib on GitHub, and changed the file.

You can install pytube this way:

pip install git+https://github.com/baxterisme/pytube

Instead of:

pip install pytube