]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/drbonanza.py
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
_html
5_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'),