]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/vimm.py
[cleanup, docs] Misc cleanup
[yt-dlp.git] / yt_dlp / extractor / vimm.py
1 # coding: utf-8
2 from .common import InfoExtractor
3
4
5 class VimmIE(InfoExtractor):
6 IE_NAME = 'Vimm:stream'
7 _VALID_URL = r'https?://(?:www\.)?vimm\.tv/(?:c/)?(?P<id>[0-9a-z-]+)$'
8 _TESTS = [{
9 'url': 'https://www.vimm.tv/c/calimeatwagon',
10 'info_dict': {
11 'id': 'calimeatwagon',
12 'ext': 'mp4',
13 'title': 're:^calimeatwagon [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
14 'live_status': 'is_live',
15 },
16 'skip': 'Live',
17 }, {
18 'url': 'https://www.vimm.tv/octaafradio',
19 'only_matching': True,
20 }]
21
22 def _real_extract(self, url):
23 channel_id = self._match_id(url)
24
25 formats, subs = self._extract_m3u8_formats_and_subtitles(
26 f'https://www.vimm.tv/hls/{channel_id}.m3u8', channel_id, 'mp4', m3u8_id='hls', live=True)
27 self._sort_formats(formats)
28
29 return {
30 'id': channel_id,
31 'title': channel_id,
32 'is_live': True,
33 'formats': formats,
34 'subtitles': subs,
35 }
36
37
38 class VimmRecordingIE(InfoExtractor):
39 IE_NAME = 'Vimm:recording'
40 _VALID_URL = r'https?://(?:www\.)?vimm\.tv/c/(?P<channel_id>[0-9a-z-]+)\?v=(?P<video_id>[0-9A-Za-z]+)'
41 _TESTS = [{
42 'url': 'https://www.vimm.tv/c/kaldewei?v=2JZsrPTFxsSz',
43 'md5': '15122ee95baa32a548e4a3e120b598f1',
44 'info_dict': {
45 'id': '2JZsrPTFxsSz',
46 'ext': 'mp4',
47 'title': 'VIMM - [DE/GER] Kaldewei Live - In Farbe und Bunt',
48 'uploader_id': 'kaldewei',
49 },
50 }]
51
52 def _real_extract(self, url):
53 channel_id, video_id = self._match_valid_url(url).groups()
54
55 webpage = self._download_webpage(url, video_id)
56 title = self._og_search_title(webpage)
57
58 formats, subs = self._extract_m3u8_formats_and_subtitles(
59 f'https://d211qfrkztakg3.cloudfront.net/{channel_id}/{video_id}/index.m3u8', video_id, 'mp4', m3u8_id='hls', live=False)
60 self._sort_formats(formats)
61
62 return {
63 'id': video_id,
64 'title': title,
65 'is_live': False,
66 'uploader_id': channel_id,
67 'formats': formats,
68 'subtitles': subs,
69 }