aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcoletdjnz <colethedj@protonmail.com>2021-07-17 18:20:05 +1200
committerGitHub <noreply@github.com>2021-07-17 11:50:05 +0530
commit34917076ad9844eddfa4ea97656d81a7fefe5d59 (patch)
tree36ca7741e9538ae228a9a35120da57aa0e869bb7
parentccc7795ca3523be07c69afb95f08b2f583197327 (diff)
downloadhypervideo-pre-34917076ad9844eddfa4ea97656d81a7fefe5d59.tar.lz
hypervideo-pre-34917076ad9844eddfa4ea97656d81a7fefe5d59.tar.xz
hypervideo-pre-34917076ad9844eddfa4ea97656d81a7fefe5d59.zip
[youtube] Fix authentication when using multiple accounts
`SESSION_INDEX` in `ytcfg` is the index of the active account and should be sent as `X-Goog-AuthUser` header Closes #518 Authored by @colethedj
-rw-r--r--yt_dlp/extractor/youtube.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index d0056203f..e7ac41cb1 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_token
if 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 0
if visitor_data:
headers['X-Goog-Visitor-Id'] = visitor_data
auth = self._generate_sapisidhash_header(origin)