1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-12-01 10:47:26 +01:00

Add NPO.nl subtitles

Implements #3638
This commit is contained in:
Frans de Jonge 2015-02-05 12:51:33 +01:00
parent 7dfc356625
commit 25e5ebf382

View File

@ -1,6 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .subtitles import SubtitlesInfoExtractor
from ..utils import ( from ..utils import (
fix_xml_ampersands, fix_xml_ampersands,
parse_duration, parse_duration,
@ -11,7 +11,7 @@ from ..utils import (
) )
class NPOBaseIE(InfoExtractor): class NPOBaseIE(SubtitlesInfoExtractor):
def _get_token(self, video_id): def _get_token(self, video_id):
token_page = self._download_webpage( token_page = self._download_webpage(
'http://ida.omroep.nl/npoplayer/i.js', 'http://ida.omroep.nl/npoplayer/i.js',
@ -159,6 +159,13 @@ class NPOIE(NPOBaseIE):
'quality': stream.get('kwaliteit'), 'quality': stream.get('kwaliteit'),
}) })
subtitles = {}
tt888 = metadata.get('tt888')
if self._have_to_download_any_subtitles and tt888 == 'ja':
subtitles['nl'] = 'http://e.omroep.nl/tt888/%s' % video_id
subtitles = self.extract_subtitles(video_id, subtitles)
self._sort_formats(formats) self._sort_formats(formats)
return { return {
@ -169,6 +176,7 @@ class NPOIE(NPOBaseIE):
'upload_date': unified_strdate(metadata.get('gidsdatum')), 'upload_date': unified_strdate(metadata.get('gidsdatum')),
'duration': parse_duration(metadata.get('tijdsduur')), 'duration': parse_duration(metadata.get('tijdsduur')),
'formats': formats, 'formats': formats,
'subtitles': subtitles,
} }