]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/mnet.py
e3f42e7bdae7503d69d7585a407c3d68e333086e
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
  12 class MnetIE(InfoExtractor
): 
  13     _VALID_URL 
= r
'https?://(?:www\.)?mnet\.(?:com|interest\.me)/tv/vod/(?:.*?\bclip_id=)?(?P<id>[0-9]+)' 
  15         'url': 'http://www.mnet.com/tv/vod/171008', 
  18             'title': 'SS_이해인@히든박스', 
  19             'description': 'md5:b9efa592c3918b615ba69fe9f8a05c55', 
  21             'upload_date': '20151231', 
  22             'timestamp': 1451564040, 
  24             'thumbnails': 'mincount:5', 
  25             'thumbnail': 're:^https?://.*\.jpg$', 
  30             'skip_download': True, 
  33         'url': 'http://mnet.interest.me/tv/vod/172790', 
  34         'only_matching': True, 
  36         'url': 'http://www.mnet.com/tv/vod/vod_view.asp?clip_id=172790&tabMenu=', 
  37         'only_matching': True, 
  40     def _real_extract(self
, url
): 
  41         video_id 
= self
._match
_id
(url
) 
  43         info 
= self
._download
_json
( 
  44             'http://content.api.mnet.com/player/vodConfig?id=%s&ctype=CLIP' % video_id
, 
  45             video_id
, 'Downloading vod config JSON')['data']['info'] 
  49         rtmp_info 
= self
._download
_json
( 
  50             info
['cdn'], video_id
, 'Downloading vod cdn JSON') 
  53             'url': rtmp_info
['serverurl'] + rtmp_info
['fileurl'], 
  56             'player_url': 'http://flvfile.mnet.com/service/player/201602/cjem_player_tv.swf?v=201602191318', 
  59         description 
= info
.get('ment') 
  60         duration 
= parse_duration(info
.get('time')) 
  61         timestamp 
= parse_iso8601(info
.get('date'), delimiter
=' ') 
  62         age_limit 
= info
.get('adult') 
  63         if age_limit 
is not None: 
  64             age_limit 
= 0 if age_limit 
== 'N' else 18 
  68             'width': int_or_none(thumb
.get('width')), 
  69             'height': int_or_none(thumb
.get('height')), 
  70         } for thumb_format
, thumb 
in info
.get('cover', {}).items() if thumb
.get('url')] 
  75             'description': description
, 
  77             'timestamp': timestamp
, 
  78             'age_limit': age_limit
, 
  79             'thumbnails': thumbnails
,