aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/pluralsight.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-10-22 21:15:39 +0700
committerSergey M․ <dstftw@gmail.com>2016-10-22 21:15:39 +0700
commit425f3fdfcb4a559da836bbada82f2bb06d34b707 (patch)
treeb2e10b6b80d2b3e29309b2f03f89f66d0e8ed9dd /youtube_dl/extractor/pluralsight.py
parente034cbc581c79b14c6337adf51bf4a99f726302d (diff)
[pluralsight] Fix subtitles conversion (closes #10990)
Diffstat (limited to 'youtube_dl/extractor/pluralsight.py')
-rw-r--r--youtube_dl/extractor/pluralsight.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/youtube_dl/extractor/pluralsight.py b/youtube_dl/extractor/pluralsight.py
index 2683c0a72..0ffd41ecd 100644
--- a/youtube_dl/extractor/pluralsight.py
+++ b/youtube_dl/extractor/pluralsight.py
@@ -11,6 +11,7 @@ from ..compat import (
compat_urlparse,
)
from ..utils import (
+ dict_get,
ExtractorError,
float_or_none,
int_or_none,
@@ -119,14 +120,17 @@ class PluralsightIE(PluralsightBaseIE):
@staticmethod
def _convert_subtitles(duration, subs):
srt = ''
+ TIME_OFFSET_KEYS = ('displayTimeOffset', 'DisplayTimeOffset')
+ TEXT_KEYS = ('text', 'Text')
for num, current in enumerate(subs):
current = subs[num]
- start, text = float_or_none(
- current.get('DisplayTimeOffset')), current.get('Text')
+ start, text = (
+ float_or_none(dict_get(current, TIME_OFFSET_KEYS)),
+ dict_get(current, TEXT_KEYS))
if start is None or text is None:
continue
end = duration if num == len(subs) - 1 else float_or_none(
- subs[num + 1].get('DisplayTimeOffset'))
+ dict_get(subs[num + 1], TIME_OFFSET_KEYS))
if end is None:
continue
srt += os.linesep.join(