add support for Xtube

This commit is contained in:
gongqijian 2012-12-22 03:16:54 +08:00
parent ee3d248afb
commit 00f27681ca
5 changed files with 33 additions and 0 deletions

View File

@ -15,6 +15,7 @@ Fork me on GitHub: <https://github.com/soimort/you-get>
* Dailymotion <http://dailymotion.com> * Dailymotion <http://dailymotion.com>
* Google+ <http://plus.google.com> * Google+ <http://plus.google.com>
* Tumblr <http://www.tumblr.com> * Tumblr <http://www.tumblr.com>
* Xtube <http://www.xtube.com>
* SoundCloud <http://soundcloud.com> * SoundCloud <http://soundcloud.com>
* Youku (优酷) <http://www.youku.com> * Youku (优酷) <http://www.youku.com>
* Tudou (土豆) <http://www.tudou.com> * Tudou (土豆) <http://www.tudou.com>
@ -205,6 +206,7 @@ You-Get基于优酷下载脚本[iambus/youku-lixian](https://github.com/iambus/y
* Dailymotion <http://dailymotion.com> * Dailymotion <http://dailymotion.com>
* Google+ <http://plus.google.com> * Google+ <http://plus.google.com>
* Tumblr <http://www.tumblr.com> * Tumblr <http://www.tumblr.com>
* Xtube <http://www.xtube.com>
* SoundCloud <http://soundcloud.com> * SoundCloud <http://soundcloud.com>
* 优酷 <http://www.youku.com> * 优酷 <http://www.youku.com>
* 土豆 <http://www.tudou.com> * 土豆 <http://www.tudou.com>

View File

@ -18,6 +18,7 @@ Supported Sites (As of Now)
* Dailymotion http://dailymotion.com * Dailymotion http://dailymotion.com
* Google+ http://plus.google.com * Google+ http://plus.google.com
* Tumblr http://www.tumblr.com * Tumblr http://www.tumblr.com
* Xtube http://www.xtube.com
* SoundCloud http://soundcloud.com * SoundCloud http://soundcloud.com
* Youku (优酷) http://www.youku.com * Youku (优酷) http://www.youku.com
* Tudou (土豆) http://www.tudou.com * Tudou (土豆) http://www.tudou.com

1
you_get/downloader/__init__.py Normal file → Executable file
View File

@ -14,6 +14,7 @@ from .sina import *
from .sohu import * from .sohu import *
from .soundcloud import * from .soundcloud import *
from .tudou import * from .tudou import *
from .xtube import *
from .tumblr import * from .tumblr import *
from .vimeo import * from .vimeo import *
from .w56 import * from .w56 import *

28
you_get/downloader/xtube.py Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python
__all__ = ['xtube_download', 'xtube_download_by_id']
from ..common import *
import urllib
def xtube_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False):
html = get_html('http://www.xtube.com/find_video.php?video_id=%s' % id)
url = urllib.parse.unquote(r1('&filename=([a-zA-Z0-9\-\%\.\\_]+)', html))
title = "[%s] %s" % (id, title)
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)
def xtube_download(url, output_dir = '.', merge = True, info_only = False):
html = get_html(url)
title = r1(r'<title>(.*)</title>', html)
assert title
id = r1(r'http://www.xtube.com/watch.php\?v=([a-zA-Z0-9\-]+)', url)
assert id
xtube_download_by_id(id, title, output_dir = output_dir, merge = merge, info_only = info_only)
site_info = "xtube.com"
download = xtube_download
download_playlist = playlist_not_supported('xtube')

1
you_get/main.py Normal file → Executable file
View File

@ -36,6 +36,7 @@ def url_to_module(url):
'sohu': sohu, 'sohu': sohu,
'soundcloud': soundcloud, 'soundcloud': soundcloud,
'tudou': tudou, 'tudou': tudou,
'xtube': xtube,
'tumblr': tumblr, 'tumblr': tumblr,
'vimeo': vimeo, 'vimeo': vimeo,
'yinyuetai': yinyuetai, 'yinyuetai': yinyuetai,