]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vevo.py
4 from .common
import InfoExtractor
9 class VevoIE(InfoExtractor
):
11 Accecps urls from vevo.com or in the format 'vevo:{id}'
12 (currently used by MTVIE)
14 _VALID_URL
= r
'((http://www.vevo.com/watch/.*?/.*?/)|(vevo:))(?P<id>.*)$'
16 def _real_extract(self
, url
):
17 mobj
= re
.match(self
._VALID
_URL
, url
)
18 video_id
= mobj
.group('id')
20 json_url
= 'http://www.vevo.com/data/video/%s' % video_id
21 base_url
= 'http://smil.lvl3.vevo.com'
22 videos_url
= '%s/Video/V2/VFILE/%s/%sr.smil' % (base_url
, video_id
, video_id
.lower())
23 info_json
= self
._download
_webpage
(json_url
, video_id
, u
'Downloading json info')
24 links_webpage
= self
._download
_webpage
(videos_url
, video_id
, u
'Downloading videos urls')
26 self
.report_extraction(video_id
)
27 video_info
= json
.loads(info_json
)
28 m_urls
= list(re
.finditer(r
'<video src="(?P<ext>.*?):(?P<url>.*?)"', links_webpage
))
29 if m_urls
is None or len(m_urls
) == 0:
30 raise ExtractorError(u
'Unable to extract video url')
31 # They are sorted from worst to best quality
33 video_url
= base_url
+ m_url
.group('url')
34 ext
= m_url
.group('ext')
36 return {'url': video_url
,
39 'title': video_info
['title'],
40 'thumbnail': video_info
['img'],
41 'upload_date': video_info
['launchDate'].replace('/',''),
42 'uploader': video_info
['Artists'][0]['title'],