]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vk.py
5 from .common
import InfoExtractor
12 class VKIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://vk\.com/(?:videos.*?\?.*?z=)?video(?P<id>.*?)(?:\?|%2F|$)'
17 u
'url': u
'http://vk.com/videos-77521?z=video-77521_162222515%2Fclub77521',
18 u
'md5': u
'0deae91935c54e00003c2a00646315f0',
22 u
'title': u
'ProtivoGunz - Хуёвая песня',
23 u
'uploader': u
'Noize MC',
27 def _real_extract(self
, url
):
28 mobj
= re
.match(self
._VALID
_URL
, url
)
29 video_id
= mobj
.group('id')
30 info_url
= 'http://vk.com/al_video.php?act=show&al=1&video=%s' % video_id
31 info_page
= self
._download
_webpage
(info_url
, video_id
)
32 m_yt
= re
.search(r
'src="(http://www.youtube.com/.*?)"', info_page
)
34 self
.to_screen(u
'Youtube video detected')
35 return self
.url_result(m_yt
.group(1), 'Youtube')
36 vars_json
= self
._search
_regex
(r
'var vars = ({.*?});', info_page
, u
'vars')
37 vars = json
.loads(vars_json
)
40 'id': compat_str(vars['vid']),
41 'url': vars['url240'],
42 'title': unescapeHTML(vars['md_title']),
43 'thumbnail': vars['jpg'],
44 'uploader': vars['md_author'],