diff options
author | Unknown <blackjack4494@web.de> | 2020-09-02 23:33:41 +0200 |
---|---|---|
committer | Unknown <blackjack4494@web.de> | 2020-09-02 23:33:41 +0200 |
commit | 3ca3f77f9ce9dd504dc6af4ef605c245c31ff860 (patch) | |
tree | 6bd9c9352327148a78b8c46227c8d526f1447b03 /youtube_dl/extractor/minoto.py | |
parent | 4cd6add62b54721eeb3bf76bd9c0b4d676dc4d68 (diff) | |
download | hypervideo-pre-3ca3f77f9ce9dd504dc6af4ef605c245c31ff860.tar.lz hypervideo-pre-3ca3f77f9ce9dd504dc6af4ef605c245c31ff860.tar.xz hypervideo-pre-3ca3f77f9ce9dd504dc6af4ef605c245c31ff860.zip |
[skip travis] adding automerge support
basically copying content of youtube_dl folder to youtube_dlc and excluding the youtube_dl folder when compiling
Diffstat (limited to 'youtube_dl/extractor/minoto.py')
-rw-r--r-- | youtube_dl/extractor/minoto.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/youtube_dl/extractor/minoto.py b/youtube_dl/extractor/minoto.py new file mode 100644 index 000000000..636731195 --- /dev/null +++ b/youtube_dl/extractor/minoto.py @@ -0,0 +1,51 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + int_or_none, + parse_codecs, +) + + +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) + 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_metadata = video_data['video-metadata'] + formats = [] + for fmt in video_data['video-files']: + fmt_url = fmt.get('url') + if not fmt_url: + continue + container = fmt.get('container') + if container == 'hls': + formats.extend(fmt_url, video_id, 'mp4', m3u8_id='hls', fatal=False) + else: + fmt_profile = fmt.get('profile') or {} + formats.append({ + 'format_id': fmt_profile.get('name-short'), + 'format_note': fmt_profile.get('name'), + 'url': fmt_url, + 'container': container, + 'tbr': int_or_none(fmt.get('bitrate')), + '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')), + }) + self._sort_formats(formats) + + return { + 'id': video_id, + 'title': video_metadata['title'], + 'description': video_metadata.get('description'), + 'thumbnail': video_metadata.get('video-poster', {}).get('url'), + 'formats': formats, + } |