-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] RegexMatchError: get_throttling_function_name: could not find match for multiple - v15.0.0 #1954
Comments
Thank you for contributing to PyTube. Please remember to reference Contributing.md |
i encounter the exact same issue. After asking for help to chat-GPT it seems like youtube updated their javascript |
reported the same on the pytube3 as well. but seems like this is more maintained? they updated for sure. :/ any workaround for cipher.py and other modules that uses the regex:js? |
runnning into the same issue too currently! |
I see the same error as well |
have the same problem too. Python 3.12.4, pytube 15.0.0. |
Change the function_patterns array in cipher.py at line 264 to include this one and it seems to work:
|
how did you get to the solution? did you debug the js? Im curious how you work out to add another line of function_patterns string? |
It solved the problem, thanks! |
Worked for me on Python 3.12.4, Pytube 15.0.0, thanks! |
@garmanarnaryt I remembered when that regex was replaced the last time this happened, so I figured I'd just try putting it back and see what happens. |
Thanks! I was struggling with it for a few hours, and your fix worked! |
thank you. i confirm that it works now. I'm just curious on how to solve this kind of issue in the future. I tried to print out the "js" value on my own an try to understand the code. why the regex dont understand the current yt "js" |
It's working now. Thanks |
thanks bro |
Worked as a charm |
I don't understand they just put that coded text, where do I put it? What do I do with it? In what folder is what they mention to modify and you put what they say |
Change cipher.py at line 264 |
thank you. It works fine. |
worked for me as well |
you need change code at line 264 in file .venv/Lib/site-packages/pytube/cipher.py, where ".venv" name of folder python virtual environment. when you find file you will understand what need to change |
When will this be patched? I'm running this in a cloud function |
THANK YOU GUYS |
up v15.0.1! |
Thanks, it works now with python 3 and pytube 15, |
Someone open a PR for this ? |
No :( |
The fix is not working for me. There is no function_patterns array in cipher.py at line 264. Here is the code around line 264 in cipher.py: for js_func in tplan: Line 264 is 'output': ''.join(signature). I tried placing the fix in the middle of this FOR loop but it doesn't work. Is there another ciper.py file I'm missing? This is inside the pytube folder. |
Traceback (most recent call last): |
Broken again as of August 9, 2024 |
have anaconda with py 3.11.9 and pytube 15.0.0
|
still prefer I tried it out, which worked. it offers 2 features I like
To get started quickly, do the following (3ug835LFixU is the YT video_id as an example)
|
pytube.exceptions.regexmatcherror: map_functions: no se pudo encontrar la coincidencia para múltiples [error] Hay un nuevo problema? Encontraste alguna solución? |
For me this worked: pattern = r"%s=function\(\w\){[a-z=\.\(\"\)]*;(.*);(?:.+)}" % name To pattern = r"%s=function\(\w\){[a-z=\.\(\"\)]*;((\w+\.\w+\([\w\"\'\[\]\(\)\.\,\s]*\);)+)(?:.+)}" % name And also line 264 to r'a\.[a-zA-Z]\s*&&\s*\([a-z]\s*=\s*a\.get\("n"\)\)\s*&&.*?\|\|\s*([a-z]+)',
r'\([a-z]\s*=\s*([a-zA-Z0-9$]+)(\[\d+\])?\([a-z]\)',
r'\([a-z]\s*=\s*([a-zA-Z0-9$]+)(\[\d+\])\([a-z]\)', |
Windows: or in your folder python into folder Lib in site-packages\pytube in a array "function_patterns" add: Bye Solved |
Gracias actualmente tengo este problema Exception while accessing title of
https://youtube.com/watch?v=_HZM0QiuUS8. Please file a bug report at
https://github.com
/pytube/pytube q error sera no entiendo sabes el motivo? Me ayudas
El lun., 12 de agosto de 2024 8:23 a. m., Fernando Diaz <
***@***.***> escribió:
… I have confirmed that I am on the latest version of pytube by installing
from the source. 15.0.0
Since today I'm encountering a RegexMatchError when trying to download a
YouTube video using pytube. The error message suggests that the function
get_throttling_function_name could not find a match for multiple. Occurs
sometimes, not for all video.
*To Reproduce* https://www.youtube.com/watch?v=aDEDfbN5gIU stream =
yt.streams.filter(progressive=True,
file_extension='mp4').order_by('resolution').desc().first()
*Expected behavior* I expected the video to be downloaded without any
errors.
*Output* File "/usr/local/lib/python3.11/site-packages/pytube/*main*.py",
line 296, in streams return StreamQuery(self.fmt_streams) ^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pytube/*main*.py", line
188, in fmt_streams extract.apply_signature(stream_manifest, self.vid_info,
self.js) File "/usr/local/lib/python3.11/site-packages/pytube/extract.py",
line 409, in apply_signature cipher = Cipher(js=js) ^^^^^^^^^^^^^ File
"/usr/local/lib/python3.11/site-packages/pytube/cipher.py", line 43, in
*init* self.throttling_plan = get_throttling_plan(js)
^^^^^^^^^^^^^^^^^^^^^^^ File
"/usr/local/lib/python3.11/site-packages/pytube/cipher.py", line 405, in
get_throttling_plan raw_code = get_throttling_function_code(js)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File
"/usr/local/lib/python3.11/site-packages/pytube/cipher.py", line 311, in
get_throttling_function_code name =
re.escape(get_throttling_function_name(js))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File
"/usr/local/lib/python3.11/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*
- Python version 3.11
- Pytube version 15.0.0
- pip install pytube
For me this worked:
I had to change line 195 of the
"/usr/local/lib/python3.9/dist-packages/pytube/cipher.py" file from
pattern = r"%s=function\(\w\){[a-z=\.\(\"\)]*;(.*);(?:.+)}" % name
To
pattern = r"%s=function\(\w\){[a-z=\.\(\"\)]*;((\w+\.\w+\([\w\"\'\[\]\(\)\.\,\s]*\);)+)(?:.+)}" % name
And also line 264 to
r'a\.[a-zA-Z]\s*&&\s*\([a-z]\s*=\s*a\.get\("n"\)\)\s*&&.*?\|\|\s*([a-z]+)',
r'\([a-z]\s*=\s*([a-zA-Z0-9$]+)(\[\d+\])?\([a-z]\)',
r'\([a-z]\s*=\s*([a-zA-Z0-9$]+)(\[\d+\])\([a-z]\)',
—
Reply to this email directly, view it on GitHub
<#1954 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BGFUHRHK7YIOMZ6UHP7JYD3ZRCZORAVCNFSM6AAAAABKSZSFKOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBTHE4DINBTGM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Gracias actualmente tengo este problema Exception while accessing title of https://youtube.com/watch?v=_HZM0QiuUS8. Please file a bug report at https://github.com |
Si, pero comparte el código que te produce ese error |
Entonces tmb tienes el error Wao pensé q era el único
El jue., 22 de agosto de 2024 10:00 p. m., Fernando Diaz <
***@***.***> escribió:
… Gracias actualmente tengo este problema Exception while accessing title of
https://youtube.com/watch?v=_HZM0QiuUS8. Please file a bug report at
https://github.com
/pytube/pytube q error sera no entiendo sabes el motivo? Me ayudas
Si, pero comparte el código que te produce ese error
—
Reply to this email directly, view it on GitHub
<#1954 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BGFUHRCPMZZL534VZUIAZP3ZS2QUVAVCNFSM6AAAAABKSZSFKOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBWGA4TCOBZGM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Yo tenía un error distinto |
Podrías ayudarme con mi problema?exception while accessing title of
https://youtube.com/watch?v=_hzm0qiuus8. please file a bug report at
https://github.com /pytube/pytube
El jue., 22 de agosto de 2024 10:04 p. m., Fernando Diaz <
***@***.***> escribió:
… Entonces tmb tienes el error Wao pensé q era el único
El jue., 22 de agosto de 2024 10:00 p. m., Fernando Diaz <
*@*.***> escribió:
Gracias actualmente tengo este problema Exception while accessing title of
https://youtube.com/watch?v=_HZM0QiuUS8. Please file a bug report at
https://github.com
/pytube/pytube q error sera no entiendo sabes el motivo? Me ayudas
Si, pero comparte el código que te produce ese error
—
Reply to this email directly, view it on GitHub
#1954 (comment)
<#1954 (comment)>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/BGFUHRCPMZZL534VZUIAZP3ZS2QUVAVCNFSM6AAAAABKSZSFKOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBWGA4TCOBZGM
.
You are receiving this because you commented.Message ID:
*@*.***>
Yo tenía un error distinto
—
Reply to this email directly, view it on GitHub
<#1954 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BGFUHRFCTVZKQOCK26DQQO3ZS2REFAVCNFSM6AAAAABKSZSFKOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBWGA4TKMJUGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Si yo te puedo ayudar pero sube el código que te causa esa excepción |
2024/09/22 - this solution worked for me as well |
This also worked for me 9/24/2024 |
Does anyone know how we're getting the patterns? I'd love to see if we can add in a dynamic fix |
Hi! I tried this (05/10/2024) but it didn't work. This could be an error with me incorectly doing it. When I replace lines Exception has occurred: TypeError
'StreamQuery' object is not callable
File "C:\Users\[user]\Coding Adventures\Google Download Test.py", line 8, in <module>
print(pytube.YouTube(url).streams().get_highest_resolution())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'StreamQuery' object is not callable Heres the script I'm working on: url = "https://www.youtube.com/watch?v=eH4F1Tdb040"
print(pytube.YouTube(url).streams().get_highest_resolution()) |
I have confirmed that I am on the latest version of pytube by installing from the source. 15.0.0
Since today I'm encountering a RegexMatchError when trying to download a YouTube video using pytube. The error message suggests that the function get_throttling_function_name could not find a match for multiple. Occurs sometimes, not for all video.
To Reproduce
https://www.youtube.com/watch?v=aDEDfbN5gIU
stream = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first()
Expected behavior
I expected the video to be downloaded without any errors.
Output
File "/usr/local/lib/python3.11/site-packages/pytube/main.py", line 296, in streams
return StreamQuery(self.fmt_streams)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pytube/main.py", line 188, in fmt_streams
extract.apply_signature(stream_manifest, self.vid_info, self.js)
File "/usr/local/lib/python3.11/site-packages/pytube/extract.py", line 409, in apply_signature
cipher = Cipher(js=js)
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pytube/cipher.py", line 43, in init
self.throttling_plan = get_throttling_plan(js)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pytube/cipher.py", line 405, in get_throttling_plan
raw_code = get_throttling_function_code(js)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pytube/cipher.py", line 311, in get_throttling_function_code
name = re.escape(get_throttling_function_name(js))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/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
The text was updated successfully, but these errors were encountered: