From 8ded20e1254ab80f335f293d9426d2feeca8cdc4 Mon Sep 17 00:00:00 2001 From: einarhb Date: Wed, 8 Apr 2015 06:38:34 +0200 Subject: [PATCH] fix partially missing subtitles --- youtube_dl/extractor/nrk.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/nrk.py b/youtube_dl/extractor/nrk.py index e91d3a248..a345388ca 100644 --- a/youtube_dl/extractor/nrk.py +++ b/youtube_dl/extractor/nrk.py @@ -210,7 +210,14 @@ class NRKTVIE(InfoExtractor): duration = parse_duration(p.get('dur')) starttime = self._subtitles_timecode(begin) endtime = self._subtitles_timecode(begin + duration) - srt += '%s\r\n%s --> %s\r\n%s\r\n\r\n' % (compat_str(pos), starttime, endtime, p.text) + + subs = [] + subs.append(unicode(p.text).strip()) + for child in p: + subs.append(unicode(child.text).strip()) + subs.append(unicode(child.tail).strip()) + + srt += '%s\r\n%s --> %s\r\n%s\r\n\r\n' % (compat_str(pos), starttime, endtime, '\n'.join(filter(None, subs))) return {lang: [ {'ext': 'ttml', 'url': url}, {'ext': 'srt', 'data': srt},