]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/turner.py
[extractor] Deprecate `_sort_formats`
[yt-dlp.git] / yt_dlp / extractor / turner.py
index 81229a54be34a90af845ce0b0f142321ea5ad691..630d84bdc39fa10907af0de0d2fed905fe91f65f 100644 (file)
@@ -1,6 +1,3 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 import re
 
 from .adobepass import AdobePassIE
@@ -144,7 +141,7 @@ def _extract_cvp_info(self, data_src, video_id, path_data={}, ap_data={}, fatal=
                     m3u8_id=format_id or 'hls', fatal=False)
                 if '/secure/' in video_url and '?hdnea=' in video_url:
                     for f in m3u8_formats:
-                        f['_seekable'] = False
+                        f['downloader_options'] = {'ffmpeg_args': ['-seekable', '0']}
                 formats.extend(m3u8_formats)
             elif ext == 'f4m':
                 formats.extend(self._extract_f4m_formats(
@@ -177,7 +174,6 @@ def _extract_cvp_info(self, data_src, video_id, path_data={}, ap_data={}, fatal=
                             else:
                                 f['tbr'] = int(mobj.group(1))
                 formats.append(f)
-        self._sort_formats(formats)
 
         for source in video_data.findall('closedCaptions/source'):
             for track in source.findall('track'):
@@ -205,7 +201,7 @@ def _extract_cvp_info(self, data_src, video_id, path_data={}, ap_data={}, fatal=
 
         return {
             'id': video_id,
-            'title': self._live_title(title) if is_live else title,
+            'title': title,
             'formats': formats,
             'subtitles': subtitles,
             'thumbnails': thumbnails,
@@ -221,6 +217,7 @@ def _extract_cvp_info(self, data_src, video_id, path_data={}, ap_data={}, fatal=
         }
 
     def _extract_ngtv_info(self, media_id, tokenizer_query, ap_data=None):
+        is_live = ap_data.get('is_live')
         streams_data = self._download_json(
             'http://medium.ngtv.io/media/%s/tv' % media_id,
             media_id)['media']['tv']
@@ -237,11 +234,11 @@ def _extract_ngtv_info(self, media_id, tokenizer_query, ap_data=None):
                     'http://token.ngtv.io/token/token_spe',
                     m3u8_url, media_id, ap_data or {}, tokenizer_query)
             formats.extend(self._extract_m3u8_formats(
-                m3u8_url, media_id, 'mp4', m3u8_id='hls', fatal=False))
+                m3u8_url, media_id, 'mp4', m3u8_id='hls', live=is_live, fatal=False))
 
             duration = float_or_none(stream_data.get('totalRuntime'))
 
-            if not chapters:
+            if not chapters and not is_live:
                 for chapter in stream_data.get('contentSegments', []):
                     start_time = float_or_none(chapter.get('start'))
                     chapter_duration = float_or_none(chapter.get('duration'))
@@ -251,7 +248,6 @@ def _extract_ngtv_info(self, media_id, tokenizer_query, ap_data=None):
                         'start_time': start_time,
                         'end_time': start_time + chapter_duration,
                     })
-        self._sort_formats(formats)
 
         return {
             'formats': formats,