[BUG] get_throttling_function_name could not find match for multiple
See original GitHub issueDescribe the bug
Having issues resolving video URLs for a give youtube video. I get the following error
pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple
To Reproduce Please provide the following information:
- The video or playlist url that is causing the error.
https://www.youtube.com/watch?v=Y4-GSFKZmEg
The code where the problem is occurring.
from pytube import YouTube
url = "https://www.youtube.com/watch?v=Y4-GSFKZmEg"
yt = YouTube(url)
thevid = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first()
vid = thevid
print("VID", vid)
Expected behavior the output should print the video asset URL where the video can be downloaded from
Output
Traceback (most recent call last):
File "/Users/par/Dev/mememaker-web/mememaker/scripts/pytube_test.py", line 5, in <module>
thevid = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first()
File "/Users/par/.virtualenvs/mememaker/lib/python3.9/site-packages/pytube/__main__.py", line 296, in streams
return StreamQuery(self.fmt_streams)
File "/Users/par/.virtualenvs/mememaker/lib/python3.9/site-packages/pytube/__main__.py", line 188, in fmt_streams
extract.apply_signature(stream_manifest, self.vid_info, self.js)
File "/Users/par/.virtualenvs/mememaker/lib/python3.9/site-packages/pytube/extract.py", line 409, in apply_signature
cipher = Cipher(js=js)
File "/Users/par/.virtualenvs/mememaker/lib/python3.9/site-packages/pytube/cipher.py", line 43, in __init__
self.throttling_plan = get_throttling_plan(js)
File "/Users/par/.virtualenvs/mememaker/lib/python3.9/site-packages/pytube/cipher.py", line 405, in get_throttling_plan
raw_code = get_throttling_function_code(js)
File "/Users/par/.virtualenvs/mememaker/lib/python3.9/site-packages/pytube/cipher.py", line 311, in get_throttling_function_code
name = re.escape(get_throttling_function_name(js))
File "/Users/par/.virtualenvs/mememaker/lib/python3.9/site-packages/pytube/cipher.py", line 296, in get_throttling_function_name
raise RegexMatchError(
pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple
System information Please provide the following information:
- Python 3.9.9
- print(pytube.version) 12.0.0
- python -m pip install git+https://github.com/pytube/pytube
Issue Analytics
- State:
- Created a year ago
- Reactions:25
- Comments:42 (3 by maintainers)
Top Results From Across the Web
get_throttling_function_name: could not find match for multiple ...
in the answer above may be parsed incorrectly by pycharm if just copy/pasted from web. To fix, try merging the two strings onto...
Read more >pytube.exceptions.RegexMatchError ... - GitHub
pytube.exceptions.RegexMatchError : get_throttling_function_name: could not find match for multiple[BUG] #1105.
Read more >get_throttling_function_name: could not find match for multiple
Line of code: r'a\.[A-Z]&&\(b=a\. get \("n"\)\)&&\(b=([^(]+)\(b\)',In this video, you will leran how to fix the error : pytube.exceptions.
Read more >get_throttling_function_name: could not find match for multiple ...
RegexMatchError : get_throttling_function_name: could not find match for multiple pytube ; 1. try upgrading pytube like this: ; 2. pip install ...
Read more >Regexmatcherror With Pytube - ADocLib
[BUG] pytube.exceptions.RegexMatchError: getthrottlingfunctionname: could not find match for multiple. I did this simple code for downloading videos:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
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
Apparently the JavaScript code containing details of the throttling function name is now of the form:
And the regex in
cipher.py
cannot match the same as it searches for variable names of a fixed length (3 in this case).Changing the regex in
function_patterns
incipher.py
to:and changing line 288 of
cipher.py
to:to escape the ‘$’ symbol now present in the ‘nfunc’ value seems to resolve the errors.
@manish-kumar-iisc Neither of the PRs containing the fixes for this problem have been merged as of yet, so you’ll have to either make the changes manually or install one of the forks containing the fix: