diff options
author | dirkf <[email protected]> | 2024-07-24 14:45:52 +0100 |
---|---|---|
committer | dirkf <[email protected]> | 2024-07-25 00:16:00 +0100 |
commit | e1b3fa242cb94eb9dc949ab3f2cace91c46f11bf (patch) | |
tree | 45a00a09abb96cb17dd65237ff37abea49c2a117 /youtube_dl | |
parent | 451046d62a1b57cc473625c728ff89d7a66933c3 (diff) | |
download | youtube-dl-e1b3fa242cb94eb9dc949ab3f2cace91c46f11bf.tar.gz youtube-dl-e1b3fa242cb94eb9dc949ab3f2cace91c46f11bf.zip |
[Youtube] Find `n` function name in player `3400486c`
Fixes #32877
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/youtube.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index bb9f48e4c..84371ff06 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -1659,11 +1659,15 @@ class YoutubeIE(YoutubeBaseInfoExtractor): def _extract_n_function_name(self, jscode): func_name, idx = self._search_regex( # new: (b=String.fromCharCode(110),c=a.get(b))&&c=nfunc[idx](c) + # or: (b="nn"[+a.D],c=a.get(b))&&(c=nfunc[idx](c)s # old: .get("n"))&&(b=nfunc[idx](b) # older: .get("n"))&&(b=nfunc(b) r'''(?x) - (?:\(\s*(?P<b>[a-z])\s*=\s*String\s*\.\s*fromCharCode\s*\(\s*110\s*\)\s*,(?P<c>[a-z])\s*=\s*[a-z]\s*)? - \.\s*get\s*\(\s*(?(b)(?P=b)|"n")(?:\s*\)){2}\s*&&\s*\(\s*(?(c)(?P=c)|b)\s*=\s* + (?:\(\s*(?P<b>[a-z])\s*=\s*(?: + String\s*\.\s*fromCharCode\s*\(\s*110\s*\)| + "n+"\[\s*\+?s*[\w$.]+\s*] + )\s*,(?P<c>[a-z])\s*=\s*[a-z]\s*)? + \.\s*get\s*\(\s*(?(b)(?P=b)|"n{1,2}")(?:\s*\)){2}\s*&&\s*\(\s*(?(c)(?P=c)|b)\s*=\s* (?P<nfunc>[a-zA-Z_$][\w$]*)(?:\s*\[(?P<idx>\d+)\])?\s*\(\s*[\w$]+\s*\) ''', jscode, 'Initial JS player n function name', group=('nfunc', 'idx')) if not idx: |