]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/srmediathek.py
Merge pull request #8061 from dstftw/introduce-chapter-and-series-fields
[yt-dlp.git] / youtube_dl / extractor / srmediathek.py
CommitLineData
2bcae58d
PH
1# encoding: utf-8
2from __future__ import unicode_literals
3
1fc0b47f 4from .ard import ARDMediathekIE
5from ..utils import (
6 ExtractorError,
7 get_element_by_attribute,
8)
2bcae58d 9
2bcae58d 10
1fc0b47f 11class SRMediathekIE(ARDMediathekIE):
d2054761 12 IE_DESC = 'Saarländischer Rundfunk'
2bcae58d
PH
13 _VALID_URL = r'https?://sr-mediathek\.sr-online\.de/index\.php\?.*?&id=(?P<id>[0-9]+)'
14
1fc0b47f 15 _TESTS = [{
2bcae58d
PH
16 'url': 'http://sr-mediathek.sr-online.de/index.php?seite=7&id=28455',
17 'info_dict': {
18 'id': '28455',
19 'ext': 'mp4',
20 'title': 'sportarena (26.10.2014)',
21 '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 ',
22 'thumbnail': 're:^https?://.*\.jpg$',
23 },
1fc0b47f 24 'skip': 'no longer available',
25 }, {
26 'url': 'http://sr-mediathek.sr-online.de/index.php?seite=7&id=37682',
27 'info_dict': {
28 'id': '37682',
29 'ext': 'mp4',
30 'title': 'Love, Cakes and Rock\'n\'Roll',
31 'description': 'md5:18bf9763631c7d326c22603681e1123d',
32 },
33 'params': {
34 # m3u8 download
35 'skip_download': True,
36 },
37 'expected_warnings': ['Unable to download f4m manifest']
38 }]
2bcae58d
PH
39
40 def _real_extract(self, url):
41 video_id = self._match_id(url)
42 webpage = self._download_webpage(url, video_id)
43
1fc0b47f 44 if '>Der gew&uuml;nschte Beitrag ist leider nicht mehr verf&uuml;gbar.<' in webpage:
45 raise ExtractorError('Video %s is no longer available' % video_id, expected=True)
2bcae58d 46
1fc0b47f 47 media_collection_url = self._search_regex(
48 r'data-mediacollection-ardplayer="([^"]+)"', webpage, 'media collection url')
49 info = self._extract_media_info(media_collection_url, webpage, video_id)
50 info.update({
2bcae58d 51 'id': video_id,
1fc0b47f 52 'title': get_element_by_attribute('class', 'ardplayer-title', webpage),
2bcae58d
PH
53 'description': self._og_search_description(webpage),
54 'thumbnail': self._og_search_thumbnail(webpage),
1fc0b47f 55 })
56 return info