]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/mwave.py
fea1caf478b2a862ae3a028b4a80041b734a5e1b
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
   4 from ..compat 
import compat_str
 
  11 class MwaveIE(InfoExtractor
): 
  12     _VALID_URL 
= r
'https?://mwave\.interest\.me/(?:[^/]+/)?mnettv/videodetail\.m\?searchVideoDetailVO\.clip_id=(?P<id>[0-9]+)' 
  13     _URL_TEMPLATE 
= 'http://mwave.interest.me/mnettv/videodetail.m?searchVideoDetailVO.clip_id=%s' 
  15         'url': 'http://mwave.interest.me/mnettv/videodetail.m?searchVideoDetailVO.clip_id=168859', 
  20             'title': '[M COUNTDOWN] SISTAR - SHAKE IT', 
  21             'thumbnail': 're:^https?://.*\.jpg$', 
  22             'uploader': 'M COUNTDOWN', 
  27         'url': 'http://mwave.interest.me/en/mnettv/videodetail.m?searchVideoDetailVO.clip_id=176199', 
  28         'only_matching': True, 
  31     def _real_extract(self
, url
): 
  32         video_id 
= self
._match
_id
(url
) 
  34         vod_info 
= self
._download
_json
( 
  35             'http://mwave.interest.me/onair/vod_info.m?vodtype=CL§orid=&endinfo=Y&id=%s' % video_id
, 
  36             video_id
, 'Download vod JSON') 
  39         for num
, cdn_info 
in enumerate(vod_info
['cdn']): 
  40             stream_url 
= cdn_info
.get('url') 
  43             stream_name 
= cdn_info
.get('name') or compat_str(num
) 
  44             f4m_stream 
= self
._download
_json
( 
  46                 'Download %s stream JSON' % stream_name
) 
  47             f4m_url 
= f4m_stream
.get('fileurl') 
  51                 self
._extract
_f
4m
_formats
(f4m_url 
+ '&hdcore=3.0.3', video_id
, f4m_id
=stream_name
)) 
  52         self
._sort
_formats
(formats
) 
  56             'title': vod_info
['title'], 
  57             'thumbnail': vod_info
.get('cover'), 
  58             'uploader': vod_info
.get('program_title'), 
  59             'duration': parse_duration(vod_info
.get('time')), 
  60             'view_count': int_or_none(vod_info
.get('hit')), 
  65 class MwaveMeetGreetIE(InfoExtractor
): 
  66     _VALID_URL 
= r
'https?://mwave\.interest\.me/(?:[^/]+/)?meetgreet/view/(?P<id>\d+)' 
  68         'url': 'http://mwave.interest.me/meetgreet/view/256', 
  72             'title': '[MEET&GREET] Park BoRam', 
  73             'thumbnail': 're:^https?://.*\.jpg$', 
  79         'url': 'http://mwave.interest.me/en/meetgreet/view/256', 
  80         'only_matching': True, 
  83     def _real_extract(self
, url
): 
  84         video_id 
= self
._match
_id
(url
) 
  85         webpage 
= self
._download
_webpage
(url
, video_id
) 
  86         clip_id 
= self
._html
_search
_regex
( 
  87             r
'<iframe[^>]+src="/mnettv/ifr_clip\.m\?searchVideoDetailVO\.clip_id=(\d+)', 
  89         clip_url 
= MwaveIE
._URL
_TEMPLATE 
% clip_id
 
  90         return self
.url_result(clip_url
, 'Mwave', clip_id
)