]>
Commit | Line | Data |
---|---|---|
f4858a71 CK |
1 | import re |
2 | ||
3 | from .common import InfoExtractor | |
9d247bbd | 4 | from ..utils import parse_duration |
f4858a71 CK |
5 | |
6 | ||
7 | class RadioBremenIE(InfoExtractor): | |
9d247bbd | 8 | _VALID_URL = r'http?://(?:www\.)?radiobremen\.de/mediathek/(?:index\.html)?\?id=(?P<id>[0-9]+)' |
f4858a71 CK |
9 | IE_NAME = 'radiobremen' |
10 | ||
11 | _TEST = { | |
55af45fc | 12 | 'url': 'http://www.radiobremen.de/mediathek/?id=141876', |
f4858a71 | 13 | 'info_dict': { |
55af45fc | 14 | 'id': '141876', |
f4858a71 | 15 | 'ext': 'mp4', |
55af45fc | 16 | 'duration': 178, |
f4858a71 | 17 | 'width': 512, |
55af45fc | 18 | 'title': 'Druck auf Patrick Öztürk', |
ec85ded8 | 19 | 'thumbnail': r're:https?://.*\.jpg$', |
55af45fc | 20 | 'description': 'Gegen den SPD-Bürgerschaftsabgeordneten Patrick Öztürk wird wegen Beihilfe zum gewerbsmäßigen Betrug ermittelt. Am Donnerstagabend sollte er dem Vorstand des SPD-Unterbezirks Bremerhaven dazu Rede und Antwort stehen.', |
f4858a71 CK |
21 | }, |
22 | } | |
23 | ||
24 | def _real_extract(self, url): | |
9d247bbd | 25 | video_id = self._match_id(url) |
f4858a71 | 26 | |
611c1dd9 | 27 | meta_url = 'http://www.radiobremen.de/apps/php/mediathek/metadaten.php?id=%s' % video_id |
dda620e8 PH |
28 | meta_doc = self._download_webpage( |
29 | meta_url, video_id, 'Downloading metadata') | |
30 | title = self._html_search_regex( | |
611c1dd9 | 31 | r'<h1.*>(?P<title>.+)</h1>', meta_doc, 'title') |
dda620e8 | 32 | description = self._html_search_regex( |
611c1dd9 | 33 | r'<p>(?P<description>.*)</p>', meta_doc, 'description', fatal=False) |
dda620e8 | 34 | duration = parse_duration(self._html_search_regex( |
611c1dd9 S |
35 | r'Länge:</td>\s+<td>(?P<duration>[0-9]+:[0-9]+)</td>', |
36 | meta_doc, 'duration', fatal=False)) | |
dda620e8 PH |
37 | |
38 | page_doc = self._download_webpage( | |
39 | url, video_id, 'Downloading video information') | |
40 | mobj = re.search( | |
41 | r"ardformatplayerclassic\(\'playerbereich\',\'(?P<width>[0-9]+)\',\'.*\',\'(?P<video_id>[0-9]+)\',\'(?P<secret>[0-9]+)\',\'(?P<thumbnail>.+)\',\'\'\)", | |
42 | page_doc) | |
9d247bbd PH |
43 | video_url = ( |
44 | "http://dl-ondemand.radiobremen.de/mediabase/%s/%s_%s_%s.mp4" % | |
45 | (video_id, video_id, mobj.group("secret"), mobj.group('width'))) | |
f4858a71 | 46 | |
9d247bbd PH |
47 | formats = [{ |
48 | 'url': video_url, | |
49 | 'ext': 'mp4', | |
611c1dd9 | 50 | 'width': int(mobj.group('width')), |
9d247bbd | 51 | }] |
f4858a71 CK |
52 | return { |
53 | 'id': video_id, | |
54 | 'title': title, | |
55 | 'description': description, | |
56 | 'duration': duration, | |
9d247bbd PH |
57 | 'formats': formats, |
58 | 'thumbnail': mobj.group('thumbnail'), | |
f4858a71 | 59 | } |