1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-06-27 17:08:32 +00:00

[ie/kick] Extract sub-only downloads

`XSRF-TOKEN` cookie was no longer being passed so downloads would 403. Found that `session_token` now contained the expected value.
This commit is contained in:
helpimnotdrowning 2025-06-26 15:29:20 -05:00
parent 06c1a8cdff
commit 876b5f7672
No known key found for this signature in database

View File

@ -1,4 +1,6 @@
from urllib import parse
from .common import InfoExtractor from .common import InfoExtractor
from ..networking import HEADRequest from ..networking import HEADRequest
from ..utils import ( from ..utils import (
@ -19,13 +21,12 @@ class KickBaseIE(InfoExtractor):
def _real_initialize(self): def _real_initialize(self):
self._request_webpage( self._request_webpage(
HEADRequest('https://kick.com/'), None, 'Setting up session', fatal=False, impersonate=True) HEADRequest('https://kick.com/'), None, 'Setting up session', fatal=False, impersonate=True)
xsrf_token = self._get_cookies('https://kick.com/').get('XSRF-TOKEN') session_token = self._get_cookies('https://kick.com/').get('session_token')
if not xsrf_token: if not session_token:
self.write_debug('kick.com did not set XSRF-TOKEN cookie') self.write_debug('kick.com did not set session_token cookie')
KickBaseIE._API_HEADERS = { KickBaseIE._API_HEADERS = {
'Authorization': f'Bearer {xsrf_token.value}', 'Authorization': f'Bearer {parse.unquote(session_token.value)}',
'X-XSRF-TOKEN': xsrf_token.value, } if session_token else {}
} if xsrf_token else {}
def _call_api(self, path, display_id, note='Downloading API JSON', headers={}, **kwargs): def _call_api(self, path, display_id, note='Downloading API JSON', headers={}, **kwargs):
return self._download_json( return self._download_json(