diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-06-05 21:26:30 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-06-05 21:26:30 +0200 |
commit | b4f11103dc031df77117ee4cbb08f8e87305d20a (patch) | |
tree | a193e0c98f32e88a2ab09c95c6e1ad1740ff687a /module/plugins | |
parent | youtube - file extension based on fmt (diff) | |
download | pyload-b4f11103dc031df77117ee4cbb08f8e87305d20a.tar.xz |
api tester
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/Plugin.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/BasePlugin.py | 5 | ||||
-rw-r--r-- | module/plugins/hoster/YoutubeCom.py | 31 |
3 files changed, 21 insertions, 17 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 449b60a59..396069adb 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -37,7 +37,7 @@ if os.name != "nt": from itertools import islice -from module.utils import save_join, decode, removeChars +from module.utils import save_join, removeChars def chunks(iterable, size): it = iter(iterable) diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 7b3f56c4d..49bab50f1 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -20,6 +20,11 @@ class BasePlugin(Hoster): def process(self, pyfile): """main function""" + #debug part, for api exerciser + if pyfile.url.startswith("DEBUG_API"): + self.multiDL = False + return + # self.__name__ = "NetloadIn" # pyfile.name = "test" # self.html = self.load("http://localhost:9000/short") diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index ccd98606e..0e0fc2d9e 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -11,23 +11,23 @@ class YoutubeCom(Hoster): __pattern__ = r"http://(www\.)?(de\.)?\youtube\.com/watch\?v=.*" __version__ = "0.2" __config__ = [("quality", "sd;hd;fullhd", "Quality Setting", "hd"), - ("fmt", "int", "FMT Number 0-38", 0)] + ("fmt", "int", "FMT Number 0-38", 0)] __description__ = """Youtube.com Video Download Hoster""" __author_name__ = ("spoob") __author_mail__ = ("spoob@pyload.org") - formats = { 5 : (".flv", 400, 240), - 34 : (".flv", 640, 360), - 35 : (".flv", 854, 480), - 18 : (".mp4", 480, 360), - 22 : (".mp4", 1280, 720), - 37 : (".mp4", 1920, 1080), - 38 : (".mp4", 4096, 3072), - 43 : (".webm", 640, 360), - 45 : (".webm", 1280, 720), - 17 : (".3gp", 176, 144) - } - + formats = {5: (".flv", 400, 240), + 34: (".flv", 640, 360), + 35: (".flv", 854, 480), + 18: (".mp4", 480, 360), + 22: (".mp4", 1280, 720), + 37: (".mp4", 1920, 1080), + 38: (".mp4", 4096, 3072), + 43: (".webm", 640, 360), + 45: (".webm", 1280, 720), + 17: (".3gp", 176, 144) + } + def process(self, pyfile): html = self.load(pyfile.url, decode=True) @@ -60,7 +60,6 @@ class YoutubeCom(Hoster): fmt_url_map = re.search(fmt_pattern, html).group(1) links = urllib.unquote(fmt_url_map).split(",") - fmt_dict = {} for link in links: fmt = link.split("|")[0] @@ -73,13 +72,13 @@ class YoutubeCom(Hoster): self.logDebug("Found links: %s" % fmt_dict) - fmt = reduce(lambda x,y: x if abs(x-desired_fmt) <= abs(y-desired_fmt) else y, fmt_dict.keys()) + fmt = reduce(lambda x, y: x if abs(x - desired_fmt) <= abs(y - desired_fmt) else y, fmt_dict.keys()) self.logDebug("Choose fmt: %s" % fmt) file_suffix = ".flv" if fmt in self.formats: - file_suffix = self.formats[fmt][0] + file_suffix = self.formats[fmt][0] name = re.search(file_name_pattern, html).group(1).replace("/", "") + file_suffix pyfile.name = name #.replace("&", "&").replace("ö", "oe").replace("ä", "ae").replace("ü", "ue") |