mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-27 21:46:54 +01:00
[mwave] Improve
This commit is contained in:
parent
7900aede14
commit
22c83245c5
@ -1,46 +1,58 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_str
|
||||||
|
from ..utils import (
|
||||||
|
int_or_none,
|
||||||
|
parse_duration,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class MwaveIE(InfoExtractor):
|
class MwaveIE(InfoExtractor):
|
||||||
IE_NAME = 'mwave'
|
|
||||||
_VALID_URL = r'https?://mwave\.interest\.me/mnettv/videodetail\.m\?searchVideoDetailVO\.clip_id=(?P<id>[0-9]+)'
|
_VALID_URL = r'https?://mwave\.interest\.me/mnettv/videodetail\.m\?searchVideoDetailVO\.clip_id=(?P<id>[0-9]+)'
|
||||||
_TESTS = [{
|
_TEST = {
|
||||||
'url': 'http://mwave.interest.me/mnettv/videodetail.m?searchVideoDetailVO.clip_id=168859',
|
'url': 'http://mwave.interest.me/mnettv/videodetail.m?searchVideoDetailVO.clip_id=168859',
|
||||||
|
'md5': 'c930e27b7720aaa3c9d0018dfc8ff6cc',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '168859',
|
'id': '168859',
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
'title': '[M COUNTDOWN] SISTAR - SHAKE IT',
|
'title': '[M COUNTDOWN] SISTAR - SHAKE IT',
|
||||||
'creator': 'M COUNTDOWN',
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
'uploader': 'M COUNTDOWN',
|
||||||
|
'duration': 206,
|
||||||
|
'view_count': int,
|
||||||
}
|
}
|
||||||
}, {
|
}
|
||||||
'url': 'http://mwave.interest.me/mnettv/videodetail.m?searchVideoDetailVO.clip_id=168860',
|
|
||||||
'info_dict': {
|
|
||||||
'id': '168860',
|
|
||||||
'ext': 'flv',
|
|
||||||
'title': '[Full Ver.] M GIGS Ep. 59 - IDIOTAPE Live Part 1',
|
|
||||||
'creator': 'M-GIGS',
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
stream_info = self._download_json(
|
vod_info = self._download_json(
|
||||||
'http://mwave.interest.me/onair/vod_info.m?vodtype=CL§orid=&endinfo=Y&id=%s' % video_id,
|
'http://mwave.interest.me/onair/vod_info.m?vodtype=CL§orid=&endinfo=Y&id=%s' % video_id,
|
||||||
'Download stream info')
|
video_id, 'Download vod JSON')
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for info in stream_info['cdn']:
|
for num, cdn_info in enumerate(vod_info['cdn']):
|
||||||
f4m_stream = self._download_json(info['url'], video_id, 'Download f4m stream')
|
stream_url = cdn_info.get('url')
|
||||||
|
if not stream_url:
|
||||||
|
continue
|
||||||
|
stream_name = cdn_info.get('name') or compat_str(num)
|
||||||
|
f4m_stream = self._download_json(
|
||||||
|
stream_url, video_id,
|
||||||
|
'Download %s stream JSON' % stream_name)
|
||||||
|
f4m_url = f4m_stream.get('fileurl')
|
||||||
|
if not f4m_url:
|
||||||
|
continue
|
||||||
formats.extend(
|
formats.extend(
|
||||||
self._extract_f4m_formats(f4m_stream['fileurl'] + '&g=PCROWKHLYUDY&hdcore=3.0.3', video_id))
|
self._extract_f4m_formats(f4m_url + '&hdcore=3.0.3', video_id, f4m_id=stream_name))
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': stream_info['title'],
|
'title': vod_info['title'],
|
||||||
'creator': stream_info.get('program_title'),
|
'thumbnail': vod_info.get('cover'),
|
||||||
|
'uploader': vod_info.get('program_title'),
|
||||||
|
'duration': parse_duration(vod_info.get('time')),
|
||||||
|
'view_count': int_or_none(vod_info.get('hit')),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user