From 00f27681ca82a8c3854a023aa6e5aee23733115d Mon Sep 17 00:00:00 2001 From: gongqijian Date: Sat, 22 Dec 2012 03:16:54 +0800 Subject: [PATCH] add support for Xtube --- README.md | 2 ++ README.txt | 1 + you_get/downloader/__init__.py | 1 + you_get/downloader/xtube.py | 28 ++++++++++++++++++++++++++++ you_get/main.py | 1 + 5 files changed, 33 insertions(+) mode change 100644 => 100755 you_get/downloader/__init__.py create mode 100755 you_get/downloader/xtube.py mode change 100644 => 100755 you_get/main.py diff --git a/README.md b/README.md index 3ceed30e..36ccb2c9 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Fork me on GitHub: * Dailymotion * Google+ * Tumblr +* Xtube * SoundCloud * Youku (优酷) * Tudou (土豆) @@ -205,6 +206,7 @@ You-Get基于优酷下载脚本[iambus/youku-lixian](https://github.com/iambus/y * Dailymotion * Google+ * Tumblr +* Xtube * SoundCloud * 优酷 * 土豆 diff --git a/README.txt b/README.txt index 272dec57..3929886e 100644 --- a/README.txt +++ b/README.txt @@ -18,6 +18,7 @@ Supported Sites (As of Now) * Dailymotion http://dailymotion.com * Google+ http://plus.google.com * Tumblr http://www.tumblr.com +* Xtube http://www.xtube.com * SoundCloud http://soundcloud.com * Youku (优酷) http://www.youku.com * Tudou (土豆) http://www.tudou.com diff --git a/you_get/downloader/__init__.py b/you_get/downloader/__init__.py old mode 100644 new mode 100755 index 2218db08..229114a0 --- a/you_get/downloader/__init__.py +++ b/you_get/downloader/__init__.py @@ -14,6 +14,7 @@ from .sina import * from .sohu import * from .soundcloud import * from .tudou import * +from .xtube import * from .tumblr import * from .vimeo import * from .w56 import * diff --git a/you_get/downloader/xtube.py b/you_get/downloader/xtube.py new file mode 100755 index 00000000..9484b939 --- /dev/null +++ b/you_get/downloader/xtube.py @@ -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'(.*)', 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') diff --git a/you_get/main.py b/you_get/main.py old mode 100644 new mode 100755 index 0a42e2c4..a7b464e3 --- a/you_get/main.py +++ b/you_get/main.py @@ -36,6 +36,7 @@ def url_to_module(url): 'sohu': sohu, 'soundcloud': soundcloud, 'tudou': tudou, + 'xtube': xtube, 'tumblr': tumblr, 'vimeo': vimeo, 'yinyuetai': yinyuetai,