]>
Commit | Line | Data |
---|---|---|
7900aede | 1 | from __future__ import unicode_literals |
2 | ||
3 | from .common import InfoExtractor | |
22c83245 S |
4 | from ..compat import compat_str |
5 | from ..utils import ( | |
6 | int_or_none, | |
7 | parse_duration, | |
8 | ) | |
7900aede | 9 | |
10 | ||
11 | class MwaveIE(InfoExtractor): | |
7900aede | 12 | _VALID_URL = r'https?://mwave\.interest\.me/mnettv/videodetail\.m\?searchVideoDetailVO\.clip_id=(?P<id>[0-9]+)' |
a5941305 | 13 | _URL_TEMPLATE = 'http://mwave.interest.me/mnettv/videodetail.m?searchVideoDetailVO.clip_id=%s' |
22c83245 | 14 | _TEST = { |
7900aede | 15 | 'url': 'http://mwave.interest.me/mnettv/videodetail.m?searchVideoDetailVO.clip_id=168859', |
a8062eab | 16 | # md5 is unstable |
7900aede | 17 | 'info_dict': { |
18 | 'id': '168859', | |
19 | 'ext': 'flv', | |
20 | 'title': '[M COUNTDOWN] SISTAR - SHAKE IT', | |
22c83245 S |
21 | 'thumbnail': 're:^https?://.*\.jpg$', |
22 | 'uploader': 'M COUNTDOWN', | |
23 | 'duration': 206, | |
24 | 'view_count': int, | |
7900aede | 25 | } |
22c83245 | 26 | } |
7900aede | 27 | |
28 | def _real_extract(self, url): | |
29 | video_id = self._match_id(url) | |
30 | ||
22c83245 | 31 | vod_info = self._download_json( |
7900aede | 32 | 'http://mwave.interest.me/onair/vod_info.m?vodtype=CL§orid=&endinfo=Y&id=%s' % video_id, |
22c83245 | 33 | video_id, 'Download vod JSON') |
7900aede | 34 | |
35 | formats = [] | |
22c83245 S |
36 | for num, cdn_info in enumerate(vod_info['cdn']): |
37 | stream_url = cdn_info.get('url') | |
38 | if not stream_url: | |
39 | continue | |
40 | stream_name = cdn_info.get('name') or compat_str(num) | |
41 | f4m_stream = self._download_json( | |
42 | stream_url, video_id, | |
43 | 'Download %s stream JSON' % stream_name) | |
44 | f4m_url = f4m_stream.get('fileurl') | |
45 | if not f4m_url: | |
46 | continue | |
7900aede | 47 | formats.extend( |
22c83245 | 48 | self._extract_f4m_formats(f4m_url + '&hdcore=3.0.3', video_id, f4m_id=stream_name)) |
7900aede | 49 | self._sort_formats(formats) |
50 | ||
51 | return { | |
52 | 'id': video_id, | |
22c83245 S |
53 | 'title': vod_info['title'], |
54 | 'thumbnail': vod_info.get('cover'), | |
55 | 'uploader': vod_info.get('program_title'), | |
56 | 'duration': parse_duration(vod_info.get('time')), | |
57 | 'view_count': int_or_none(vod_info.get('hit')), | |
7900aede | 58 | 'formats': formats, |
59 | } | |
5b5d7cc1 PR |
60 | |
61 | ||
62 | class MwaveMeetGreetIE(InfoExtractor): | |
a5941305 | 63 | _VALID_URL = r'https?://mwave\.interest\.me/meetgreet/view/(?P<id>\d+)' |
5b5d7cc1 PR |
64 | _TEST = { |
65 | 'url': 'http://mwave.interest.me/meetgreet/view/256', | |
66 | 'info_dict': { | |
67 | 'id': '173294', | |
68 | 'ext': 'flv', | |
69 | 'title': '[MEET&GREET] Park BoRam', | |
70 | 'thumbnail': 're:^https?://.*\.jpg$', | |
71 | 'uploader': 'Mwave', | |
72 | 'duration': 3634, | |
73 | 'view_count': int, | |
74 | } | |
75 | } | |
76 | ||
77 | def _real_extract(self, url): | |
78 | video_id = self._match_id(url) | |
79 | webpage = self._download_webpage(url, video_id) | |
a5941305 YCH |
80 | clip_id = self._html_search_regex( |
81 | r'<iframe[^>]+src="/mnettv/ifr_clip\.m\?searchVideoDetailVO\.clip_id=(\d+)', | |
82 | webpage, 'clip ID') | |
83 | clip_url = MwaveIE._URL_TEMPLATE % clip_id | |
5b5d7cc1 | 84 | return self.url_result(clip_url, 'Mwave', clip_id) |