From 86d709410ad5c0c21c2b8bb9295d9ad89463302f 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 (#27643) Closes #27643 --- youtube_dl/extractor/twitter.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/youtube_dl/extractor/twitter.py b/youtube_dl/extractor/twitter.py index cfa7a7326..b4ec7d7fb 100644 --- a/youtube_dl/extractor/twitter.py +++ b/youtube_dl/extractor/twitter.py @@ -83,6 +83,9 @@ class TwitterBaseIE(InfoExtractor): 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,