]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/melonvod.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 class MelonVODIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://vod\.melon\.com/video/detail2\.html?\?.*?mvId=(?P<id>[0-9]+)'
14 'url': 'http://vod.melon.com/video/detail2.htm?mvId=50158734',
18 'title': "Jessica 'Wonderland' MV Making Film",
19 'thumbnail': r
're:^https?://.*\.jpg$',
20 'artist': 'Jessica (제시카)',
21 'upload_date': '20161212',
25 'skip_download': 'm3u8 download',
29 def _real_extract(self
, url
):
30 video_id
= self
._match
_id
(url
)
32 play_info
= self
._download
_json
(
33 'http://vod.melon.com/video/playerInfo.json', video_id
,
34 note
='Downloading player info JSON', query
={'mvId': video_id
})
36 title
= play_info
['mvInfo']['MVTITLE']
38 info
= self
._download
_json
(
39 'http://vod.melon.com/delivery/streamingInfo.json', video_id
,
40 note
='Downloading streaming info JSON',
46 stream_info
= info
['streamingInfo']
48 formats
= self
._extract
_m
3u8_formats
(
49 stream_info
['encUrl'], video_id
, 'mp4', m3u8_id
='hls')
50 self
._sort
_formats
(formats
)
52 artist_list
= play_info
.get('artistList')
54 if isinstance(artist_list
, list):
56 [a
['ARTISTNAMEWEBLIST']
57 for a
in artist_list
if a
.get('ARTISTNAMEWEBLIST')])
59 thumbnail
= urljoin(info
.get('staticDomain'), stream_info
.get('imgPath'))
61 duration
= int_or_none(stream_info
.get('playTime'))
62 upload_date
= stream_info
.get('mvSvcOpenDt', '')[:8] or None
68 'thumbnail': thumbnail
,
69 'upload_date': upload_date
,