summaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/cozytv.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:49:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:49:24 +0000
commit2415e66f889f38503b73e8ebc5f43ca342390e5c (patch)
treeac48ab69d1d96bae3d83756134921e0d90593aa5 /yt_dlp/extractor/cozytv.py
parentInitial commit. (diff)
downloadyt-dlp-2415e66f889f38503b73e8ebc5f43ca342390e5c.tar.xz
yt-dlp-2415e66f889f38503b73e8ebc5f43ca342390e5c.zip
Adding upstream version 2024.03.10.upstream/2024.03.10
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'yt_dlp/extractor/cozytv.py')
-rw-r--r--yt_dlp/extractor/cozytv.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/yt_dlp/extractor/cozytv.py b/yt_dlp/extractor/cozytv.py
new file mode 100644
index 0000000..5ef5afc
--- /dev/null
+++ b/yt_dlp/extractor/cozytv.py
@@ -0,0 +1,37 @@
+from .common import InfoExtractor
+from ..utils import unified_strdate
+
+
+class CozyTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?cozy\.tv/(?P<uploader>[^/]+)/replays/(?P<id>[^/$#&?]+)'
+
+ _TESTS = [{
+ 'url': 'https://cozy.tv/beardson/replays/2021-11-19_1',
+ 'info_dict': {
+ 'id': 'beardson-2021-11-19_1',
+ 'ext': 'mp4',
+ 'title': 'pokemon pt2',
+ 'uploader': 'beardson',
+ 'upload_date': '20211119',
+ 'was_live': True,
+ 'duration': 7981,
+ },
+ 'params': {'skip_download': True}
+ }]
+
+ def _real_extract(self, url):
+ uploader, date = self._match_valid_url(url).groups()
+ id = f'{uploader}-{date}'
+ data_json = self._download_json(f'https://api.cozy.tv/cache/{uploader}/replay/{date}', id)
+ formats, subtitles = self._extract_m3u8_formats_and_subtitles(
+ f'https://cozycdn.foxtrotstream.xyz/replays/{uploader}/{date}/index.m3u8', id, ext='mp4')
+ return {
+ 'id': id,
+ 'title': data_json.get('title'),
+ 'uploader': data_json.get('user') or uploader,
+ 'upload_date': unified_strdate(data_json.get('date')),
+ 'was_live': True,
+ 'duration': data_json.get('duration'),
+ 'formats': formats,
+ 'subtitles': subtitles,
+ }