Regex error in youtube for finding function name
I was getting the following regex error: youtube_dl.utils.RegexNotFoundError Looking at the raw JS in jscode it seems that the script is trying to find the "sL" bit: [this obviously changes each time] ...yt.akamaized.net/)||d.set("alr","yes");c&&d.set(b,(0,window.encodeURIComponent)(sL((0,window.decodeURIComponent)(c))));return d}; But it failed to match the original regex (line 1194) because of the additional '(0,window.encodeURIComponent)(' part This new regex (added on line 1195) fixes the problem and it works for me! I find it really hard to force youtube-dl go via the _parse_sig_js function to test. But I have reproduced the error at least four times and confirmed the new regex solves the problem.
This commit is contained in:
parent
d19600df07
commit
d06b02cb21
@ -1192,6 +1192,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
(r'(["\'])signature\1\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\(',
|
||||
r'\.sig\|\|(?P<sig>[a-zA-Z0-9$]+)\(',
|
||||
r'yt\.akamaized\.net/\)\s*\|\|\s*.*?\s*c\s*&&\s*d\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\(',
|
||||
r'yt\.akamaized\.net/\)\s*\|\|\s*.*?\s*c\s*&&\s*d\.set\([^,]*\s*,\s*\([^)]*\)\((?P<sig>[a-zA-Z0-9$]+)\(',
|
||||
r'\bc\s*&&\s*d\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\(',
|
||||
r'\bc\s*&&\s*d\.set\([^,]+\s*,\s*\([^)]*\)\s*\(\s*(?P<sig>[a-zA-Z0-9$]+)\('),
|
||||
jscode, 'Initial JS player signature function name', group='sig')
|
||||
|
Loading…
x
Reference in New Issue
Block a user