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