From 4ae18a5a9318a302b2cde0c19a8126f6b35814be Mon Sep 17 00:00:00 2001 From: Jamil Karami Date: Fri, 17 Feb 2023 16:56:39 +0100 Subject: [PATCH] Add kick.com support --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/kick.py | 42 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 youtube_dl/extractor/kick.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 3a87f9e33..4aaeddaca 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -554,6 +554,7 @@ from .khanacademy import ( KhanAcademyIE, KhanAcademyUnitIE, ) +from .kick import KickIE from .kickstarter import KickStarterIE from .kinja import KinjaEmbedIE from .kinopoisk import KinoPoiskIE diff --git a/youtube_dl/extractor/kick.py b/youtube_dl/extractor/kick.py new file mode 100644 index 000000000..558790589 --- /dev/null +++ b/youtube_dl/extractor/kick.py @@ -0,0 +1,42 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class KickIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?kick\.com/video/(?P[0-9a-zA-Z-]+)' + _TEST = { + 'url': 'https://kick.com/video/82a3c11d-7a17-4747-aecb-2e61413eb11f', + 'md5': 'f052bc1046cd9ca6751925dd12420010', + 'info_dict': { + 'id': '82a3c11d-7a17-4747-aecb-2e61413eb11f', + 'ext': 'm3u8', + 'title': 'Weekly Stake Stream', + 'uploader': 'Eddie', + 'thumbnail': r're:^https?://.*\.jpg.*$', + } + } + + def _real_extract(self, url): + id = self._match_id(url) + + headers = { + 'Accept': 'application/json', + 'User-Agent': 'Mozilla', + } + + data = self._download_json('https://kick.com/api/v1/video/%s' % id, id, headers=headers) + + video_url = data['source'] + title = data['livestream']['session_title'] + uploader = data['livestream']['channel']['user']['username'] + thumbnail = data['livestream']['thumbnail'] + + return { + 'url': video_url, + 'id': id, + 'title': title, + 'uploader': uploader, + 'thumbnail': thumbnail, + } \ No newline at end of file