add support for YouTube short URLs, fix #62

This commit is contained in:
Mort Yao 2013-01-11 05:21:15 +01:00
parent ff7adf5bc4
commit 3b4ea85d5f
4 changed files with 16 additions and 3 deletions

View File

@ -1,6 +1,16 @@
Changelog
=========
0.3dev-20130111
---------------
*Date: 2013-01-11*
* Add support for:
- NetEase (v.163.com)
- YouTube short URLs
* Vimeo: downloading the highest available quality now.
0.3dev-20130104
---------------

View File

@ -53,7 +53,9 @@ def youtube_download_by_id(id, title = None, output_dir = '.', merge = True, inf
download_urls([url], title, ext, size, output_dir, merge = merge)
def youtube_download(url, output_dir = '.', merge = True, info_only = False):
id = parse.parse_qs(parse.urlparse(url).query)['v'][0]
id = r1(r'youtu.be/(.*)', url)
if not id:
id = parse.parse_qs(parse.urlparse(url).query)['v'][0]
assert id
youtube_download_by_id(id, None, output_dir, merge = merge, info_only = info_only)

View File

@ -42,6 +42,7 @@ def url_to_module(url):
'xiami': xiami,
'yinyuetai': yinyuetai,
'youku': youku,
'youtu': youtube,
'youtube': youtube,
#TODO
}

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
__version__ = '0.3dev-20130104'
__date__ = '2013-01-04'
__version__ = '0.3dev-20130111'
__date__ = '2013-01-11'