From 9ceab3d8f9fac0c37cb7b5f7c29a690cdf1abf54 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Wed, 25 Jan 2012 17:03:17 +0100 Subject: fix some hosters, disable some more --- module/plugins/hoster/WuploadCom.py | 191 ++++++++++++++++++++++++++++++++---- 1 file changed, 173 insertions(+), 18 deletions(-) (limited to 'module/plugins/hoster/WuploadCom.py') diff --git a/module/plugins/hoster/WuploadCom.py b/module/plugins/hoster/WuploadCom.py index 11b61ae59..1a0eb442b 100644 --- a/module/plugins/hoster/WuploadCom.py +++ b/module/plugins/hoster/WuploadCom.py @@ -3,10 +3,10 @@ import re import string - -from types import MethodType +from urllib import unquote from module.plugins.Hoster import Hoster +from module.plugins.ReCaptcha import ReCaptcha from module.plugins.Plugin import chunks from module.network.RequestFactory import getURL @@ -31,7 +31,7 @@ def getInfo(urls): if item["status"] != "AVAILABLE": result.append((None, 0, 1, ids[str(item["id"])])) else: - result.append((item["filename"], item["size"], 2, ids[str(item["id"])])) + result.append((unquote(item["filename"]), item["size"], 2, ids[str(item["id"])])) yield result @@ -47,7 +47,7 @@ class WuploadCom(Hoster): __name__ = "WuploadCom" __type__ = "hoster" __pattern__ = r"http://[\w\.]*?wupload\..*?/file/(([a-z][0-9]+/)?[0-9]+)(/.*)?" - __version__ = "0.1" + __version__ = "0.20" __description__ = """Wupload com""" __author_name__ = ("jeix", "paulking") __author_mail__ = ("jeix@hasnomail.de", "") @@ -63,24 +63,179 @@ class WuploadCom(Hoster): CAPTCHA_TYPE2_PATTERN = r'id="recaptcha_image"> 300: + self.wantReconnect = True + + self.setWait(wait) + self.logDebug("Waiting %d seconds." % wait) + self.wait() + + tm = re.search(self.WAIT_TM_PATTERN, self.html) + tm_hash = re.search(self.WAIT_TM_HASH_PATTERN, self.html) + + if tm and tm_hash: + tm = tm.group(1) + tm_hash = tm_hash.group(1) + self.html = self.load(url, post={"tm": tm, "tm_hash": tm_hash}) + self.handleErrors() + break + else: + self.html = self.load(url) + self.handleErrors() + waitSearch = re.search(self.WAIT_TIME_PATTERN, self.html) - module = self.core.pluginManager.getPlugin("FilesonicCom") - fs = getattr(module, "FilesonicCom") + def handleErrors(self): + if "This file is available for premium users only." in self.html: + self.fail("need premium account for file") - self.newInit = MethodType(fs.__dict__["init"], self, WuploadCom) + if "The file that you're trying to download is larger than" in self.html: + self.fail("need premium account for file") - methods = ["process", "checkFile", "downloadPremium", "downloadFree", "doWait", "handleErrors"] - #methods to bind from fs + if "Free users may only download 1 file at a time" in self.html: + self.fail("only 1 file at a time for free users") - for m in methods: - setattr(self, m, MethodType(fs.__dict__[m], self, WuploadCom)) + if "Free user can not download files" in self.html: + self.fail("need premium account for file") - self.newInit() + if "Download session in progress" in self.html: + self.fail("already downloading") + if "This file is password protected" in self.html: + self.fail("This file is password protected") - def getDomain(self): - result = json_loads( - self.load(self.API_ADDRESS + "/utility?method=getWuploadDomainForCurrentIp&format=json", decode=True)) - self.log.debug("%s: response to get domain %s" % (self.__name__, result)) - return result["FSApi_Utility"]["getWuploadDomainForCurrentIp"]["response"] \ No newline at end of file + if "An Error Occurred" in self.html: + self.fail("A server error occured.") + + if "This file was deleted" in self.html: + self.offline() -- cgit v1.2.3