From 6134fbeb65dc0e574c0ae02924e2aac6b5b45752 Mon Sep 17 00:00:00 2001 From: MinePlayersPE Date: Sat, 1 Jan 2022 03:10:46 +0700 Subject: [PATCH] [TikTok] Pass cookies to formats (#2171) Closes #2166 Authored by: MinePlayersPE --- yt_dlp/extractor/tiktok.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yt_dlp/extractor/tiktok.py b/yt_dlp/extractor/tiktok.py index ac537643a..c44fd49b0 100644 --- a/yt_dlp/extractor/tiktok.py +++ b/yt_dlp/extractor/tiktok.py @@ -161,6 +161,10 @@ class TikTokBaseIE(InfoExtractor): })) self._remove_duplicate_formats(formats) + auth_cookie = self._get_cookies(self._WEBPAGE_HOST).get('sid_tt') + if auth_cookie: + for f in formats: + self._set_cookie(f['url'], 'sid_tt', auth_cookie.value) self._sort_formats(formats, ('quality', 'codec', 'size', 'br')) thumbnails = []