Merge branch 'feature/vk-support' into develop

This commit is contained in:
Mort Yao 2014-02-18 21:18:13 +01:00
commit d594d35049
5 changed files with 29 additions and 0 deletions

View File

@ -60,6 +60,7 @@ __中文说明__已移至[wiki](https://github.com/soimort/you-get/wiki/%E4%B8%A
* Baidu Wangpan (百度网盘) <http://pan.baidu.com> * Baidu Wangpan (百度网盘) <http://pan.baidu.com>
* SongTaste <http://www.songtaste.com> * SongTaste <http://www.songtaste.com>
* Alive.in.th <http://alive.in.th> * Alive.in.th <http://alive.in.th>
* VK <http://vk.com>
## Dependencies ## Dependencies

View File

@ -63,6 +63,7 @@ Supported Sites (As of Now)
* Baidu Wangpan (百度网盘) http://pan.baidu.com * Baidu Wangpan (百度网盘) http://pan.baidu.com
* SongTaste http://www.songtaste.com * SongTaste http://www.songtaste.com
* Alive.in.th http://alive.in.th * Alive.in.th http://alive.in.th
* VK http://vk.com
Dependencies Dependencies
------------ ------------

View File

@ -37,6 +37,7 @@ from .tumblr import *
from .vid48 import * from .vid48 import *
from .vimeo import * from .vimeo import *
from .vine import * from .vine import *
from .vk import *
from .w56 import * from .w56 import *
from .xiami import * from .xiami import *
from .yinyuetai import * from .yinyuetai import *

View File

@ -58,6 +58,7 @@ def url_to_module(url):
'vid48': vid48, 'vid48': vid48,
'vimeo': vimeo, 'vimeo': vimeo,
'vine': vine, 'vine': vine,
'vk': vk,
'xiami': xiami, 'xiami': xiami,
'yinyuetai': yinyuetai, 'yinyuetai': yinyuetai,
'youku': youku, 'youku': youku,

View File

@ -0,0 +1,25 @@
#!/usr/bin/env python
__all__ = ['vk_download']
from ..common import *
def vk_download(url, output_dir='.', merge=True, info_only=False):
video_page = get_content(url)
title = unescape_html(r1(r'"title":"([^"]+)"', video_page))
info = dict(re.findall(r'\\"url(\d+)\\":\\"([^"]+)\\"', video_page))
for quality in ['1080', '720', '480', '360', '240']:
if quality in info:
url = re.sub(r'\\\\\\/', r'/', info[quality])
break
assert url
type, ext, size = url_info(url)
print_info(site_info, title, type, size)
if not info_only:
download_urls([url], title, ext, size, output_dir, merge=merge)
site_info = "VK.com"
download = vk_download
download_playlist = playlist_not_supported('vk')