]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/minoto.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import int_or_none
10 class MinotoIE(InfoExtractor
):
11 _VALID_URL
= r
'(?:minoto:|https?://(?:play|iframe|embed)\.minoto-video\.com/(?P<player_id>[0-9]+)/)(?P<id>[a-zA-Z0-9]+)'
13 def _real_extract(self
, url
):
14 mobj
= re
.match(self
._VALID
_URL
, url
)
15 player_id
= mobj
.group('player_id') or '1'
16 video_id
= mobj
.group('id')
17 video_data
= self
._download
_json
('http://play.minoto-video.com/%s/%s.js' % (player_id
, video_id
), video_id
)
18 video_metadata
= video_data
['video-metadata']
20 for fmt
in video_data
['video-files']:
21 fmt_url
= fmt
.get('url')
24 container
= fmt
.get('container')
25 if container
== 'hls':
26 formats
.extend(fmt_url
, video_id
, 'mp4', m3u8_id
='hls', fatal
=False)
28 fmt_profile
= fmt
.get('profile') or {}
30 'format_id': fmt_profile
.get('name-short'),
31 'format_note': fmt_profile
.get('name'),
33 'container': container
,
34 'tbr': int_or_none(fmt
.get('bitrate')),
35 'filesize': int_or_none(fmt
.get('filesize')),
36 'width': int_or_none(fmt
.get('width')),
37 'height': int_or_none(fmt
.get('height')),
39 codecs
= fmt
.get('codecs')
41 codecs
= codecs
.split(',')
48 self
._sort
_formats
(formats
)
52 'title': video_metadata
['title'],
53 'description': video_metadata
.get('description'),
54 'thumbnail': video_metadata
.get('video-poster', {}).get('url'),