mirror of
https://source.netsyms.com/Mirrors/youtube-dl
synced 2024-11-03 03:40:20 +00:00
[mnet] Add new extractor
This commit is contained in:
parent
5eb7db4ee9
commit
e031768666
@ -410,6 +410,7 @@ from .mit import TechTVMITIE, MITIE, OCWMITIE
|
|||||||
from .mitele import MiTeleIE
|
from .mitele import MiTeleIE
|
||||||
from .mixcloud import MixcloudIE
|
from .mixcloud import MixcloudIE
|
||||||
from .mlb import MLBIE
|
from .mlb import MLBIE
|
||||||
|
from .mnet import MnetIE
|
||||||
from .mpora import MporaIE
|
from .mpora import MporaIE
|
||||||
from .moevideo import MoeVideoIE
|
from .moevideo import MoeVideoIE
|
||||||
from .mofosex import MofosexIE
|
from .mofosex import MofosexIE
|
||||||
|
76
youtube_dl/extractor/mnet.py
Normal file
76
youtube_dl/extractor/mnet.py
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
int_or_none,
|
||||||
|
parse_duration,
|
||||||
|
parse_iso8601,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class MnetIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?mnet\.(?:com|interest\.me)/tv/vod/(?:.*?\bclip_id=)?(?P<id>[0-9]+)'
|
||||||
|
_TESTS = [
|
||||||
|
{
|
||||||
|
'url': 'http://www.mnet.com/tv/vod/171008',
|
||||||
|
'md5': '6abd7a837fa9fe56d22709a60b19bffb',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '171008',
|
||||||
|
'title': 'SS_이해인@히든박스',
|
||||||
|
'description': 'md5:b9efa592c3918b615ba69fe9f8a05c55',
|
||||||
|
'duration': 88,
|
||||||
|
'upload_date': '20151231',
|
||||||
|
'timestamp': 1451564040,
|
||||||
|
'age_limit': 0,
|
||||||
|
'thumbnails': 'mincount:5',
|
||||||
|
'ext': 'flv',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://mnet.interest.me/tv/vod/172790',
|
||||||
|
'only_matching': True,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://www.mnet.com/tv/vod/vod_view.asp?clip_id=172790&tabMenu=',
|
||||||
|
'only_matching': True,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
def _real_extract(self, 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 = info['data']['info']
|
||||||
|
|
||||||
|
title = info['title']
|
||||||
|
rtmp_info_url = info['cdn'] + 'CLIP'
|
||||||
|
rtmp_info = self._download_json(rtmp_info_url, video_id)
|
||||||
|
file_url = rtmp_info['serverurl'] + rtmp_info['fileurl']
|
||||||
|
description = info.get('ment')
|
||||||
|
duration = parse_duration(info.get('time'))
|
||||||
|
timestamp = parse_iso8601(info.get('date'), delimiter=' ')
|
||||||
|
age_limit = info.get('adult')
|
||||||
|
if age_limit is not None:
|
||||||
|
age_limit = 0 if age_limit == 'N' else 18
|
||||||
|
thumbnails = [
|
||||||
|
{
|
||||||
|
'id': thumb_format,
|
||||||
|
'url': thumb['url'],
|
||||||
|
'width': int_or_none(thumb.get('width')),
|
||||||
|
'height': int_or_none(thumb.get('height')),
|
||||||
|
}
|
||||||
|
for (thumb_format, thumb) in info.get('cover', {}).items()
|
||||||
|
]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'url': file_url,
|
||||||
|
'description': description,
|
||||||
|
'duration': duration,
|
||||||
|
'timestamp': timestamp,
|
||||||
|
'age_limit': age_limit,
|
||||||
|
'thumbnails': thumbnails,
|
||||||
|
'ext': 'flv',
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user