A feature-rich command-line audio/video downloader
[youtube] Fix authentication when using multiple accounts
coletdjnz34917076ad98
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.pyindex d0056203f1..e7ac41cb12 100644--- a/yt_dlp/extractor/youtube.py+++ b/yt_dlp/extractor/youtube.py@@ -533,7 +533,9 @@ class YoutubeBaseInfoExtractor(InfoExtractor):headers['X-Youtube-Identity-Token'] = identity_tokenif account_syncid:headers['X-Goog-PageId'] = account_syncid- headers['X-Goog-AuthUser'] = 0+ session_index = try_get(ytcfg, lambda x: x['SESSION_INDEX'], compat_str)+ if account_syncid or session_index:+ headers['X-Goog-AuthUser'] = session_index or 0if visitor_data:headers['X-Goog-Visitor-Id'] = visitor_dataauth = self._generate_sapisidhash_header(origin)