From 2d41e2ecebb62b572d8bb5b2e4e51ba12f3f0510 Mon Sep 17 00:00:00 2001 From: Ronald Ip Date: Tue, 15 Feb 2022 00:37:21 +0800 Subject: [PATCH] [twitter] Fix for private videos (#2772) Closes #2762, https://github.com/ytdl-org/youtube-dl/issues/27643 Authored by: iphoting --- yt_dlp/extractor/twitter.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yt_dlp/extractor/twitter.py b/yt_dlp/extractor/twitter.py index 8565a7c46..8ccc38e24 100644 --- a/yt_dlp/extractor/twitter.py +++ b/yt_dlp/extractor/twitter.py @@ -90,6 +90,9 @@ def _call_api(self, path, video_id, query={}): headers = { 'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAAPYXBAAAAAAACLXUNDekMxqa8h%2F40K4moUkGsoc%3DTYfbDKbT3jJPCEVnMYqilB28NHfOPqkca3qaAxGfsyKCs0wRbw', } + token = self._get_cookies(self._API_BASE).get('ct0') + if token: + headers['x-csrf-token'] = token.value if not self._GUEST_TOKEN: self._GUEST_TOKEN = self._download_json( self._API_BASE + 'guest/activate.json', video_id,