]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/vimm.py
[ie/orf:on] Improve extraction (#9677)
[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)
e8736539
AK
26
27 return {
28 'id': channel_id,
29 'title': channel_id,
30 'is_live': True,
31 'formats': formats,
32 'subtitles': subs,
33 }
8f028b5f
AK
34
35
36class VimmRecordingIE(InfoExtractor):
37 IE_NAME = 'Vimm:recording'
38 _VALID_URL = r'https?://(?:www\.)?vimm\.tv/c/(?P<channel_id>[0-9a-z-]+)\?v=(?P<video_id>[0-9A-Za-z]+)'
39 _TESTS = [{
40 'url': 'https://www.vimm.tv/c/kaldewei?v=2JZsrPTFxsSz',
41 'md5': '15122ee95baa32a548e4a3e120b598f1',
42 'info_dict': {
43 'id': '2JZsrPTFxsSz',
44 'ext': 'mp4',
45 'title': 'VIMM - [DE/GER] Kaldewei Live - In Farbe und Bunt',
46 'uploader_id': 'kaldewei',
47 },
48 }]
49
50 def _real_extract(self, url):
51 channel_id, video_id = self._match_valid_url(url).groups()
52
53 webpage = self._download_webpage(url, video_id)
54 title = self._og_search_title(webpage)
55
56 formats, subs = self._extract_m3u8_formats_and_subtitles(
57 f'https://d211qfrkztakg3.cloudfront.net/{channel_id}/{video_id}/index.m3u8', video_id, 'mp4', m3u8_id='hls', live=False)
8f028b5f
AK
58
59 return {
60 'id': video_id,
61 'title': title,
62 'is_live': False,
63 'uploader_id': channel_id,
64 'formats': formats,
65 'subtitles': subs,
66 }