]>
Commit | Line | Data |
---|---|---|
72e995f1 F |
1 | from .common import InfoExtractor |
2 | ||
3 | ||
4 | class VideocampusSachsenIE(InfoExtractor): | |
5 | _VALID_URL = r'''(?x)https?://videocampus\.sachsen\.de/(?: | |
6 | m/(?P<tmp_id>[0-9a-f]+)| | |
7 | (?:category/)?video/(?P<display_id>[\w-]+)/(?P<id>[0-9a-f]{32}) | |
8 | )''' | |
9 | ||
10 | _TESTS = [ | |
11 | { | |
12 | 'url': 'https://videocampus.sachsen.de/m/e0d6c8ce6e394c188f1342f1ab7c50ed6fc4490b808699801def5cb2e46d76ca7367f622a9f516c542ffb805b24d6b643bd7c81f385acaac4c59081b87a2767b', | |
13 | 'info_dict': { | |
14 | 'id': 'e6b9349905c1628631f175712250f2a1', | |
15 | 'title': 'Konstruktiver Entwicklungsprozess Vorlesung 7', | |
16 | 'ext': 'mp4', | |
17 | }, | |
18 | }, | |
19 | { | |
20 | 'url': 'https://videocampus.sachsen.de/video/Was-ist-selbstgesteuertes-Lernen/fc99c527e4205b121cb7c74433469262', | |
21 | 'info_dict': { | |
22 | 'id': 'fc99c527e4205b121cb7c74433469262', | |
23 | 'title': 'Was ist selbstgesteuertes Lernen?', | |
24 | 'display_id': 'Was-ist-selbstgesteuertes-Lernen', | |
25 | 'ext': 'mp4', | |
26 | }, | |
27 | }, | |
28 | { | |
29 | 'url': 'https://videocampus.sachsen.de/category/video/Tutorial-zur-Nutzung-von-Adobe-Connect-aus-Veranstalter-Sicht/09d4ed029002eb1bdda610f1103dd54c/100', | |
30 | 'info_dict': { | |
31 | 'id': '09d4ed029002eb1bdda610f1103dd54c', | |
32 | 'title': 'Tutorial zur Nutzung von Adobe Connect aus Veranstalter-Sicht', | |
33 | 'display_id': 'Tutorial-zur-Nutzung-von-Adobe-Connect-aus-Veranstalter-Sicht', | |
34 | 'ext': 'mp4', | |
35 | }, | |
36 | }, | |
37 | ] | |
38 | ||
39 | def _real_extract(self, url): | |
40 | video_id, tmp_id, display_id = self._match_valid_url(url).group('id', 'tmp_id', 'display_id') | |
41 | webpage = self._download_webpage(url, video_id or tmp_id, fatal=False) or '' | |
42 | ||
43 | if not tmp_id: | |
44 | video_id = self._html_search_regex( | |
45 | r'src="https?://videocampus\.sachsen\.de/media/embed\?key=([0-9a-f]+)&', | |
46 | webpage, 'video_id') | |
47 | ||
48 | title = self._html_search_regex( | |
49 | (r'<h1>(?P<content>[^<]+)</h1>', *self._meta_regex('title')), | |
50 | webpage, 'title', group='content', fatal=False) | |
51 | ||
52 | formats, subtitles = self._extract_m3u8_formats_and_subtitles( | |
53 | f'https://videocampus.sachsen.de/media/hlsMedium/key/{video_id}/format/auto/ext/mp4/learning/0/path/m3u8', | |
54 | video_id, 'mp4', 'm3u8_native', m3u8_id='hls') | |
55 | self._sort_formats(formats) | |
56 | ||
57 | return { | |
58 | 'id': video_id, | |
59 | 'title': title, | |
60 | 'display_id': display_id, | |
61 | 'formats': formats, | |
62 | 'subtitles': subtitles | |
63 | } | |
64 | ||
65 | ||
66 | class VideocampusSachsenEmbedIE(InfoExtractor): | |
67 | _VALID_URL = r'https?://videocampus.sachsen.de/media/embed\?key=(?P<id>[0-9a-f]+)' | |
68 | ||
69 | _TESTS = [ | |
70 | { | |
71 | 'url': 'https://videocampus.sachsen.de/media/embed?key=fc99c527e4205b121cb7c74433469262', | |
72 | 'info_dict': { | |
73 | 'id': 'fc99c527e4205b121cb7c74433469262', | |
74 | 'title': 'Was ist selbstgesteuertes Lernen?', | |
75 | 'ext': 'mp4', | |
76 | }, | |
77 | } | |
78 | ] | |
79 | ||
80 | def _real_extract(self, url): | |
81 | video_id = self._match_id(url) | |
82 | ||
83 | webpage = self._download_webpage(url, video_id) | |
84 | title = self._html_search_regex(r'<img[^>]*title="([^"<]+)"', webpage, 'title', fatal=False) | |
85 | formats, subtitles = self._extract_m3u8_formats_and_subtitles( | |
86 | f'https://videocampus.sachsen.de/media/hlsMedium/key/{video_id}/format/auto/ext/mp4/learning/0/path/m3u8', | |
87 | video_id, 'mp4', 'm3u8_native', m3u8_id='hls') | |
88 | self._sort_formats(formats) | |
89 | ||
90 | return { | |
91 | 'id': video_id, | |
92 | 'title': title, | |
93 | 'formats': formats, | |
94 | 'subtitles': subtitles, | |
95 | } |