Pytube error when I'm trying download video

Viewed 1328

When I tried to download video with pytube there was error: pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple.

I saw this here, but when I tried it didn't work. (if it's only decision please send all code of cipher.py)

Here's the code

from pytube import YouTube

stream = YouTube("https://www.youtube.com/watch?v=SBQprWeOx8g").streams.get_highest_resolution()
stream.download('video.mp4')
1 Answers

Upgarde pytube to 12.0.0

python3 -m pip install --upgrade pytube

Then if you get error: AttributeError: 'NoneType' object has no attribute 'span' go to your python root folder like:

C:\Users\#\AppData\Local\Programs\Python\Python310\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\([^)]?\)")

if it doesn't work then try : in pytube/cipher.py on line 311:

change : name = re.escape(get_throttling_function_name(js))

to : name = "hha"

Related