1 from __future__ import unicode_literals
5 from .common import InfoExtractor
13 class DRBonanzaIE(InfoExtractor):
14 _VALID_URL = r'https?://(?:www\.)?dr\.dk/bonanza/[^/]+/\d+/[^/]+/(?P<id>\d+)/(?P<display_id>[^/?#&]+)'
16 'url': 'http://www.dr.dk/bonanza/serie/154/matador/40312/matador---0824-komme-fremmede-',
19 'display_id': 'matador---0824-komme-fremmede-',
21 'title': 'MATADOR - 08:24. "Komme fremmede".',
22 'description': 'md5:77b4c1ac4d4c1b9d610ab4395212ff84',
23 'thumbnail': r're:^https?://.*\.(?:gif|jpg)$',
28 def _real_extract(self, url):
29 mobj = re.match(self._VALID_URL, url)
30 video_id, display_id = mobj.group('id', 'display_id')
32 webpage = self._download_webpage(url, display_id)
34 info = self._parse_html5_media_entries(
35 url, webpage, display_id, m3u8_id='hls',
36 m3u8_entry_protocol='m3u8_native')[0]
37 self._sort_formats(info['formats'])
39 asset = self._parse_json(
41 r'(?s)currentAsset\s*=\s*({.+?})\s*</script', webpage, 'asset'),
42 display_id, transform_source=js_to_json)
44 title = unescapeHTML(asset['AssetTitle']).strip()
47 return self._search_regex(
48 r'<div[^>]+>\s*<p>%s:<p>\s*</div>\s*<div[^>]+>\s*<p>([^<]+)</p>' % field,
49 webpage, field, default=None)
52 'id': asset.get('AssetId') or video_id,
53 'display_id': display_id,
55 'description': extract('Programinfo'),
56 'duration': parse_duration(extract('Tid')),
57 'thumbnail': asset.get('AssetImageUrl'),