mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-24 01:22:07 +00:00
Compare commits
8 Commits
3d649843fe
...
65ea8e014a
Author | SHA1 | Date | |
---|---|---|---|
|
65ea8e014a | ||
|
803210d287 | ||
|
1e6397b4ac | ||
|
54c145a24f | ||
|
1ebb56cdb8 | ||
|
c1ebf43139 | ||
|
8e172670f4 | ||
|
57b0e045d4 |
@ -516,11 +516,10 @@ class TestJSInterpreter(unittest.TestCase):
|
|||||||
['t', 'e', 's', 't'])
|
['t', 'e', 's', 't'])
|
||||||
self._test('function f(){return "t-e-s-t".split(/[es-]+/)}',
|
self._test('function f(){return "t-e-s-t".split(/[es-]+/)}',
|
||||||
['t', 't'])
|
['t', 't'])
|
||||||
# from MDN: surrogate pairs aren't handled: case 1 fails
|
# from MDN: surrogate pairs aren't handled: case 1 fails, and case 2 beats Py3.2
|
||||||
# self._test('function f(){return "😄😄".split(/(?:)/)}',
|
|
||||||
# ['\ud83d', '\ude04', '\ud83d', '\ude04'])
|
|
||||||
# case 2 beats Py3.2: it gets the case 1 result
|
|
||||||
if sys.version_info >= (2, 6) and not ((3, 0) <= sys.version_info < (3, 3)):
|
if sys.version_info >= (2, 6) and not ((3, 0) <= sys.version_info < (3, 3)):
|
||||||
|
# self._test('function f(){return "😄😄".split(/(?:)/)}',
|
||||||
|
# ['\ud83d', '\ude04', '\ud83d', '\ude04'])
|
||||||
self._test('function f(){return "😄😄".split(/(?:)/u)}',
|
self._test('function f(){return "😄😄".split(/(?:)/u)}',
|
||||||
['😄', '😄'])
|
['😄', '😄'])
|
||||||
|
|
||||||
|
@ -206,10 +206,6 @@ _NSIG_TESTS = [
|
|||||||
'https://www.youtube.com/s/player/3bb1f723/player_ias.vflset/en_US/base.js',
|
'https://www.youtube.com/s/player/3bb1f723/player_ias.vflset/en_US/base.js',
|
||||||
'gK15nzVyaXE9RsMP3z', 'ZFFWFLPWx9DEgQ',
|
'gK15nzVyaXE9RsMP3z', 'ZFFWFLPWx9DEgQ',
|
||||||
),
|
),
|
||||||
(
|
|
||||||
'https://www.youtube.com/s/player/f8f53e1a/player_ias.vflset/en_US/base.js',
|
|
||||||
'VTQOUOv0mCIeJ7i8kZB', 'kcfD8wy0sNLyNQ',
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -1665,29 +1665,37 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||||||
|
|
||||||
def _extract_n_function_name(self, jscode):
|
def _extract_n_function_name(self, jscode):
|
||||||
func_name, idx = self._search_regex(
|
func_name, idx = self._search_regex(
|
||||||
# (y=NuD(),Mw(k),q=k.Z[y]||null)&&(q=narray[idx](q),k.set(y,q),k.V||NuD(''))}};
|
|
||||||
# (R="nn"[+J.Z],mW(J),N=J.K[R]||null)&&(N=narray[idx](N),J.set(R,N))}};
|
# (R="nn"[+J.Z],mW(J),N=J.K[R]||null)&&(N=narray[idx](N),J.set(R,N))}};
|
||||||
# or: (b=String.fromCharCode(110),c=a.get(b))&&c=narray[idx](c)
|
# new: (b=String.fromCharCode(110),c=a.get(b))&&c=nfunc[idx](c)
|
||||||
# or: (b="nn"[+a.D],c=a.get(b))&&(c=narray[idx](c)
|
# or: (b="nn"[+a.D],c=a.get(b))&&(c=nfunc[idx](c)
|
||||||
# or: (PL(a),b=a.j.n||null)&&(b=narray[idx](b)
|
# or: (PL(a),b=a.j.n||null)&&(b=nfunc[idx](b)
|
||||||
# or: (b="nn"[+a.D],vL(a),c=a.j[b]||null)&&(c=narray[idx](c),a.set(b,c),narray.length||nfunc("")
|
# or: (b="nn"[+a.D],vL(a),c=a.j[b]||null)&&(c=narray[idx](c),a.set(b,c),narray.length||nfunc("")
|
||||||
# old: (b=a.get("n"))&&(b=narray[idx](b)(?P<c>[a-z])\s*=\s*[a-z]\s*
|
# old: (b=a.get("n"))&&(b=nfunc[idx](b)(?P<c>[a-z])\s*=\s*[a-z]\s*
|
||||||
# older: (b=a.get("n"))&&(b=nfunc(b)
|
# older: (b=a.get("n"))&&(b=nfunc(b)
|
||||||
r'''(?x)
|
r'''(?x)
|
||||||
# (expr, ...,
|
\((?:[\w$()\s]+,)*?\s* # (
|
||||||
\((?:(?:\s*[\w$]+\s*=)?(?:[\w$"+\.\s(\[]+(?:[)\]]\s*)?),)*
|
(?P<b>[a-zA-Z])\s*=\s* # b=, R=
|
||||||
# b=...
|
(?:
|
||||||
(?P<b>[\w$]+)\s*=\s*(?!(?P=b)[^\w$])[\w$]+\s*(?:(?:
|
(?: # expect ,c=a.get(b) (etc)
|
||||||
\.\s*[\w$]+ |
|
String\s*\.\s*fromCharCode\s*\(\s*110\s*\)|
|
||||||
\[\s*[\w$]+\s*\] |
|
"n+"\[\s*\+?s*[\w$.]+\s*]
|
||||||
\.\s*get\s*\(\s*[\w$"]+\s*\)
|
)\s*(?:,[\w$()\s]+(?=,))*|
|
||||||
)\s*){,2}(?:\s*\|\|\s*null(?=\s*\)))?\s*
|
(?P<old>[\w$]+) # a (old[er])
|
||||||
\)\s*&&\s*\( # ...)&&(
|
)\s*
|
||||||
# b = nfunc, b = narray[idx]
|
(?(old)
|
||||||
(?P=b)\s*=\s*(?P<nfunc>[\w$]+)\s*
|
# b.get("n")
|
||||||
(?:\[\s*(?P<idx>[\w$]+)\s*\]\s*)?
|
(?:\.\s*[\w$]+\s*|\[\s*[\w$]+\s*]\s*)*?
|
||||||
# (...)
|
(?:\.\s*n|\[\s*"n"\s*]|\.\s*get\s*\(\s*"n"\s*\))
|
||||||
\(\s*[\w$]+\s*\)
|
| # ,c=a.get(b)
|
||||||
|
,\s*(?P<c>[a-zA-Z])\s*=\s*[a-zA-Z]\s*
|
||||||
|
(?:\.\s*[\w$]+\s*|\[\s*[\w$]+\s*]\s*)*?
|
||||||
|
(?:\[\s*(?P=b)\s*]|\.\s*get\s*\(\s*(?P=b)\s*\))
|
||||||
|
)
|
||||||
|
# interstitial junk
|
||||||
|
\s*(?:\|\|\s*null\s*)?(?:\)\s*)?&&\s*(?:\(\s*)?
|
||||||
|
(?(c)(?P=c)|(?P=b))\s*=\s* # [c|b]=
|
||||||
|
# nfunc|nfunc[idx]
|
||||||
|
(?P<nfunc>[a-zA-Z_$][\w$]*)(?:\s*\[(?P<idx>\d+)\])?\s*\(\s*[\w$]+\s*\)
|
||||||
''', jscode, 'Initial JS player n function name', group=('nfunc', 'idx'),
|
''', jscode, 'Initial JS player n function name', group=('nfunc', 'idx'),
|
||||||
default=(None, None))
|
default=(None, None))
|
||||||
# thx bashonly: yt-dlp/yt-dlp/pull/10611
|
# thx bashonly: yt-dlp/yt-dlp/pull/10611
|
||||||
|
Loading…
Reference in New Issue
Block a user