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