]>
Commit | Line | Data |
---|---|---|
2bcae58d PH |
1 | # encoding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
1fc0b47f | 4 | from .ard import ARDMediathekIE |
5 | from ..utils import ( | |
6 | ExtractorError, | |
7 | get_element_by_attribute, | |
8 | ) | |
2bcae58d | 9 | |
2bcae58d | 10 | |
1fc0b47f | 11 | class SRMediathekIE(ARDMediathekIE): |
81fda153 | 12 | IE_NAME = 'sr:mediathek' |
d2054761 | 13 | IE_DESC = 'Saarländischer Rundfunk' |
2bcae58d PH |
14 | _VALID_URL = r'https?://sr-mediathek\.sr-online\.de/index\.php\?.*?&id=(?P<id>[0-9]+)' |
15 | ||
1fc0b47f | 16 | _TESTS = [{ |
2bcae58d PH |
17 | 'url': 'http://sr-mediathek.sr-online.de/index.php?seite=7&id=28455', |
18 | 'info_dict': { | |
19 | 'id': '28455', | |
20 | 'ext': 'mp4', | |
21 | 'title': 'sportarena (26.10.2014)', | |
22 | '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 ', | |
23 | 'thumbnail': 're:^https?://.*\.jpg$', | |
24 | }, | |
1fc0b47f | 25 | 'skip': 'no longer available', |
26 | }, { | |
27 | 'url': 'http://sr-mediathek.sr-online.de/index.php?seite=7&id=37682', | |
28 | 'info_dict': { | |
29 | 'id': '37682', | |
30 | 'ext': 'mp4', | |
31 | 'title': 'Love, Cakes and Rock\'n\'Roll', | |
32 | 'description': 'md5:18bf9763631c7d326c22603681e1123d', | |
33 | }, | |
34 | 'params': { | |
35 | # m3u8 download | |
36 | 'skip_download': True, | |
37 | }, | |
38 | 'expected_warnings': ['Unable to download f4m manifest'] | |
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ünschte Beitrag ist leider nicht mehr verfügbar.<' in webpage: |
46 | raise ExtractorError('Video %s is no longer available' % video_id, 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 |