[drtv] Improve extraction (Closes #5792)

This commit is contained in:
Sergey M? 2015-05-24 01:21:18 +06:00 committed by Sergey M․
parent 30455ce255
commit 1335c3aca8
1 changed files with 26 additions and 11 deletions

View File

@ -1,8 +1,11 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor, ExtractorError from .common import InfoExtractor
from ..utils import parse_iso8601 from ..utils import (
ExtractorError,
parse_iso8601,
)
class DRTVIE(InfoExtractor): class DRTVIE(InfoExtractor):
@ -60,19 +63,31 @@ class DRTVIE(InfoExtractor):
restricted_to_denmark = asset['RestrictedToDenmark'] restricted_to_denmark = asset['RestrictedToDenmark']
spoken_subtitles = asset['Target'] == 'SpokenSubtitles' spoken_subtitles = asset['Target'] == 'SpokenSubtitles'
for link in asset['Links']: for link in asset['Links']:
target = link['Target']
uri = link['Uri'] uri = link['Uri']
target = link['Target']
format_id = target format_id = target
preference = -1 if target == 'HDS' else -2 preference = None
if spoken_subtitles: if spoken_subtitles:
preference -= 2 preference = -1
format_id += '-spoken-subtitles' format_id += '-spoken-subtitles'
formats.append({ if target == 'HDS':
'url': uri + '?hdcore=3.3.0&plugin=aasp-3.3.0.99.43' if target == 'HDS' else uri, formats.extend(self._extract_f4m_formats(
'format_id': format_id, uri + '?hdcore=3.3.0&plugin=aasp-3.3.0.99.43',
'ext': link['FileFormat'], video_id, preference, f4m_id=format_id))
'preference': preference, elif target == 'HLS':
}) formats.extend(self._extract_m3u8_formats(
uri, video_id, 'mp4', preference=preference,
m3u8_id=format_id))
else:
bitrate = link.get('Bitrate')
if bitrate:
format_id += '-%s' % bitrate
formats.append({
'url': uri,
'format_id': format_id,
'tbr': bitrate,
'ext': link.get('FileFormat'),
})
subtitles_list = asset.get('SubtitlesList') subtitles_list = asset.get('SubtitlesList')
if isinstance(subtitles_list, list): if isinstance(subtitles_list, list):
LANGS = { LANGS = {