diff options
| author | 2014-11-10 00:19:51 +0100 | |
|---|---|---|
| committer | 2014-11-10 00:19:51 +0100 | |
| commit | c9e31d875d32de31e54959b82bc35eff2b3e0f3f (patch) | |
| tree | 5022eadf2ac5c65ba075f172af873b737310ed66 /module/plugins/hoster | |
| parent | [Keep2shareCc] Fix account __name__ (diff) | |
| download | pyload-c9e31d875d32de31e54959b82bc35eff2b3e0f3f.tar.xz | |
Code cosmetics
Diffstat (limited to 'module/plugins/hoster')
| -rw-r--r-- | module/plugins/hoster/BayfilesCom.py | 12 | ||||
| -rw-r--r-- | module/plugins/hoster/BitshareCom.py | 38 | ||||
| -rw-r--r-- | module/plugins/hoster/CzshareCom.py | 4 | ||||
| -rw-r--r-- | module/plugins/hoster/ExtabitCom.py | 8 | ||||
| -rw-r--r-- | module/plugins/hoster/FilecloudIo.py | 24 | ||||
| -rw-r--r-- | module/plugins/hoster/FilesMailRu.py | 8 | ||||
| -rw-r--r-- | module/plugins/hoster/FileserveCom.py | 52 | ||||
| -rw-r--r-- | module/plugins/hoster/FourSharedCom.py | 4 | ||||
| -rw-r--r-- | module/plugins/hoster/Ftp.py | 8 | ||||
| -rw-r--r-- | module/plugins/hoster/LetitbitNet.py | 27 | ||||
| -rw-r--r-- | module/plugins/hoster/MegaDebridEu.py | 12 | ||||
| -rw-r--r-- | module/plugins/hoster/MegasharesCom.py | 4 | ||||
| -rw-r--r-- | module/plugins/hoster/NetloadIn.py | 10 | ||||
| -rw-r--r-- | module/plugins/hoster/RPNetBiz.py | 24 | ||||
| -rw-r--r-- | module/plugins/hoster/RapidgatorNet.py | 10 | ||||
| -rw-r--r-- | module/plugins/hoster/RapidshareCom.py | 8 | ||||
| -rw-r--r-- | module/plugins/hoster/ShareonlineBiz.py | 24 | ||||
| -rw-r--r-- | module/plugins/hoster/UploadingCom.py | 15 | ||||
| -rw-r--r-- | module/plugins/hoster/YibaishiwuCom.py | 10 | 
19 files changed, 154 insertions, 148 deletions
diff --git a/module/plugins/hoster/BayfilesCom.py b/module/plugins/hoster/BayfilesCom.py index 06a2c4fc6..24c86f5be 100644 --- a/module/plugins/hoster/BayfilesCom.py +++ b/module/plugins/hoster/BayfilesCom.py @@ -41,18 +41,18 @@ class BayfilesCom(SimpleHoster):              self.error(_("VARS_PATTERN not found"))          vfid, delay = m.groups() -        response = json_loads(self.load('http://bayfiles.com/ajax_download', get={ -            "_": time() * 1000, -            "action": "startTimer", -            "vfid": vfid}, decode=True)) +        res = json_loads(self.load('http://bayfiles.com/ajax_download', +                         get={"_": time() * 1000, +                              "action": "startTimer", +                              "vfid": vfid}, decode=True)) -        if not "token" in response or not response['token']: +        if not "token" in res or not res['token']:              self.fail(_("No token"))          self.wait(int(delay))          self.html = self.load('http://bayfiles.com/ajax_download', get={ -            "token": response['token'], +            "token": res['token'],              "action": "getLink",              "vfid": vfid}) diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index b2fe2c48a..35aff7c1e 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -90,10 +90,10 @@ class BitshareCom(SimpleHoster):          # Get download info          self.logDebug("Getting download info") -        response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", -                             post={"request": "generateID", "ajaxid": self.ajaxid}) -        self.handleErrors(response, ':') -        parts = response.split(":") +        res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", +                        post={"request": "generateID", "ajaxid": self.ajaxid}) +        self.handleErrors(res, ':') +        parts = res.split(":")          filetype = parts[0]          wait = int(parts[1])          captcha = int(parts[2]) @@ -116,37 +116,37 @@ class BitshareCom(SimpleHoster):              # Try up to 3 times              for i in xrange(3):                  challenge, code = recaptcha.challenge() -                response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", +                res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",                                       post={"request": "validateCaptcha", "ajaxid": self.ajaxid,                                             "recaptcha_challenge_field": challenge, "recaptcha_response_field": code}) -                if self.handleCaptchaErrors(response): +                if self.handleCaptchaErrors(res):                      break          # Get download URL          self.logDebug("Getting download url") -        response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", -                             post={"request": "getDownloadURL", "ajaxid": self.ajaxid}) -        self.handleErrors(response, '#') -        url = response.split("#")[-1] +        res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", +                        post={"request": "getDownloadURL", "ajaxid": self.ajaxid}) +        self.handleErrors(res, '#') +        url = res.split("#")[-1]          return url -    def handleErrors(self, response, separator): -        self.logDebug("Checking response [%s]" % response) -        if "ERROR:Session timed out" in response: +    def handleErrors(self, res, separator): +        self.logDebug("Checking response [%s]" % res) +        if "ERROR:Session timed out" in res:              self.retry() -        elif "ERROR" in response: -            msg = response.split(separator)[-1] +        elif "ERROR" in res: +            msg = res.split(separator)[-1]              self.fail(msg) -    def handleCaptchaErrors(self, response): -        self.logDebug("Result of captcha resolving [%s]" % response) -        if "SUCCESS" in response: +    def handleCaptchaErrors(self, res): +        self.logDebug("Result of captcha resolving [%s]" % res) +        if "SUCCESS" in res:              self.correctCaptcha()              return True -        elif "ERROR:SESSION ERROR" in response: +        elif "ERROR:SESSION ERROR" in res:              self.retry()          self.invalidCaptcha() diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 76efda3b9..72f1bb45d 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -58,7 +58,7 @@ class CzshareCom(SimpleHoster):                  return False          except Exception, e:              # let's continue and see what happens... -            self.logError(str(e)) +            self.logError(e)          return True @@ -69,7 +69,7 @@ class CzshareCom(SimpleHoster):              form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1)              inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))          except Exception, e: -            self.logError(str(e)) +            self.logError(e)              self.resetAccount()          # download the file, destination is determined by pyLoad diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 1cfddd64d..fc38a79a9 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -52,8 +52,8 @@ class ExtabitCom(SimpleHoster):              for _i in xrange(5):                  get_data = {"type": "recaptcha"}                  get_data['challenge'], get_data['capture'] = recaptcha.challenge(captcha_key) -                response = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) -                if "ok" in response: +                res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) +                if "ok" in res:                      self.correctCaptcha()                      break                  else: @@ -63,10 +63,10 @@ class ExtabitCom(SimpleHoster):          else:              self.error(_("Captcha")) -        if not "href" in response: +        if not "href" in res:              self.error(_("Bad JSON response")) -        self.html = self.load("http://extabit.com/file/%s%s" % (fileID, response['href'])) +        self.html = self.load("http://extabit.com/file/%s%s" % (fileID, res['href']))          m = re.search(self.LINK_PATTERN, self.html)          if m is None: diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index f31be155d..819a7faf3 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -64,26 +64,26 @@ class FilecloudIo(SimpleHoster):              self.retry(2)          json_url = "http://filecloud.io/download-request.json" -        response = self.load(json_url, post=data) -        self.logDebug(response) -        response = json_loads(response) +        res = self.load(json_url, post=data) +        self.logDebug(res) +        res = json_loads(res) -        if "error" in response and response['error']: -            self.fail(response) +        if "error" in res and res['error']: +            self.fail(res) -        self.logDebug(response) -        if response['captcha']: +        self.logDebug(res) +        if res['captcha']:              data['ctype'] = "recaptcha"              for _i in xrange(5):                  data['recaptcha_challenge'], data['recaptcha_response'] = recaptcha.challenge(captcha_key)                  json_url = "http://filecloud.io/download-request.json" -                response = self.load(json_url, post=data) -                self.logDebug(response) -                response = json_loads(response) +                res = self.load(json_url, post=data) +                self.logDebug(res) +                res = json_loads(res) -                if "retry" in response and response['retry']: +                if "retry" in res and res['retry']:                      self.invalidCaptcha()                  else:                      self.correctCaptcha() @@ -91,7 +91,7 @@ class FilecloudIo(SimpleHoster):              else:                  self.fail(_("Incorrect captcha")) -        if response['dl']: +        if res['dl']:              self.html = self.load('http://filecloud.io/download.html')              m = re.search(self.LINK_PATTERN % self.info['ID'], self.html) diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index fda67a554..92ff5a02a 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -11,15 +11,15 @@ def getInfo(urls):      result = []      for chunk in chunks(urls, 10):          for url in chunk: -            src = getURL(url) -            if r'<div class="errorMessage mb10">' in src: +            html = getURL(url) +            if r'<div class="errorMessage mb10">' in html:                  result.append((url, 0, 1, url)) -            elif r'Page cannot be displayed' in src: +            elif r'Page cannot be displayed' in html:                  result.append((url, 0, 1, url))              else:                  try:                      url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' -                    file_name = re.search(url_pattern, src).group(0).split(', event)">')[1].split('</a>')[0] +                    file_name = re.search(url_pattern, html).group(0).split(', event)">')[1].split('</a>')[0]                      result.append((file_name, 0, 2, url))                  except:                      pass diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 9707090a4..2266e49b0 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -108,9 +108,9 @@ class FileserveCom(Hoster):              self.error(_("Unknown server response"))          # show download link -        response = self.load(self.url, post={"downloadLink": "show"}, decode=True) -        self.logDebug("Show downloadLink response : %s" % response) -        if "fail" in response: +        res = self.load(self.url, post={"downloadLink": "show"}, decode=True) +        self.logDebug("Show downloadLink response: %s" % res) +        if "fail" in res:              self.error(_("Couldn't retrieve download url"))          # this may either download our file or forward us to an error page @@ -136,19 +136,19 @@ class FileserveCom(Hoster):      def doTimmer(self): -        response = self.load(self.url, post={"downloadLink": "wait"}, decode=True) -        self.logDebug("Wait response : %s" % response[:80]) +        res = self.load(self.url, post={"downloadLink": "wait"}, decode=True) +        self.logDebug("Wait response: %s" % res[:80]) -        if "fail" in response: +        if "fail" in res:              self.fail(_("Failed getting wait time"))          if self.__name__ == "FilejungleCom": -            m = re.search(r'"waitTime":(\d+)', response) +            m = re.search(r'"waitTime":(\d+)', res)              if m is None:                  self.fail(_("Cannot get wait time"))              wait_time = int(m.group(1))          else: -            wait_time = int(response) + 3 +            wait_time = int(res) + 3          self.setWait(wait_time)          self.wait() @@ -160,11 +160,11 @@ class FileserveCom(Hoster):          for _i in xrange(5):              challenge, code = recaptcha.challenge(captcha_key) -            response = json_loads(self.load(self.URLS[2], -                                            post={'recaptcha_challenge_field': challenge, -                                                  'recaptcha_response_field': code, -                                                  'recaptcha_shortencode_field': self.file_id})) -            if not response['success']: +            res = json_loads(self.load(self.URLS[2], +                                       post={'recaptcha_challenge_field': challenge, +                                             'recaptcha_response_field': code, +                                             'recaptcha_shortencode_field': self.file_id})) +            if not res['success']:                  self.invalidCaptcha()              else:                  self.correctCaptcha() @@ -184,23 +184,23 @@ class FileserveCom(Hoster):          premium_url = None          if self.__name__ == "FileserveCom":              #try api download -            response = self.load("http://app.fileserve.com/api/download/premium/", -                                 post={"username": self.user, -                                       "password": self.account.getAccountData(self.user)['password'], -                                       "shorten": self.file_id}, -                                 decode=True) -            if response: -                response = json_loads(response) -                if response['error_code'] == "302": -                    premium_url = response['next'] -                elif response['error_code'] in ["305", "500"]: +            res = self.load("http://app.fileserve.com/api/download/premium/", +                            post={"username": self.user, +                                  "password": self.account.getAccountData(self.user)['password'], +                                  "shorten": self.file_id}, +                            decode=True) +            if res: +                res = json_loads(res) +                if res['error_code'] == "302": +                    premium_url = res['next'] +                elif res['error_code'] in ["305", "500"]:                      self.tempOffline() -                elif response['error_code'] in ["403", "605"]: +                elif res['error_code'] in ["403", "605"]:                      self.resetAccount() -                elif response['error_code'] in ["606", "607", "608"]: +                elif res['error_code'] in ["606", "607", "608"]:                      self.offline()                  else: -                    self.logError(response['error_code'], response['error_message']) +                    self.logError(res['error_code'], res['error_message'])          self.download(premium_url or self.pyfile.url) diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index fc082f66c..e1fcdab26 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -49,8 +49,8 @@ class FourSharedCom(SimpleHoster):          try:              m = re.search(self.FID_PATTERN, self.html) -            response = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1)) -            self.logDebug(response) +            res = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1)) +            self.logDebug(res)          except:              pass diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 5b8ed1ab8..9f79d80b5 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -53,14 +53,14 @@ class Ftp(Hoster):          self.req.http.c.setopt(pycurl.NOBODY, 1)          try: -            response = self.load(pyfile.url) +            res = self.load(pyfile.url)          except pycurl.error, e:              self.fail(_("Error %d: %s") % e.args)          self.req.http.c.setopt(pycurl.NOBODY, 0)          self.logDebug(self.req.http.header) -        m = re.search(r"Content-Length:\s*(\d+)", response) +        m = re.search(r"Content-Length:\s*(\d+)", res)          if m:              pyfile.size = int(m.group(1))              self.download(pyfile.url) @@ -71,8 +71,8 @@ class Ftp(Hoster):                  pkgname = "/".join(pyfile.package().name, urlparse(pyfile.url).path.rpartition('/')[2])                  pyfile.url += '/'                  self.req.http.c.setopt(48, 1)  # CURLOPT_DIRLISTONLY -                response = self.load(pyfile.url, decode=False) -                links = [pyfile.url + quote(x) for x in response.splitlines()] +                res = self.load(pyfile.url, decode=False) +                links = [pyfile.url + quote(x) for x in res.splitlines()]                  self.logDebug("LINKS", links)                  self.core.api.addPackage(pkgname, links)              else: diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index aacd74f7a..a1a812de4 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -86,31 +86,32 @@ class LetitbitNet(SimpleHoster):          self.logDebug("ReCaptcha control field found", recaptcha_control_field)          self.wait(seconds) -        response = self.load("http://letitbit.net/ajax/download3.php", post=" ", cookies=True) -        if response != '1': +        res = self.load("http://letitbit.net/ajax/download3.php", post=" ", cookies=True) +        if res != '1':              self.error(_("Unknown response - ajax_check_url")) -        self.logDebug(response) +        self.logDebug(res)          recaptcha = ReCaptcha(self)          challenge, response = recaptcha.challenge() -        post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, +        post_data = {"recaptcha_challenge_field": challenge, +                     "recaptcha_response_field": response,                       "recaptcha_control_field": recaptcha_control_field}          self.logDebug("Post data to send", post_data) -        response = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True) -        self.logDebug(response) -        if not response: +        res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True) +        self.logDebug(res) +        if not res:              self.invalidCaptcha() -        if response == "error_free_download_blocked": +        if res == "error_free_download_blocked":              self.logWarning(_("Daily limit reached"))              self.wait(secondsToMidnight(gmt=2), True) -        if response == "error_wrong_captcha": +        if res == "error_wrong_captcha":              self.invalidCaptcha()              self.retry() -        elif response.startswith('['): -            urls = json_loads(response) -        elif response.startswith('http://'): -            urls = [response] +        elif res.startswith('['): +            urls = json_loads(res) +        elif res.startswith('http://'): +            urls = [res]          else:              self.error(_("Unknown response - captcha check")) diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index b9e4d38c5..4d1e1bcb7 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -57,10 +57,10 @@ class MegaDebridEu(Hoster):          user, data = self.account.selectAccount()          jsonResponse = self.load(self.API_URL,                                   get={'action': 'connectUser', 'login': user, 'password': data['password']}) -        response = json_loads(jsonResponse) +        res = json_loads(jsonResponse) -        if response['response_code'] == "ok": -            self.token = response['token'] +        if res['response_code'] == "ok": +            self.token = res['token']              return True          else:              return False @@ -73,10 +73,10 @@ class MegaDebridEu(Hoster):          """          jsonResponse = self.load(self.API_URL, get={'action': 'getLink', 'token': self.token},                                   post={"link": linkToDebrid}) -        response = json_loads(jsonResponse) +        res = json_loads(jsonResponse) -        if response['response_code'] == "ok": -            debridedLink = response['debridLink'][1:-1] +        if res['response_code'] == "ok": +            debridedLink = res['debridLink'][1:-1]              return debridedLink          else:              self.exitOnFail("Unable to debrid %s" % linkToDebrid) diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 486ff2b37..6b1472dd8 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -63,9 +63,9 @@ class MegasharesCom(SimpleHoster):                         "&rsargs[]=%s&rsargs[]=%s&rsargs[]=%s" % (verifyinput, random_num, passport_num) +                         "&rsargs[]=replace_sec_pprenewal&rsrnd=%s" % str(int(time() * 1000)))                  self.logDebug(url) -                response = self.load(url) +                res = self.load(url) -                if 'Thank you for reactivating your passport.' in response: +                if 'Thank you for reactivating your passport.' in res:                      self.correctCaptcha()                      self.retry()                  else: diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index bfa1cc932..549ecb667 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -110,18 +110,18 @@ class NetloadIn(Hoster):              return          apiurl = "http://api.netload.in/info.php" -        src = self.load(apiurl, cookies=False, +        html = self.load(apiurl, cookies=False,                          get={"file_id": match.group(1), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1",                               "md5": "1"}, decode=True).strip() -        if not src and n <= 3: +        if not html and n <= 3:              sleep(0.2)              self.download_api_data(n + 1)              return -        self.logDebug("APIDATA: " + src) +        self.logDebug("APIDATA: " + html)          self.api_data = {} -        if src and ";" in src and src not in ("unknown file_data", "unknown_server_data", "No input file specified."): -            lines = src.split(";") +        if html and ";" in html and html not in ("unknown file_data", "unknown_server_data", "No input file specified."): +            lines = html.split(";")              self.api_data['exists'] = True              self.api_data['fileid'] = lines[0]              self.api_data['filename'] = lines[1] diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index f179db13a..c1e536d39 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -35,12 +35,14 @@ class RPNetBiz(Hoster):              self.logDebug("Original URL: %s" % pyfile.url)              # Get the download link -            response = self.load("https://premium.rpnet.biz/client_api.php", -                                 get={"username": user, "password": data['password'], -                                      "action": "generate", "links": pyfile.url}) +            res = self.load("https://premium.rpnet.biz/client_api.php", +                            get={"username": user, +                                 "password": data['password'], +                                 "action": "generate", +                                 "links": pyfile.url}) -            self.logDebug("JSON data: %s" % response) -            link_status = json_loads(response)['links'][0]  # get the first link... since we only queried one +            self.logDebug("JSON data: %s" % res) +            link_status = json_loads(res)['links'][0]  # get the first link... since we only queried one              # Check if we only have an id as a HDD link              if 'id' in link_status: @@ -53,11 +55,13 @@ class RPNetBiz(Hoster):                  my_try = 0                  while (my_try <= max_tries):                      self.logDebug("Try: %d ; Max Tries: %d" % (my_try, max_tries)) -                    response = self.load("https://premium.rpnet.biz/client_api.php", -                                         get={"username": user, "password": data['password'], -                                              "action": "downloadInformation", "id": link_status['id']}) -                    self.logDebug("JSON data hdd query: %s" % response) -                    download_status = json_loads(response)['download'] +                    res = self.load("https://premium.rpnet.biz/client_api.php", +                                    get={"username": user, +                                         "password": data['password'], +                                         "action": "downloadInformation", +                                         "id": link_status['id']}) +                    self.logDebug("JSON data hdd query: %s" % res) +                    download_status = json_loads(res)['download']                      if download_status['status'] == '100':                          link_status['generated'] = download_status['rpnet_link'] diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 61141416a..11d318333 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -67,7 +67,7 @@ class RapidgatorNet(SimpleHoster):              msg = json['response_details']          except BadHeader, e: -            self.logError("API: %s" % cmd, str(e), "SID: %s" % self.sid) +            self.logError("API: %s" % cmd, e, "SID: %s" % self.sid)              status = e.code              msg = e @@ -189,11 +189,11 @@ class RapidgatorNet(SimpleHoster):      def getJsonResponse(self, url): -        response = self.load(url, decode=True) -        if not response.startswith('{'): +        res = self.load(url, decode=True) +        if not res.startswith('{'):              self.retry() -        self.logDebug(url, response) -        return json_loads(response) +        self.logDebug(url, res) +        return json_loads(res)  getInfo = create_getInfo(RapidgatorNet) diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index 2a81108cd..4ec5af67a 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -144,11 +144,11 @@ class RapidshareCom(Hoster):              return          api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"          api_param_file = {"sub": "checkfiles", "incmd5": "1", "files": self.id, "filenames": self.name} -        src = self.load(api_url_base, cookies=False, get=api_param_file).strip() -        self.logDebug("RS INFO API: %s" % src) -        if src.startswith("ERROR"): +        html = self.load(api_url_base, cookies=False, get=api_param_file).strip() +        self.logDebug("RS INFO API: %s" % html) +        if html.startswith("ERROR"):              return -        fields = src.split(",") +        fields = html.split(",")          # status codes:          #   0=File not found diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 2f4b04ce2..78a27558b 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -18,9 +18,9 @@ def getInfo(urls):      for chunk in chunks(urls, 90):          api_param_file = {"links": "\n".join(x.replace("http://www.share-online.biz/dl/", "").rstrip("/") for x in                                               chunk)}  # api only supports old style links -        src = getURL(api_url_base, post=api_param_file, decode=True) +        html = getURL(api_url_base, post=api_param_file, decode=True)          result = [] -        for i, res in enumerate(src.split("\n")): +        for i, res in enumerate(html.split("\n")):              if not res:                  continue              fields = res.split(";") @@ -77,9 +77,9 @@ class ShareonlineBiz(Hoster):      def loadAPIData(self):          api_url_base = "http://api.share-online.biz/linkcheck.php?md5=1"          api_param_file = {"links": self.file_id}  #: api only supports old style links -        src = self.load(api_url_base, cookies=False, post=api_param_file, decode=True) +        html = self.load(api_url_base, cookies=False, post=api_param_file, decode=True) -        fields = src.split(";") +        fields = html.split(";")          self.api_data = {"fileid": fields[0],                           "status": fields[1]}          if not self.api_data['status'] == "OK": @@ -108,12 +108,12 @@ class ShareonlineBiz(Hoster):          for _i in xrange(5):              challenge, response = recaptcha.challenge("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX")              self.setWait(int(m.group(1)) if m else 30) -            response = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), post={ -                'dl_free': '1', -                'recaptcha_challenge_field': challenge, -                'recaptcha_response_field': response}) +            res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), +                            post={'dl_free': '1', +                                  'recaptcha_challenge_field': challenge, +                                  'recaptcha_response_field': response}) -            if not response == '0': +            if not res == '0':                  self.correctCaptcha()                  break              else: @@ -122,7 +122,7 @@ class ShareonlineBiz(Hoster):              self.invalidCaptcha()              self.fail(_("No valid captcha solution received")) -        download_url = response.decode("base64") +        download_url = res.decode("base64")          if not download_url.startswith("http://"):              self.error(_("Wrong download url")) @@ -145,12 +145,12 @@ class ShareonlineBiz(Hoster):      def handlePremium(self):  #: should be working better loading (account) api internally          self.account.getAccountInfo(self.user, True) -        src = self.load("http://api.share-online.biz/account.php", +        html = self.load("http://api.share-online.biz/account.php",                          {"username": self.user, "password": self.account.accounts[self.user]['password'],                           "act": "download", "lid": self.file_id})          self.api_data = dlinfo = {} -        for line in src.splitlines(): +        for line in html.splitlines():              key, value = line.split(": ")              dlinfo[key.lower()] = value diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index be9b2bc00..5510326d1 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -70,18 +70,19 @@ class UploadingCom(SimpleHoster):          self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])          self.req.http.lastURL = self.pyfile.url -        response = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['ID']})) -        if 'answer' in response and 'wait_time' in response['answer']: -            wait_time = int(response['answer']['wait_time']) +        res = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['ID']})) + +        if 'answer' in res and 'wait_time' in res['answer']: +            wait_time = int(res['answer']['wait_time'])              self.logInfo(_("Waiting %d seconds") % wait_time)              self.wait(wait_time)          else:              self.error(_("No AJAX/WAIT")) -        response = json_loads( -            self.load(ajax_url, post={'action': 'get_link', 'code': self.info['ID'], 'pass': 'false'})) -        if 'answer' in response and 'link' in response['answer']: -            url = response['answer']['link'] +        res = json_loads(self.load(ajax_url, post={'action': 'get_link', 'code': self.info['ID'], 'pass': 'false'})) + +        if 'answer' in res and 'link' in res['answer']: +            url = res['answer']['link']          else:              self.error(_("No AJAX/URL")) diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index bed1d71ad..3b4692933 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -32,11 +32,11 @@ class YibaishiwuCom(SimpleHoster):          url = m.group(1)          self.logDebug(('FREEUSER' if m.group(2) == 'download' else 'GUEST') + ' URL', url) -        response = json_loads(self.load("http://115.com" + url, decode=False)) -        if "urls" in response: -            mirrors = response['urls'] -        elif "data" in response: -            mirrors = response['data'] +        res = json_loads(self.load("http://115.com" + url, decode=False)) +        if "urls" in res: +            mirrors = res['urls'] +        elif "data" in res: +            mirrors = res['data']          else:              mirrors = None  | 
