]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/srmediathek.py
[ie/matchtv] Fix extractor (#10190)
[yt-dlp.git] / yt_dlp / extractor / srmediathek.py
CommitLineData
c968f738 1from .ard import ARDMediathekBaseIE
1fc0b47f 2from ..utils import (
3 ExtractorError,
4 get_element_by_attribute,
5)
2bcae58d 6
2bcae58d 7
c968f738 8class SRMediathekIE(ARDMediathekBaseIE):
9751a457 9 _WORKING = False
81fda153 10 IE_NAME = 'sr:mediathek'
d2054761 11 IE_DESC = 'Saarländischer Rundfunk'
8cc9b401 12 _VALID_URL = r'https?://sr-mediathek(?:\.sr-online)?\.de/index\.php\?.*?&id=(?P<id>[0-9]+)'
2bcae58d 13
1fc0b47f 14 _TESTS = [{
2bcae58d
PH
15 'url': 'http://sr-mediathek.sr-online.de/index.php?seite=7&id=28455',
16 'info_dict': {
17 'id': '28455',
18 'ext': 'mp4',
19 'title': 'sportarena (26.10.2014)',
20 'description': 'Ringen: KSV Köllerbach gegen Aachen-Walheim; Frauen-Fußball: 1. FC Saarbrücken gegen Sindelfingen; Motorsport: Rallye in Losheim; dazu: Interview mit Timo Bernhard; Turnen: TG Saar; Reitsport: Deutscher Voltigier-Pokal; Badminton: Interview mit Michael Fuchs ',
ec85ded8 21 'thumbnail': r're:^https?://.*\.jpg$',
2bcae58d 22 },
1fc0b47f 23 'skip': 'no longer available',
24 }, {
25 'url': 'http://sr-mediathek.sr-online.de/index.php?seite=7&id=37682',
26 'info_dict': {
27 'id': '37682',
28 'ext': 'mp4',
29 'title': 'Love, Cakes and Rock\'n\'Roll',
30 'description': 'md5:18bf9763631c7d326c22603681e1123d',
31 },
32 'params': {
33 # m3u8 download
34 'skip_download': True,
35 },
8cc9b401
RA
36 }, {
37 'url': 'http://sr-mediathek.de/index.php?seite=7&id=7480',
38 'only_matching': True,
1fc0b47f 39 }]
2bcae58d
PH
40
41 def _real_extract(self, url):
42 video_id = self._match_id(url)
43 webpage = self._download_webpage(url, video_id)
44
1fc0b47f 45 if '>Der gew&uuml;nschte Beitrag ist leider nicht mehr verf&uuml;gbar.<' in webpage:
add96eb9 46 raise ExtractorError(f'Video {video_id} is no longer available', expected=True)
2bcae58d 47
1fc0b47f 48 media_collection_url = self._search_regex(
49 r'data-mediacollection-ardplayer="([^"]+)"', webpage, 'media collection url')
50 info = self._extract_media_info(media_collection_url, webpage, video_id)
51 info.update({
2bcae58d 52 'id': video_id,
1fc0b47f 53 'title': get_element_by_attribute('class', 'ardplayer-title', webpage),
2bcae58d
PH
54 'description': self._og_search_description(webpage),
55 'thumbnail': self._og_search_thumbnail(webpage),
1fc0b47f 56 })
57 return info