From c571b3a6ab981d7287c2d3575b50b8f63dd830d8 Mon Sep 17 00:00:00 2001 From: MinePlayersPE <20515340+MinePlayersPE@users.noreply.github.com> Date: Fri, 18 Feb 2022 15:12:20 +0700 Subject: [PATCH] [youtube] Fix n-sig extraction for phone player JS (#2816) Authored by: MinePlayersPE --- test/test_youtube_signature.py | 4 ++++ yt_dlp/extractor/youtube.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/test_youtube_signature.py b/test/test_youtube_signature.py index cb07d3e23..bbbba073f 100644 --- a/test/test_youtube_signature.py +++ b/test/test_youtube_signature.py @@ -90,6 +90,10 @@ 'https://www.youtube.com/s/player/e06dea74/player_ias.vflset/en_US/base.js', 'AiuodmaDDYw8d3y4bf', 'ankd8eza2T6Qmw', ), + ( + 'https://www.youtube.com/s/player/5dd88d1d/player-plasma-ias-phone-en_US.vflset/base.js', + 'kSxKFLeqzv_ZyHSAt', 'n8gS8oRlHOxPFA', + ), ] diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index d5f9b6962..45eb9ec57 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -2413,7 +2413,7 @@ def _decrypt_nsig(self, s, video_id, player_url): def _extract_n_function_name(self, jscode): nfunc, idx = self._search_regex( - r'\.get\("n"\)\)&&\(b=(?P[a-zA-Z0-9$]{3})(?:\[(?P\d+)\])?\([a-zA-Z0-9]\)', + r'\.get\("n"\)\)&&\(b=(?P[a-zA-Z0-9$]+)(?:\[(?P\d+)\])?\([a-zA-Z0-9]\)', jscode, 'Initial JS player n function name', group=('nfunc', 'idx')) if not idx: return nfunc