]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/minoto.py
[ie/generic] Add `key_query` extractor-arg
[yt-dlp.git] / yt_dlp / extractor / minoto.py
index 6367311956ca973328b546b7d7fd8d34f72f251e..69832560d055594988e77fc180ba14bfc7da443d 100644 (file)
@@ -1,8 +1,3 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
-import re
-
 from .common import InfoExtractor
 from ..utils import (
     int_or_none,
@@ -14,10 +9,10 @@ class MinotoIE(InfoExtractor):
     _VALID_URL = r'(?:minoto:|https?://(?:play|iframe|embed)\.minoto-video\.com/(?P<player_id>[0-9]+)/)(?P<id>[a-zA-Z0-9]+)'
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         player_id = mobj.group('player_id') or '1'
         video_id = mobj.group('id')
-        video_data = self._download_json('http://play.minoto-video.com/%s/%s.js' % (player_id, video_id), video_id)
+        video_data = self._download_json(f'http://play.minoto-video.com/{player_id}/{video_id}.js', video_id)
         video_metadata = video_data['video-metadata']
         formats = []
         for fmt in video_data['video-files']:
@@ -26,7 +21,7 @@ def _real_extract(self, url):
                 continue
             container = fmt.get('container')
             if container == 'hls':
-                formats.extend(fmt_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
+                formats.extend(self._extract_m3u8_formats(fmt_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
             else:
                 fmt_profile = fmt.get('profile') or {}
                 formats.append({
@@ -38,9 +33,8 @@ def _real_extract(self, url):
                     'filesize': int_or_none(fmt.get('filesize')),
                     'width': int_or_none(fmt.get('width')),
                     'height': int_or_none(fmt.get('height')),
-                    'codecs': parse_codecs(fmt.get('codecs')),
+                    **parse_codecs(fmt.get('codecs')),
                 })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,