aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrans de Jonge <fransdejonge@gmail.com>2015-02-05 12:51:33 +0100
committerFrans de Jonge <fransdejonge@gmail.com>2015-02-05 12:51:33 +0100
commit25e5ebf382b2fca9d4b6909ac1ac9b5af89bcdd9 (patch)
treecae6cda1ba8a16ad83567c2ebcbe2f1fac0c569e
parent7dfc3566250894147910bd6b79530f97770a47f3 (diff)
Add NPO.nl subtitles
Implements #3638
-rw-r--r--youtube_dl/extractor/npo.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/youtube_dl/extractor/npo.py b/youtube_dl/extractor/npo.py
index 175b14583..0580461bb 100644
--- a/youtube_dl/extractor/npo.py
+++ b/youtube_dl/extractor/npo.py
@@ -1,6 +1,6 @@
from __future__ import unicode_literals
-from .common import InfoExtractor
+from .subtitles import SubtitlesInfoExtractor
from ..utils import (
fix_xml_ampersands,
parse_duration,
@@ -11,7 +11,7 @@ from ..utils import (
)
-class NPOBaseIE(InfoExtractor):
+class NPOBaseIE(SubtitlesInfoExtractor):
def _get_token(self, video_id):
token_page = self._download_webpage(
'http://ida.omroep.nl/npoplayer/i.js',
@@ -159,6 +159,13 @@ class NPOIE(NPOBaseIE):
'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)
return {
@@ -169,6 +176,7 @@ class NPOIE(NPOBaseIE):
'upload_date': unified_strdate(metadata.get('gidsdatum')),
'duration': parse_duration(metadata.get('tijdsduur')),
'formats': formats,
+ 'subtitles': subtitles,
}