diff options
| author | 2013-04-06 00:07:25 +0200 | |
|---|---|---|
| committer | 2013-04-06 00:07:25 +0200 | |
| commit | 7379731d2f26e0a45e19b8f1cc6342115a0f559c (patch) | |
| tree | 701f5e4c5103d047b702237a8d84a66edd7e054e /module/plugins/hoster/UploadedTo.py | |
| parent | parseFileSize fix (diff) | |
| parent | EgoFilesCom: fixed bug in premium downloads. (diff) | |
| download | pyload-7379731d2f26e0a45e19b8f1cc6342115a0f559c.tar.xz | |
Merge plugins from  stable.
Conflicts:
	module/plugins/internal/UnRar.py
Diffstat (limited to 'module/plugins/hoster/UploadedTo.py')
| -rw-r--r-- | module/plugins/hoster/UploadedTo.py | 53 | 
1 files changed, 29 insertions, 24 deletions
| diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index ae70b1471..739f997fe 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -10,34 +10,37 @@ from module.plugins.ReCaptcha import ReCaptcha  key = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=".decode('base64') +  def getID(url):      """ returns id from file url""" -    m = re.match(r"http://[\w\.-]*?(uploaded\.(to|net)(/file/|/?\?id=|.*?&id=)|ul\.to/)(?P<ID>\w+)", url) +    m = re.match(r"http://[\w\.-]*?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=)(?P<ID>\w+)", url)      return m.group('ID') +  def getAPIData(urls): -        post = {"apikey" : key} +    post = {"apikey": key} -        idMap = {} +    idMap = {} -        for i, url in enumerate(urls): -            id = getID(url) -            post["id_%s" % i] = id -            idMap[id] = url +    for i, url in enumerate(urls): +        id = getID(url) +        post["id_%s" % i] = id +        idMap[id] = url -        api = unicode(getURL("http://uploaded.net/api/filemultiple", post=post, decode=False), 'iso-8859-1') +    api = unicode(getURL("http://uploaded.net/api/filemultiple", post=post, decode=False), 'iso-8859-1') -        result = {} +    result = {} -        if api: -            for line in api.splitlines(): -                data = line.split(",", 4) -                if data[1] in idMap: -                    result[data[1]] = (data[0], data[2], data[4], data[3], idMap[data[1]]) +    if api: +        for line in api.splitlines(): +            data = line.split(",", 4) +            if data[1] in idMap: +                result[data[1]] = (data[0], data[2], data[4], data[3], idMap[data[1]]) -        return result +    return result -def parseFileInfo(self, url = '', html = ''): + +def parseFileInfo(self, url='', html=''):      if not html and hasattr(self, "html"): html = self.html      name, size, status, found, fileid = url, 0, 3, None, None @@ -53,6 +56,7 @@ def parseFileInfo(self, url = '', html = ''):      return name, size, status, fileid +  def getInfo(urls):      for chunk in chunks(urls, 80):          result = [] @@ -73,7 +77,7 @@ class UploadedTo(Hoster):      __name__ = "UploadedTo"      __type__ = "hoster"      __pattern__ = r"http://[\w\.-]*?(uploaded\.(to|net)(/file/|/?\?id=|.*?&id=)|ul\.to/)\w+" -    __version__ = "0.64" +    __version__ = "0.65"      __description__ = """Uploaded.net Download Hoster"""      __author_name__ = ("spoob", "mkaay", "zoidberg", "netpok", "stickell")      __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz", "netpok@gmail.com", "l.stickell@yahoo.it") @@ -87,7 +91,7 @@ class UploadedTo(Hoster):          self.multiDL = False          self.resumeDownload = False          self.url = False -        self.chunkLimit = 1 # critical problems with more chunks +        self.chunkLimit = 1  # critical problems with more chunks          if self.account:              self.premium = self.account.getAccountInfo(self.user)["premium"]              if self.premium: @@ -107,7 +111,7 @@ class UploadedTo(Hoster):          if not api:              self.logWarning("No response for API call") -            self.html = unicode(self.load(pyfile.url, decode = False), 'iso-8859-1') +            self.html = unicode(self.load(pyfile.url, decode=False), 'iso-8859-1')              name, size, status, self.fileID = parseFileInfo(self)              self.logDebug(name, size, status, self.fileID)              if status == 1: @@ -139,8 +143,9 @@ class UploadedTo(Hoster):      def handlePremium(self):          info = self.account.getAccountInfo(self.user, True) -        self.log.debug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name" :self.__name__, "left" : info["trafficleft"]/1024/1024}) -        if int(self.data[1])/1024 > info["trafficleft"]: +        self.log.debug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name": self.__name__, +                                                                            "left": info["trafficleft"] / 1024 / 1024}) +        if int(self.data[1]) / 1024 > info["trafficleft"]:              self.log.info(_("%s: Not enough traffic left" % self.__name__))              self.account.empty(self.user)              self.resetAccount() @@ -184,7 +189,7 @@ class UploadedTo(Hoster):              #self.req.lastURL = str(self.url)              re_captcha = ReCaptcha(self)              challenge, result = re_captcha.challenge(challengeId.group(1)) -            options = {"recaptcha_challenge_field" : challenge, "recaptcha_response_field": result} +            options = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": result}              self.wait()              result = self.load(url, post=options) @@ -192,13 +197,13 @@ class UploadedTo(Hoster):              if "limit-size" in result:                  self.fail("File too big for free download") -            elif "limit-slot" in result: # Temporary restriction so just wait a bit +            elif "limit-slot" in result:  # Temporary restriction so just wait a bit                  self.setWait(30 * 60, True)                  self.wait()                  self.retry()              elif "limit-parallel" in result:                  self.fail("Cannot download in parallel") -            elif self.DL_LIMIT_PATTERN in result: # limit-dl +            elif self.DL_LIMIT_PATTERN in result:  # limit-dl                  self.setWait(60 * 60, True)                  self.wait()                  self.retry() | 
