]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/mediasite.py
Allow extractors to specify section_start/end for clips
[yt-dlp.git] / yt_dlp / extractor / mediasite.py
index ace86c2fd6fcd1666a3b92f109aa2f8dcd4cd6c2..30464bad0e745880ac2176fdc38704eb20308c70 100644 (file)
@@ -1,6 +1,3 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 import re
 import json
 
@@ -14,6 +11,7 @@
     float_or_none,
     mimetype2ext,
     str_or_none,
+    try_call,
     try_get,
     unescapeHTML,
     unsmuggle_url,
@@ -145,11 +143,11 @@ def __extract_slides(self, *, stream_id, snum, Stream, duration, images):
                             'duration': slide['Time'] / 1000,
                         })
 
-            next_time = try_get(None, [
-                lambda _: Stream['Slides'][i + 1]['Time'],
-                lambda _: duration,
-                lambda _: slide['Time'],
-            ], expected_type=(int, float))
+            next_time = try_call(
+                lambda: Stream['Slides'][i + 1]['Time'],
+                lambda: duration,
+                lambda: slide['Time'],
+                expected_type=(int, float))
 
             fragments.append({
                 'path': fname_template.format(slide.get('Number', i + 1)),