mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-03 08:19:57 +01:00
[mnet] Improve (Closes #8958)
This commit is contained in:
parent
e031768666
commit
98e68806fb
@ -11,10 +11,8 @@
|
|||||||
|
|
||||||
class MnetIE(InfoExtractor):
|
class MnetIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?mnet\.(?:com|interest\.me)/tv/vod/(?:.*?\bclip_id=)?(?P<id>[0-9]+)'
|
_VALID_URL = r'https?://(?:www\.)?mnet\.(?:com|interest\.me)/tv/vod/(?:.*?\bclip_id=)?(?P<id>[0-9]+)'
|
||||||
_TESTS = [
|
_TESTS = [{
|
||||||
{
|
|
||||||
'url': 'http://www.mnet.com/tv/vod/171008',
|
'url': 'http://www.mnet.com/tv/vod/171008',
|
||||||
'md5': '6abd7a837fa9fe56d22709a60b19bffb',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '171008',
|
'id': '171008',
|
||||||
'title': 'SS_이해인@히든박스',
|
'title': 'SS_이해인@히든박스',
|
||||||
@ -24,53 +22,60 @@ class MnetIE(InfoExtractor):
|
|||||||
'timestamp': 1451564040,
|
'timestamp': 1451564040,
|
||||||
'age_limit': 0,
|
'age_limit': 0,
|
||||||
'thumbnails': 'mincount:5',
|
'thumbnails': 'mincount:5',
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
},
|
},
|
||||||
|
'params': {
|
||||||
|
# rtmp download
|
||||||
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
{
|
}, {
|
||||||
'url': 'http://mnet.interest.me/tv/vod/172790',
|
'url': 'http://mnet.interest.me/tv/vod/172790',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
'url': 'http://www.mnet.com/tv/vod/vod_view.asp?clip_id=172790&tabMenu=',
|
'url': 'http://www.mnet.com/tv/vod/vod_view.asp?clip_id=172790&tabMenu=',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
},
|
}]
|
||||||
]
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
info_url = 'http://content.api.mnet.com/player/vodConfig?id=%s' % video_id
|
|
||||||
info = self._download_json(info_url, video_id)
|
info = self._download_json(
|
||||||
info = info['data']['info']
|
'http://content.api.mnet.com/player/vodConfig?id=%s&ctype=CLIP' % video_id,
|
||||||
|
video_id, 'Downloading vod config JSON')['data']['info']
|
||||||
|
|
||||||
title = info['title']
|
title = info['title']
|
||||||
rtmp_info_url = info['cdn'] + 'CLIP'
|
|
||||||
rtmp_info = self._download_json(rtmp_info_url, video_id)
|
rtmp_info = self._download_json(
|
||||||
file_url = rtmp_info['serverurl'] + rtmp_info['fileurl']
|
info['cdn'], video_id, 'Downloading vod cdn JSON')
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'url': rtmp_info['serverurl'] + rtmp_info['fileurl'],
|
||||||
|
'ext': 'flv',
|
||||||
|
'page_url': url,
|
||||||
|
'player_url': 'http://flvfile.mnet.com/service/player/201602/cjem_player_tv.swf?v=201602191318',
|
||||||
|
}]
|
||||||
|
|
||||||
description = info.get('ment')
|
description = info.get('ment')
|
||||||
duration = parse_duration(info.get('time'))
|
duration = parse_duration(info.get('time'))
|
||||||
timestamp = parse_iso8601(info.get('date'), delimiter=' ')
|
timestamp = parse_iso8601(info.get('date'), delimiter=' ')
|
||||||
age_limit = info.get('adult')
|
age_limit = info.get('adult')
|
||||||
if age_limit is not None:
|
if age_limit is not None:
|
||||||
age_limit = 0 if age_limit == 'N' else 18
|
age_limit = 0 if age_limit == 'N' else 18
|
||||||
thumbnails = [
|
thumbnails = [{
|
||||||
{
|
|
||||||
'id': thumb_format,
|
'id': thumb_format,
|
||||||
'url': thumb['url'],
|
'url': thumb['url'],
|
||||||
'width': int_or_none(thumb.get('width')),
|
'width': int_or_none(thumb.get('width')),
|
||||||
'height': int_or_none(thumb.get('height')),
|
'height': int_or_none(thumb.get('height')),
|
||||||
}
|
} for thumb_format, thumb in info.get('cover', {}).items() if thumb.get('url')]
|
||||||
for (thumb_format, thumb) in info.get('cover', {}).items()
|
|
||||||
]
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'url': file_url,
|
|
||||||
'description': description,
|
'description': description,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'timestamp': timestamp,
|
'timestamp': timestamp,
|
||||||
'age_limit': age_limit,
|
'age_limit': age_limit,
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
'ext': 'flv',
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user