diff options
Diffstat (limited to 'module/plugins/hoster')
52 files changed, 403 insertions, 398 deletions
diff --git a/module/plugins/hoster/BayfilesCom.py b/module/plugins/hoster/BayfilesCom.py index 449bb890e..272c7cd88 100644 --- a/module/plugins/hoster/BayfilesCom.py +++ b/module/plugins/hoster/BayfilesCom.py @@ -40,16 +40,16 @@ class BayfilesCom(SimpleHoster): PREMIUM_LINK_PATTERN = r'(?:<a class="highlighted-btn" href="|(?=http://s\d+\.baycdn\.com/dl/))(.*?)"' def handleFree(self): - found = re.search(self.WAIT_PATTERN, self.html) - if found: - self.wait(int(found.group(1)) * 60) + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.wait(int(m.group(1)) * 60) self.retry() # Get download token - found = re.search(self.VARS_PATTERN, self.html) - if found is None: + m = re.search(self.VARS_PATTERN, self.html) + if m is None: self.parseError('VARS') - vfid, delay = found.groups() + vfid, delay = m.groups() response = json_loads(self.load('http://bayfiles.com/ajax_download', get={ "_": time() * 1000, @@ -67,16 +67,16 @@ class BayfilesCom(SimpleHoster): "vfid": vfid}) # Get final link and download - found = re.search(self.FREE_LINK_PATTERN, self.html) - if found is None: + m = re.search(self.FREE_LINK_PATTERN, self.html) + if m is None: self.parseError("Free link") - self.startDownload(found.group(1)) + self.startDownload(m.group(1)) def handlePremium(self): - found = re.search(self.PREMIUM_LINK_PATTERN, self.html) - if found is None: + m = re.search(self.PREMIUM_LINK_PATTERN, self.html) + if m is None: self.parseError("Premium link") - self.startDownload(found.group(1)) + self.startDownload(m.group(1)) def startDownload(self, url): self.logDebug("%s URL: %s" % ("Premium" if self.premium else "Free", url)) diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index d1c0fd87e..a6336ad19 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -37,10 +37,10 @@ class BezvadataCz(SimpleHoster): def handleFree(self): #download button - found = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html) - if found is None: + m = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html) + if m is None: self.parseError("page1 URL") - url = "http://bezvadata.cz%s" % found.group(1) + url = "http://bezvadata.cz%s" % m.group(1) #captcha form self.html = self.load(url) @@ -50,14 +50,14 @@ class BezvadataCz(SimpleHoster): if not inputs: self.parseError("FreeForm") - found = re.search(r'<img src="data:image/png;base64,(.*?)"', self.html) - if found is None: + m = re.search(r'<img src="data:image/png;base64,(.*?)"', self.html) + if m is None: self.parseError("captcha img") #captcha image is contained in html page as base64encoded data but decryptCaptcha() expects image url self.load, proper_load = self.loadcaptcha, self.load try: - inputs['captcha'] = self.decryptCaptcha(found.group(1), imgtype='png') + inputs['captcha'] = self.decryptCaptcha(m.group(1), imgtype='png') finally: self.load = proper_load @@ -72,15 +72,15 @@ class BezvadataCz(SimpleHoster): #download url self.html = self.load("http://bezvadata.cz%s" % action, post=inputs) self.checkErrors() - found = re.search(r'<a class="stahnoutSoubor2" href="(.*?)">', self.html) - if found is None: + m = re.search(r'<a class="stahnoutSoubor2" href="(.*?)">', self.html) + if m is None: self.parseError("page2 URL") - url = "http://bezvadata.cz%s" % found.group(1) + url = "http://bezvadata.cz%s" % m.group(1) self.logDebug("DL URL %s" % url) #countdown - found = re.search(r'id="countdown">(\d\d):(\d\d)<', self.html) - wait_time = (int(found.group(1)) * 60 + int(found.group(2)) + 1) if found else 120 + m = re.search(r'id="countdown">(\d\d):(\d\d)<', self.html) + wait_time = (int(m.group(1)) * 60 + int(m.group(2)) + 1) if m else 120 self.wait(wait_time, False) self.download(url) diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 406b7bcd4..2cd85420d 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -23,8 +23,8 @@ class CatShareNet(SimpleHoster): def handleFree(self): - found = re.search(self.SECONDS_PATTERN, self.html) - seconds = int(found.group(1)) + m = re.search(self.SECONDS_PATTERN, self.html) + seconds = int(m.group(1)) self.logDebug("Seconds found", seconds) self.wait(seconds + 1) recaptcha = ReCaptcha(self) diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 489baaeb4..b36d59993 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -33,23 +33,23 @@ class CrockoCom(SimpleHoster): self.fail("You need Premium membership to download this file.") for _ in xrange(5): - found = re.search(self.CAPTCHA_URL_PATTERN, self.html) - if found: - url, wait_time = 'http://crocko.com' + found.group(1), found.group(2) + m = re.search(self.CAPTCHA_URL_PATTERN, self.html) + if m: + url, wait_time = 'http://crocko.com' + m.group(1), m.group(2) self.wait(wait_time) self.html = self.load(url) else: break - found = re.search(self.CAPTCHA_KEY_PATTERN, self.html) - if found is None: + m = re.search(self.CAPTCHA_KEY_PATTERN, self.html) + if m is None: self.parseError('Captcha KEY') - captcha_key = found.group(1) + captcha_key = m.group(1) - found = re.search(self.FORM_PATTERN, self.html, re.DOTALL) - if found is None: + m = re.search(self.FORM_PATTERN, self.html, re.DOTALL) + if m is None: self.parseError('ACTION') - action, form = found.groups() + action, form = m.groups() inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) recaptcha = ReCaptcha(self) diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index f66f1b5a2..c34e73ff4 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -51,17 +51,17 @@ class CzshareCom(SimpleHoster): def checkTrafficLeft(self): # check if user logged in - found = re.search(self.USER_CREDIT_PATTERN, self.html) - if found is None: + m = re.search(self.USER_CREDIT_PATTERN, self.html) + if m is None: self.account.relogin(self.user) self.html = self.load(self.pyfile.url, cookies=True, decode=True) - found = re.search(self.USER_CREDIT_PATTERN, self.html) - if found is None: + m = re.search(self.USER_CREDIT_PATTERN, self.html) + if m is None: return False # check user credit try: - credit = parseFileSize(found.group(1).replace(' ', ''), found.group(2)) + credit = parseFileSize(m.group(1).replace(' ', ''), m.group(2)) self.logInfo("Premium download for %i KiB of Credit" % (self.pyfile.size / 1024)) self.logInfo("User %s has %i KiB left" % (self.user, credit / 1024)) if credit < self.pyfile.size: @@ -88,10 +88,10 @@ class CzshareCom(SimpleHoster): def handleFree(self): # get free url - found = re.search(self.FREE_URL_PATTERN, self.html) - if found is None: + m = re.search(self.FREE_URL_PATTERN, self.html) + if m is None: self.parseError('Free URL') - parsed_url = "http://sdilej.cz" + found.group(1) + parsed_url = "http://sdilej.cz" + m.group(1) self.logDebug("PARSED_URL:" + parsed_url) # get download ticket and parse html @@ -122,16 +122,16 @@ class CzshareCom(SimpleHoster): else: self.fail("No valid captcha code entered") - found = re.search("countdown_number = (\d+);", self.html) - self.setWait(int(found.group(1)) if found else 50) + m = re.search("countdown_number = (\d+);", self.html) + self.setWait(int(m.group(1)) if m else 50) # download the file, destination is determined by pyLoad self.logDebug("WAIT URL", self.req.lastEffectiveURL) - found = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) - if found is None: + m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) + if m is None: self.parseError('Download URL') - url = "http://%s/download.php?%s" % (found.group(1), found.group(2)) + url = "http://%s/download.php?%s" % (m.group(1), m.group(2)) self.wait() self.download(url) diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index 160e8aaf5..4d39b178e 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -56,15 +56,15 @@ class DateiTo(SimpleHoster): elif data['P'] == 'IV': break - found = re.search(self.DATA_PATTERN, self.html) - if found is None: + m = re.search(self.DATA_PATTERN, self.html) + if m is None: self.parseError('data') - url = 'http://datei.to/' + found.group(1) - data = dict(x.split('=') for x in found.group(2).split('&')) + url = 'http://datei.to/' + m.group(1) + data = dict(x.split('=') for x in m.group(2).split('&')) if url.endswith('recaptcha.php'): - found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) - recaptcha_key = found.group(1) if found else "6LdBbL8SAAAAAI0vKUo58XRwDd5Tu_Ze1DA7qTao" + m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) + recaptcha_key = m.group(1) if m else "6LdBbL8SAAAAAI0vKUo58XRwDd5Tu_Ze1DA7qTao" data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge(recaptcha_key) @@ -76,16 +76,16 @@ class DateiTo(SimpleHoster): self.download(download_url) def checkErrors(self): - found = re.search(self.PARALELL_PATTERN, self.html) - if found: - found = re.search(self.WAIT_PATTERN, self.html) - wait_time = int(found.group(1)) if found else 30 + m = re.search(self.PARALELL_PATTERN, self.html) + if m: + m = re.search(self.WAIT_PATTERN, self.html) + wait_time = int(m.group(1)) if m else 30 self.wait(wait_time + 1, False) self.retry() def doWait(self): - found = re.search(self.WAIT_PATTERN, self.html) - wait_time = int(found.group(1)) if found else 30 + m = re.search(self.WAIT_PATTERN, self.html) + wait_time = int(m.group(1)) if m else 30 self.load('http://datei.to/ajax/download.php', post={'P': 'Ads'}) self.wait(wait_time + 1, False) diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 386e3694e..15e23cba7 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -59,16 +59,16 @@ class DepositfilesCom(SimpleHoster): if wait: self.setWait(int(wait.group(1))) - found = re.search(r"var fid = '(\w+)';", self.html) - if found is None: + m = re.search(r"var fid = '(\w+)';", self.html) + if m is None: self.retry(wait_time=5) - params = {'fid': found.group(1)} + params = {'fid': m.group(1)} self.logDebug("FID: %s" % params['fid']) captcha_key = '6LdRTL8SAAAAAE9UOdWZ4d0Ky-aeA7XfSqyWDM2m' - found = re.search(self.RECAPTCHA_PATTERN, self.html) - if found: - captcha_key = found.group(1) + m = re.search(self.RECAPTCHA_PATTERN, self.html) + if m: + captcha_key = m.group(1) self.logDebug("CAPTCHA_KEY: %s" % captcha_key) self.wait() @@ -86,11 +86,11 @@ class DepositfilesCom(SimpleHoster): self.logDebug(params) continue - found = re.search(self.FREE_LINK_PATTERN, self.html) - if found: + m = re.search(self.FREE_LINK_PATTERN, self.html) + if m: if 'response' in params: self.correctCaptcha() - link = unquote(found.group(1)) + link = unquote(m.group(1)) self.logDebug("LINK: %s" % link) break else: diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 7bebb62b5..5fb527136 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -46,9 +46,9 @@ class AdYouLike: def challenge(self, html): adyoulike_data_string = None - found = re.search(self.ADYOULIKE_INPUT_PATTERN, html) - if found: - adyoulike_data_string = found.group(1) + m = re.search(self.ADYOULIKE_INPUT_PATTERN, html) + if m: + adyoulike_data_string = m.group(1) else: self.plugin.fail("Can't read AdYouLike input data") @@ -61,10 +61,10 @@ class AdYouLike: "ayl_key": ayl_data[self.engine]['key'], "ayl_env": ayl_data['all']['env'], "callback": self.ADYOULIKE_CALLBACK}) - found = re.search(self.ADYOULIKE_CHALLENGE_PATTERN, res) + m = re.search(self.ADYOULIKE_CHALLENGE_PATTERN, res) challenge_string = None - if found: - challenge_string = found.group(1) + if m: + challenge_string = m.group(1) else: self.plugin.fail("Invalid AdYouLike challenge") challenge_data = json_loads(challenge_string) @@ -86,9 +86,9 @@ class AdYouLike: response = None try: instructions_visual = challenge['translations'][ayl['all']['lang']]['instructions_visual'] - found = re.search(u".*«(.*)».*", instructions_visual) - if found: - response = found.group(1).strip() + m = re.search(u".*«(.*)».*", instructions_visual) + if m: + response = m.group(1).strip() else: self.plugin.fail("Can't parse instructions visual") except KeyError: @@ -166,10 +166,10 @@ class DlFreeFr(SimpleHoster): self.load("http://dl.free.fr/getfile.pl", post=inputs) headers = self.getLastHeaders() if headers.get("code") == 302 and "set-cookie" in headers and "location" in headers: - found = re.search("(.*?)=(.*?); path=(.*?); domain=(.*?)", headers.get("set-cookie")) + m = re.search("(.*?)=(.*?); path=(.*?); domain=(.*?)", headers.get("set-cookie")) cj = CookieJar(__name__) - if found: - cj.setCookie(found.group(4), found.group(1), found.group(2), found.group(3)) + if m: + cj.setCookie(m.group(4), m.group(1), m.group(2), m.group(3)) else: self.fail("Cookie error") location = headers.get("location") diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index c753e64a1..f0715bfc7 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -43,10 +43,10 @@ class EdiskCz(SimpleHoster): self.logDebug('URL:' + url) - found = re.search(self.ACTION_PATTERN, url) - if found is None: + m = re.search(self.ACTION_PATTERN, url) + if m is None: self.parseError("ACTION") - action = found.group(1) + action = m.group(1) self.html = self.load(url, decode=True) self.getFileInfo() diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 3ec319129..5365e7312 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -61,10 +61,10 @@ class EuroshareEu(SimpleHoster): if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: self.longWait(5 * 60, 12) - found = re.search(self.FREE_URL_PATTERN, self.html) - if found is None: + m = re.search(self.FREE_URL_PATTERN, self.html) + if m is None: self.parseError("Parse error (URL)") - parsed_url = "http://euroshare.eu%s" % found.group(1) + parsed_url = "http://euroshare.eu%s" % m.group(1) self.logDebug("URL", parsed_url) self.download(parsed_url, disposition=True) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 4acbb12f8..e1fd9a666 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -48,9 +48,9 @@ class FastshareCz(SimpleHoster): if "> 100% of FREE slots are full" in self.html: self.retry(120, 60, "No free slots") - found = re.search(self.FREE_URL_PATTERN, self.html) - if found: - action, captcha_src = found.groups() + m = re.search(self.FREE_URL_PATTERN, self.html) + if m: + action, captcha_src = m.groups() else: self.parseError("Free URL") @@ -82,9 +82,9 @@ class FastshareCz(SimpleHoster): self.logWarning("Not enough traffic left") self.resetAccount() else: - found = re.search(self.PREMIUM_URL_PATTERN, self.html) - if found: - url = found.group(1) + m = re.search(self.PREMIUM_URL_PATTERN, self.html) + if m: + url = m.group(1) else: self.parseError("Premium URL") diff --git a/module/plugins/hoster/File4safeCom.py b/module/plugins/hoster/File4safeCom.py index da63316ad..bc0f20dbe 100644 --- a/module/plugins/hoster/File4safeCom.py +++ b/module/plugins/hoster/File4safeCom.py @@ -25,9 +25,9 @@ class File4safeCom(XFileSharingPro): self.header = self.req.http.header self.req.http.c.setopt(FOLLOWLOCATION, 1) - found = re.search(r"Location\s*:\s*(.*)", self.header, re.I) - if found and re.match(self.LINK_PATTERN, found.group(1)): - location = found.group(1).strip() + m = re.search(r"Location\s*:\s*(.*)", self.header, re.I) + if m and re.match(self.LINK_PATTERN, m.group(1)): + location = m.group(1).strip() self.startDownload(location) else: self.parseError("Unable to detect premium download link") diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index fadbdeb1d..8fc1ddca2 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -50,10 +50,10 @@ class FilecloudIo(SimpleHoster): def handleFree(self): data = {"ukey": self.file_info['ID']} - found = re.search(self.AB1_PATTERN, self.html) - if found is None: + m = re.search(self.AB1_PATTERN, self.html) + if m is None: self.parseError("__AB1") - data['__ab1'] = found.group(1) + data['__ab1'] = m.group(1) if not self.account: self.fail("User not logged in") @@ -76,8 +76,8 @@ class FilecloudIo(SimpleHoster): self.logDebug(response) if response['captcha']: recaptcha = ReCaptcha(self) - found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) - captcha_key = found.group(1) if found else self.RECAPTCHA_KEY + m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) + captcha_key = m.group(1) if m else self.RECAPTCHA_KEY data['ctype'] = "recaptcha" for _ in xrange(5): @@ -98,10 +98,10 @@ class FilecloudIo(SimpleHoster): if response['dl']: self.html = self.load('http://filecloud.io/download.html') - found = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) - if found is None: + m = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) + if m is None: self.parseError("Download URL") - download_url = found.group(1) + download_url = m.group(1) self.logDebug("Download URL: %s" % download_url) if "size" in self.file_info and self.file_info['size']: diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 013448b09..98a97121c 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -108,9 +108,9 @@ class FilefactoryCom(SimpleHoster): else: self.logInfo('You could enable "Direct Downloads" on http://filefactory.com/account/') html = self.load(self.pyfile.url) - found = re.search(self.LINK_PATTERN, html) - if found: - url = found.group(1) + m = re.search(self.LINK_PATTERN, html) + if m: + url = m.group(1) else: self.parseError('Unable to detect premium direct link') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index e024df6df..93488236a 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -49,15 +49,15 @@ class FilepostCom(SimpleHoster): # Find token and captcha key file_id = re.match(self.__pattern__, self.pyfile.url).group(1) - found = re.search(self.FLP_TOKEN_PATTERN, self.html) - if found is None: + m = re.search(self.FLP_TOKEN_PATTERN, self.html) + if m is None: self.parseError("Token") - flp_token = found.group(1) + flp_token = m.group(1) - found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) - if found is None: + m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) + if m is None: self.parseError("Captcha key") - captcha_key = found.group(1) + captcha_key = m.group(1) # Get wait time get_dict = {'SID': self.req.cj.getCookie('SID'), 'JsHttpRequest': str(int(time() * 10000)) + '-xml'} diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 97c931ee4..52f39bab8 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -151,10 +151,10 @@ class FileserveCom(Hoster): self.fail("Failed getting wait time") if self.__name__ == "FilejungleCom": - found = re.search(r'"waitTime":(\d+)', response) - if found is None: + m = re.search(r'"waitTime":(\d+)', response) + if m is None: self.fail("Cannot get wait time") - wait_time = int(found.group(1)) + wait_time = int(m.group(1)) else: wait_time = int(response) + 3 diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index 85354db37..6a32b5325 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -30,22 +30,22 @@ class FourSharedCom(SimpleHoster): if not self.account: self.fail("User not logged in") - found = re.search(self.DOWNLOAD_BUTTON_PATTERN, self.html) - if found: - link = found.group(1) + m = re.search(self.DOWNLOAD_BUTTON_PATTERN, self.html) + if m: + link = m.group(1) else: link = re.sub(r'/(download|get|file|document|photo|video|audio)/', r'/get/', self.pyfile.url) self.html = self.load(link) - found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) - if found is None: + m = re.search(self.DOWNLOAD_URL_PATTERN, self.html) + if m is None: self.parseError('Download link') - link = found.group(1) + link = m.group(1) try: - found = re.search(self.FID_PATTERN, self.html) - response = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % found.group(1)) + 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) except: pass diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index ec76d85b8..0b728495a 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -78,13 +78,13 @@ class FshareVn(SimpleHoster): self.checkErrors() - found = re.search(r'var count = (\d+)', self.html) - self.setWait(int(found.group(1)) if found else 30) + m = re.search(r'var count = (\d+)', self.html) + self.setWait(int(m.group(1)) if m else 30) - found = re.search(self.LINK_PATTERN, self.html) - if found is None: + m = re.search(self.LINK_PATTERN, self.html) + if m is None: self.parseError('FREE DL URL') - self.url = found.group(1) + self.url = m.group(1) self.logDebug("FREE DL URL: %s" % self.url) self.wait() @@ -97,10 +97,10 @@ class FshareVn(SimpleHoster): if '/error.php?' in self.req.lastEffectiveURL or u"Liên kết bạn chọn không tồn" in self.html: self.offline() - found = re.search(self.WAIT_PATTERN, self.html) - if found: - self.logInfo("Wait until %s ICT" % found.group(1)) - wait_until = mktime(strptime(found.group(1), "%d/%m/%Y %H:%M")) + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.logInfo("Wait until %s ICT" % m.group(1)) + wait_until = mktime(strptime(m.group(1), "%d/%m/%Y %H:%M")) self.wait(wait_until - mktime(gmtime()) - 7 * 60 * 60, True) self.retry() elif '<ul class="message-error">' in self.html: @@ -114,4 +114,4 @@ class FshareVn(SimpleHoster): }) if check == "not_found": - self.fail("File not found on server") + self.fail("File not m on server") diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index f448b99d1..07169ff2e 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -67,9 +67,9 @@ class Ftp(Hoster): self.req.http.c.setopt(pycurl.NOBODY, 0) self.logDebug(self.req.http.header) - found = re.search(r"Content-Length:\s*(\d+)", response) - if found: - pyfile.size = int(found.group(1)) + m = re.search(r"Content-Length:\s*(\d+)", response) + if m: + pyfile.size = int(m.group(1)) self.download(pyfile.url) else: #Naive ftp directory listing diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index 566d044b4..9d9825cb8 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -53,9 +53,9 @@ class GigapetaCom(SimpleHoster): "captcha": captcha, "download": "Download"}) - found = re.search(r"Location\s*:\s*(.*)", self.req.http.header, re.I) - if found: - download_url = found.group(1) + m = re.search(r"Location\s*:\s*(.*)", self.req.http.header, re.I) + if m: + download_url = m.group(1) break elif "Entered figures don`t coincide with the picture" in self.html: self.invalidCaptcha() diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index e4b508930..54f931eb2 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -46,10 +46,10 @@ class HellshareCz(SimpleHoster): if not self.checkTrafficLeft(): self.fail("Not enough traffic left for user %s." % self.user) - found = re.search(self.SHOW_WINDOW_PATTERN, self.html) - if found is None: + m = re.search(self.SHOW_WINDOW_PATTERN, self.html) + if m is None: self.parseError('SHOW WINDOW') - self.url = "http://www.hellshare.com" + found.group(1) + self.url = "http://www.hellshare.com" + m.group(1) self.logDebug("DOWNLOAD URL: " + self.url) self.download(self.url) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index a492a87ff..1a5928f17 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -99,18 +99,18 @@ class LetitbitNet(SimpleHoster): # # try: # ajax_check_url, captcha_url = re.search(self.CHECK_URL_PATTERN, self.html).groups() - # found = re.search(self.SECONDS_PATTERN, self.html) - # seconds = int(found.group(1)) if found else 60 + # m = re.search(self.SECONDS_PATTERN, self.html) + # seconds = int(m.group(1)) if m else 60 # self.wait(seconds+1) # except Exception, e: # self.logError(e) # self.parseError("page 3 / js") - found = re.search(self.SECONDS_PATTERN, self.html) - seconds = int(found.group(1)) if found else 60 + m = re.search(self.SECONDS_PATTERN, self.html) + seconds = int(m.group(1)) if m else 60 self.logDebug("Seconds found", seconds) - found = re.search(self.CAPTCHA_CONTROL_FIELD, self.html) - recaptcha_control_field = found.group(1) + m = re.search(self.CAPTCHA_CONTROL_FIELD, self.html) + recaptcha_control_field = m.group(1) self.logDebug("ReCaptcha control field found", recaptcha_control_field) self.wait(seconds + 1) diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py index 14c071cc4..af86cd026 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -62,11 +62,11 @@ class LoadTo(SimpleHoster): self.wait(m.group(1)) # Load.to is using solvemedia captchas since ~july 2014: - found = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if found is None: + m = re.search(self.SOLVEMEDIA_PATTERN, self.html) + if m is None: self.download(download_url) else: - captcha_key = found.group(1) + captcha_key = m.group(1) solvemedia = SolveMedia(self) captcha_challenge, captcha_response = solvemedia.challenge(captcha_key) self.download(download_url, post={"adcopy_challenge": captcha_challenge, "adcopy_response": captcha_response}) diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 914030f1f..3281f66e6 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -113,19 +113,19 @@ class MediafireCom(SimpleHoster): else: self.fail("No or incorrect password") - found = re.search(r'kNO = r"(http://.*?)";', self.html) - if found is None: + m = re.search(r'kNO = r"(http://.*?)";', self.html) + if m is None: self.parseError("Download URL") - download_url = found.group(1) + download_url = m.group(1) self.logDebug("DOWNLOAD LINK:", download_url) self.download(download_url) def checkCaptcha(self): for _ in xrange(5): - found = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if found: - captcha_key = found.group(1) + m = re.search(self.SOLVEMEDIA_PATTERN, self.html) + if m: + captcha_key = m.group(1) solvemedia = SolveMedia(self) captcha_challenge, captcha_response = solvemedia.challenge(captcha_key) self.html = self.load(self.url, post={"adcopy_challenge": captcha_challenge, diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index e4d9aff8b..f8fa338f3 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -60,9 +60,9 @@ class MegasharesCom(SimpleHoster): # self.fail("This file is too large for free download") # Reactivate passport if needed - found = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) - if found: - passport_num = found.group(1) + m = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) + if m: + passport_num = m.group(1) request_uri = re.search(self.REQUEST_URI_PATTERN, self.html).group(1) for _ in xrange(5): @@ -87,28 +87,28 @@ class MegasharesCom(SimpleHoster): self.fail("Failed to reactivate passport") # Check traffic left on passport - found = re.search(self.PASSPORT_LEFT_PATTERN, self.html) - if found is None: + m = re.search(self.PASSPORT_LEFT_PATTERN, self.html) + if m is None: self.fail('Passport not found') - self.logInfo("Download passport: %s" % found.group(1)) - data_left = float(found.group(2)) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[found.group(3)] - self.logInfo("Data left: %s %s (%d MB needed)" % (found.group(2), found.group(3), self.pyfile.size / 1048576)) + self.logInfo("Download passport: %s" % m.group(1)) + data_left = float(m.group(2)) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] + self.logInfo("Data left: %s %s (%d MB needed)" % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: - found = re.search(self.PASSPORT_RENEW_PATTERN, self.html) - renew = found.group(1) + found.group(2) + found.group(3) * 60 * 60 if found else 10 * 60 + m = re.search(self.PASSPORT_RENEW_PATTERN, self.html) + renew = m.group(1) + m.group(2) + m.group(3) * 60 * 60 if m else 10 * 60 self.retry(max_tries=15, wait_time=renew, reason="Unable to get passport") self.handleDownload(False) def handleDownload(self, premium=False): # Find download link; - found = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) + m = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) msg = '%s download URL' % ('Premium' if premium else 'Free') - if found is None: + if m is None: self.parseError(msg) - download_url = found.group(1) + download_url = m.group(1) self.logDebug("%s: %s" % (msg, download_url)) self.download(download_url) diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index d2f5e5856..396e207a0 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -43,17 +43,17 @@ class NarodRu(SimpleHoster): def handleFree(self): for _ in xrange(5): self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random() * 777)) - found = re.search(self.CAPTCHA_PATTERN, self.html) - if found is None: + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m is None: self.parseError('Captcha') post_data = {"action": "sendcapcha"} - captcha_url, post_data['key'] = found.groups() + captcha_url, post_data['key'] = m.groups() post_data['rep'] = self.decryptCaptcha(captcha_url) self.html = self.load(self.pyfile.url, post=post_data, decode=True) - found = re.search(self.LINK_PATTERN, self.html) - if found: - url = 'http://narod.ru' + found.group(1) + m = re.search(self.LINK_PATTERN, self.html) + if m: + url = 'http://narod.ru' + m.group(1) self.correctCaptcha() break elif u'<b class="error-msg"><strong>Ошиблись?</strong>' in self.html: diff --git a/module/plugins/hoster/NowDownloadEu.py b/module/plugins/hoster/NowDownloadEu.py index 20153d356..cf4f46805 100644 --- a/module/plugins/hoster/NowDownloadEu.py +++ b/module/plugins/hoster/NowDownloadEu.py @@ -50,9 +50,9 @@ class NowDownloadEu(SimpleHoster): if tokenlink is None or continuelink is None: self.fail('Plugin out of Date') - found = re.search(self.WAIT_PATTERN, self.html) - if found: - wait = int(found.group(1)) + m = re.search(self.WAIT_PATTERN, self.html) + if m: + wait = int(m.group(1)) else: wait = 60 diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index e43f807a2..2a98a97dc 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -40,8 +40,8 @@ class OneFichierCom(SimpleHoster): self.logInfo('You have to wait been each free download! Retrying in %d seconds.' % self.WAIT_TIME) self.waitAndRetry(self.WAIT_TIME) else: # detect parallel download - found = re.search(self.NOT_PARALLEL, self.html) - if found: + m = re.search(self.NOT_PARALLEL, self.html) + if m: self.waitAndRetry(self.RETRY_TIME) url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['id']) diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index 9cb14c1f6..45dc12929 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -57,9 +57,9 @@ class PornhubCom(Hoster): if not self.html: self.download_html() - found = re.search(r'<title[^>]+>([^<]+) - ', self.html) - if found: - name = found.group(1) + m = re.search(r'<title[^>]+>([^<]+) - ', self.html) + if m: + name = m.group(1) else: matches = re.findall('<h1>(.*?)</h1>', self.html) if len(matches) > 1: diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 9fd189829..f56daa1af 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -61,7 +61,7 @@ class QuickshareCz(SimpleHoster): check = self.checkDownload({"err": re.compile(r"\AChyba!")}, max_size=100) if check == "err": - self.fail("File not found or plugin defect") + self.fail("File not m or plugin defect") def handleFree(self): # get download url @@ -74,21 +74,21 @@ class QuickshareCz(SimpleHoster): self.header = self.req.http.header self.req.http.c.setopt(FOLLOWLOCATION, 1) - found = re.search("Location\s*:\s*(.*)", self.header, re.I) - if found is None: + m = re.search("Location\s*:\s*(.*)", self.header, re.I) + if m is None: self.fail('File not found') - download_url = found.group(1) + download_url = m.group(1) self.logDebug("FREE URL2:" + download_url) # check errors - found = re.search(r'/chyba/(\d+)', download_url) - if found: - if found.group(1) == '1': + m = re.search(r'/chyba/(\d+)', download_url) + if m: + if m.group(1) == '1': self.retry(60, 2 * 60, "This IP is already downloading") - elif found.group(1) == '2': + elif m.group(1) == '2': self.retry(60, 60, "No free slots available") else: - self.fail('Error %d' % found.group(1)) + self.fail('Error %d' % m.group(1)) # download file self.download(download_url) diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index c593a52dc..17ded3297 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -126,9 +126,9 @@ class RapidgatorNet(SimpleHoster): self.html = self.load(url) for _ in xrange(5): - found = re.search(self.LINK_PATTERN, self.html) - if found: - link = found.group(1) + m = re.search(self.LINK_PATTERN, self.html) + if m: + link = m.group(1) self.logDebug(link) self.download(link, disposition=True) break @@ -150,19 +150,19 @@ class RapidgatorNet(SimpleHoster): self.parseError("Download link") def getCaptcha(self): - found = re.search(self.ADSCAPTCHA_SRC_PATTERN, self.html) - if found: - captcha_key = found.group(1) + m = re.search(self.ADSCAPTCHA_SRC_PATTERN, self.html) + if m: + captcha_key = m.group(1) captcha = AdsCaptcha(self) else: - found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) - if found: - captcha_key = found.group(1) + m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) + if m: + captcha_key = m.group(1) captcha = ReCaptcha(self) else: - found = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if found: - captcha_key = found.group(1) + m = re.search(self.SOLVEMEDIA_PATTERN, self.html) + if m: + captcha_key = m.group(1) captcha = SolveMedia(self) else: self.parseError("Captcha") @@ -170,19 +170,19 @@ class RapidgatorNet(SimpleHoster): return captcha, captcha_key def checkFree(self): - found = re.search(self.PREMIUM_ONLY_ERROR_PATTERN, self.html) - if found: + m = re.search(self.PREMIUM_ONLY_ERROR_PATTERN, self.html) + if m: self.fail("Premium account needed for download") else: - found = re.search(self.WAIT_PATTERN, self.html) + m = re.search(self.WAIT_PATTERN, self.html) - if found: - wait_time = int(found.group(1)) * {"hour": 60, "min": 1}[found.group(2)] + if m: + wait_time = int(m.group(1)) * {"hour": 60, "min": 1}[m.group(2)] else: - found = re.search(self.DOWNLOAD_LIMIT_ERROR_PATTERN, self.html) - if found is None: + m = re.search(self.DOWNLOAD_LIMIT_ERROR_PATTERN, self.html) + if m is None: return - elif found.group(1) == "daily": + elif m.group(1) == "daily": self.logWarning("You have reached your daily downloads limit for today") wait_time = secondsToMidnight(gmt=2) else: diff --git a/module/plugins/hoster/RgHostNet.py b/module/plugins/hoster/RgHostNet.py index 0762e3bd0..80954e67b 100644 --- a/module/plugins/hoster/RgHostNet.py +++ b/module/plugins/hoster/RgHostNet.py @@ -18,10 +18,10 @@ class RgHostNet(SimpleHoster): LINK_PATTERN = r'''<a\s+href="([^"]+)"\s+class="btn\s+large\s+download"[^>]+>Download</a>''' def handleFree(self): - found = re.search(self.LINK_PATTERN, self.html) - if found is None: + m = re.search(self.LINK_PATTERN, self.html) + if m is None: self.parseError("Unable to detect the direct link") - download_link = found.group(1) + download_link = m.group(1) self.download(download_link, disposition=True) diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py index 31dd489b8..bc81f03c0 100644 --- a/module/plugins/hoster/RyushareCom.py +++ b/module/plugins/hoster/RyushareCom.py @@ -42,9 +42,9 @@ class RyushareCom(XFileSharingPro): self.setWait(1 * 60 * 60, True) retry = True - found = re.search(self.WAIT_PATTERN, self.html) - if found: - wait = found.groupdict(0) + m = re.search(self.WAIT_PATTERN, self.html) + if m: + wait = m.groupdict(0) waittime = int(wait['hour']) * 60 * 60 + int(wait['min']) * 60 + int(wait['sec']) self.setWait(waittime, True) retry = True @@ -54,11 +54,11 @@ class RyushareCom(XFileSharingPro): self.retry() for _ in xrange(5): - found = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if found is None: + m = re.search(self.SOLVEMEDIA_PATTERN, self.html) + if m is None: self.parseError("Error parsing captcha") - captchaKey = found.group(1) + captchaKey = m.group(1) captcha = SolveMedia(self) challenge, response = captcha.challenge(captchaKey) diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py index 190ae7099..ea8e8d0a0 100644 --- a/module/plugins/hoster/SendspaceCom.py +++ b/module/plugins/hoster/SendspaceCom.py @@ -40,21 +40,21 @@ class SendspaceCom(SimpleHoster): def handleFree(self): params = {} for _ in xrange(3): - found = re.search(self.LINK_PATTERN, self.html) - if found: + m = re.search(self.LINK_PATTERN, self.html) + if m: if 'captcha_hash' in params: self.correctCaptcha() - download_url = found.group(1) + download_url = m.group(1) break - found = re.search(self.CAPTCHA_PATTERN, self.html) - if found: + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m: if 'captcha_hash' in params: self.invalidCaptcha() - captcha_url1 = "http://www.sendspace.com/" + found.group(1) - found = re.search(self.USER_CAPTCHA_PATTERN, self.html) - captcha_url2 = "http://www.sendspace.com/" + found.group(1) - params = {'captcha_hash': found.group(2), + captcha_url1 = "http://www.sendspace.com/" + m.group(1) + m = re.search(self.USER_CAPTCHA_PATTERN, self.html) + captcha_url2 = "http://www.sendspace.com/" + m.group(1) + params = {'captcha_hash': m.group(2), 'captcha_submit': 'Verify', 'captcha_answer': self.decryptCaptcha(captcha_url1) + " " + self.decryptCaptcha(captcha_url2)} else: diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py index bda893a17..5f17a2f62 100644 --- a/module/plugins/hoster/ShareRapidCom.py +++ b/module/plugins/hoster/ShareRapidCom.py @@ -51,9 +51,9 @@ class ShareRapidCom(SimpleHoster): self.account.relogin(self.user) self.retry(max_tries=3, reason=str(e)) - found = re.search(self.LINK_PATTERN, self.html) - if found: - link = found.group(1) + m = re.search(self.LINK_PATTERN, self.html) + if m: + link = m.group(1) self.logDebug("Premium link: %s" % link) self.download(link, disposition=True) else: diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 246d265c5..a31b7c701 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -103,12 +103,12 @@ class ShareonlineBiz(Hoster): self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free": "1", "choice": "free"}, decode=True) self.checkErrors() - found = re.search(r'var wait=(\d+);', self.html) + m = re.search(r'var wait=(\d+);', self.html) recaptcha = ReCaptcha(self) for _ in xrange(5): challenge, response = recaptcha.challenge("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX") - self.setWait(int(found.group(1)) if found else 30) + 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, @@ -170,13 +170,13 @@ class ShareonlineBiz(Hoster): self.download(dlLink) def checkErrors(self): - found = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL) - if found is None: + m = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL) + if m is None: return - err = found.group(1) - found = re.search(self.ERROR_INFO_PATTERN, self.html) - msg = found.group(1) if found else "" + err = m.group(1) + m = re.search(self.ERROR_INFO_PATTERN, self.html) + msg = m.group(1) if m else "" self.logError(err, msg or "Unknown error occurred") if err == "invalid": diff --git a/module/plugins/hoster/SoundcloudCom.py b/module/plugins/hoster/SoundcloudCom.py index f4a81059b..75a1cffeb 100644 --- a/module/plugins/hoster/SoundcloudCom.py +++ b/module/plugins/hoster/SoundcloudCom.py @@ -19,24 +19,24 @@ class SoundcloudCom(Hoster): # default UserAgent of HTTPRequest fails for this hoster so we use this one self.req.http.c.setopt(pycurl.USERAGENT, 'Mozilla/5.0') page = self.load(pyfile.url) - found = re.search(r'<div class="haudio.*?large.*?" data-sc-track="(?P<ID>[0-9]*)"', page) + m = re.search(r'<div class="haudio.*?large.*?" data-sc-track="(?P<ID>[0-9]*)"', page) songId = clientId = "" - if found: - songId = found.group("ID") + if m: + songId = m.group("ID") if len(songId) <= 0: self.logError("Could not find song id") self.offline() else: - found = re.search(r'"clientID":"(?P<CID>.*?)"', page) - if found: - clientId = found.group("CID") + m = re.search(r'"clientID":"(?P<CID>.*?)"', page) + if m: + clientId = m.group("CID") if len(clientId) <= 0: clientId = "b45b1aa10f1ac2941910a7f0d10f8e28" - found = re.search(r'<em itemprop="name">\s(?P<TITLE>.*?)\s</em>', page) - if found: - pyfile.name = found.group("TITLE") + ".mp3" + m = re.search(r'<em itemprop="name">\s(?P<TITLE>.*?)\s</em>', page) + if m: + pyfile.name = m.group("TITLE") + ".mp3" else: pyfile.name = re.match(self.__pattern__, pyfile.url).group("SID") + ".mp3" diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 7614c0cc3..e68130389 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -63,10 +63,10 @@ class StreamCz(Hoster): if re.search(self.OFFLINE_PATTERN, self.html): self.offline() - found = re.search(self.CDN_PATTERN, self.html) - if found is None: + m = re.search(self.CDN_PATTERN, self.html) + if m is None: self.fail("Parse error (CDN)") - cdn = found.groupdict() + cdn = m.groupdict() self.logDebug(cdn) for cdnkey in ("cdnHD", "cdnHQ", "cdnLQ"): if cdnkey in cdn and cdn[cdnkey] > '': @@ -75,10 +75,10 @@ class StreamCz(Hoster): else: self.fail("Stream URL not found") - found = re.search(self.FILE_NAME_PATTERN, self.html) - if found is None: + m = re.search(self.FILE_NAME_PATTERN, self.html) + if m is None: self.fail("Parse error (NAME)") - pyfile.name = "%s-%s.%s.mp4" % (found.group(2), found.group(1), cdnkey[-2:]) + pyfile.name = "%s-%s.%s.mp4" % (m.group(2), m.group(1), cdnkey[-2:]) download_url = "http://cdn-dispatcher.stream.cz/?id=" + cdnid self.logInfo("STREAM (%s): %s" % (cdnkey[-2:], download_url)) diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py index a9b2804e4..3cbf015c9 100644 --- a/module/plugins/hoster/StreamcloudEu.py +++ b/module/plugins/hoster/StreamcloudEu.py @@ -25,9 +25,9 @@ class StreamcloudEu(XFileSharingPro): self.multiDL = True def getDownloadLink(self): - found = re.search(self.LINK_PATTERN, self.html, re.S) - if found: - return found.group(1) + m = re.search(self.LINK_PATTERN, self.html, re.S) + if m: + return m.group(1) for i in xrange(5): self.logDebug("Getting download link: #%d" % i) @@ -38,12 +38,12 @@ class StreamcloudEu(XFileSharingPro): self.html = httpRequest.load(self.pyfile.url, post=data, referer=False, cookies=True, decode=True) self.header = httpRequest.header - found = re.search("Location\s*:\s*(.*)", self.header, re.I) - if found: + m = re.search("Location\s*:\s*(.*)", self.header, re.I) + if m: break - found = re.search(self.LINK_PATTERN, self.html, re.S) - if found: + m = re.search(self.LINK_PATTERN, self.html, re.S) + if m: break else: @@ -52,7 +52,7 @@ class StreamcloudEu(XFileSharingPro): else: self.fail("Download link not found") - return found.group(1) + return m.group(1) def getPostParameters(self): for i in xrange(3): @@ -82,9 +82,9 @@ class StreamcloudEu(XFileSharingPro): self.fail("No or invalid passport") if not self.premium: - found = re.search(self.WAIT_PATTERN, self.html) - if found: - wait_time = int(found.group(1)) + 1 + m = re.search(self.WAIT_PATTERN, self.html) + if m: + wait_time = int(m.group(1)) + 1 self.setWait(wait_time, False) else: wait_time = 0 diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index 9819257c7..52708d045 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -68,9 +68,9 @@ class TurbobitNet(SimpleHoster): def solveCaptcha(self): for _ in xrange(5): - found = re.search(self.LIMIT_WAIT_PATTERN, self.html) - if found: - wait_time = int(found.group(1)) + m = re.search(self.LIMIT_WAIT_PATTERN, self.html) + if m: + wait_time = int(m.group(1)) self.wait(wait_time, wait_time > 60) self.retry() @@ -81,15 +81,15 @@ class TurbobitNet(SimpleHoster): if inputs['captcha_type'] == 'recaptcha': recaptcha = ReCaptcha(self) - found = re.search(self.CAPTCHA_KEY_PATTERN, self.html) - captcha_key = found.group(1) if found else '6LcTGLoSAAAAAHCWY9TTIrQfjUlxu6kZlTYP50_c' + m = re.search(self.CAPTCHA_KEY_PATTERN, self.html) + captcha_key = m.group(1) if m else '6LcTGLoSAAAAAHCWY9TTIrQfjUlxu6kZlTYP50_c' inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge( captcha_key) else: - found = re.search(self.CAPTCHA_SRC_PATTERN, self.html) - if found is None: + m = re.search(self.CAPTCHA_SRC_PATTERN, self.html) + if m is None: self.parseError('captcha') - captcha_url = found.group(1) + captcha_url = m.group(1) inputs['captcha_response'] = self.decryptCaptcha(captcha_url) self.logDebug(inputs) @@ -129,8 +129,8 @@ class TurbobitNet(SimpleHoster): def getDownloadUrl(self, rtUpdate): self.req.http.lastURL = self.url - found = re.search("(/\w+/timeout\.js\?\w+=)([^\"\'<>]+)", self.html) - url = "http://turbobit.net%s%s" % (found.groups() if found else ( + m = re.search("(/\w+/timeout\.js\?\w+=)([^\"\'<>]+)", self.html) + url = "http://turbobit.net%s%s" % (m.groups() if m else ( '/files/timeout.js?ver=', ''.join(random.choice('0123456789ABCDEF') for _ in xrange(32)))) fun = self.load(url) @@ -168,10 +168,10 @@ class TurbobitNet(SimpleHoster): self.downloadFile() def downloadFile(self): - found = re.search(self.LINK_PATTERN, self.html) - if found is None: + m = re.search(self.LINK_PATTERN, self.html) + if m is None: self.parseError("download link") - self.url = "http://turbobit.net" + found.group('url') + self.url = "http://turbobit.net" + m.group('url') self.logDebug(self.url) self.download(self.url) diff --git a/module/plugins/hoster/TwoSharedCom.py b/module/plugins/hoster/TwoSharedCom.py index d50248c4d..1f040dfc2 100644 --- a/module/plugins/hoster/TwoSharedCom.py +++ b/module/plugins/hoster/TwoSharedCom.py @@ -25,10 +25,10 @@ class TwoSharedCom(SimpleHoster): self.resumeDownload = self.multiDL = True def handleFree(self): - found = re.search(self.LINK_PATTERN, self.html) - if found is None: + m = re.search(self.LINK_PATTERN, self.html) + if m is None: self.parseError('Download link') - link = found.group(1) + link = m.group(1) self.logDebug("Download URL %s" % link) self.download(link) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 53494afb7..2b68bedf7 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -61,10 +61,10 @@ class UlozTo(SimpleHoster): if re.search(self.ADULT_PATTERN, self.html): self.logInfo("Adult content confirmation needed. Proceeding..") - found = re.search(self.TOKEN_PATTERN, self.html) - if found is None: + m = re.search(self.TOKEN_PATTERN, self.html) + if m is None: self.parseError('TOKEN') - token = found.group(1) + token = m.group(1) self.html = self.load(pyfile.url, get={"do": "askAgeForm-submit"}, post={"agree": "Confirm", "_token_": token}, cookies=True) @@ -132,10 +132,10 @@ class UlozTo(SimpleHoster): def findDownloadURL(self, premium=False): msg = "%s link" % ("Premium" if premium else "Free") - found = re.search(self.PREMIUM_URL_PATTERN if premium else self.FREE_URL_PATTERN, self.html) - if found is None: + m = re.search(self.PREMIUM_URL_PATTERN if premium else self.FREE_URL_PATTERN, self.html) + if m is None: self.parseError(msg) - parsed_url = "http://www.ulozto.net" + found.group(1) + parsed_url = "http://www.ulozto.net" + m.group(1) self.logDebug("%s: %s" % (msg, parsed_url)) return parsed_url diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index f2d5ce227..a77597324 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -42,30 +42,30 @@ class UloziskoSk(SimpleHoster): self.html = self.load(pyfile.url, decode=True) self.getFileInfo() - found = re.search(self.IMG_PATTERN, self.html) - if found: - url = "http://ulozisko.sk" + found.group(1) + m = re.search(self.IMG_PATTERN, self.html) + if m: + url = "http://ulozisko.sk" + m.group(1) self.download(url) else: self.handleFree() def handleFree(self): - found = re.search(self.LINK_PATTERN, self.html) - if found is None: + m = re.search(self.LINK_PATTERN, self.html) + if m is None: self.parseError('URL') - parsed_url = 'http://www.ulozisko.sk' + found.group(1) + parsed_url = 'http://www.ulozisko.sk' + m.group(1) - found = re.search(self.ID_PATTERN, self.html) - if found is None: + m = re.search(self.ID_PATTERN, self.html) + if m is None: self.parseError('ID') - id = found.group(1) + id = m.group(1) self.logDebug('URL:' + parsed_url + ' ID:' + id) - found = re.search(self.CAPTCHA_PATTERN, self.html) - if found is None: + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m is None: self.parseError('CAPTCHA') - captcha_url = 'http://www.ulozisko.sk' + found.group(1) + captcha_url = 'http://www.ulozisko.sk' + m.group(1) captcha = self.decryptCaptcha(captcha_url, cookies=True) diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 61f254476..50e4c32d0 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -45,9 +45,9 @@ class UnibytesCom(SimpleHoster): self.logDebug(action, post_data) self.html = self.load(domain + action, post=post_data) - found = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) - if found: - url = found.group(1) + m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) + if m: + url = m.group(1) break if '>Somebody else is already downloading using your IP-address<' in self.html: @@ -55,9 +55,9 @@ class UnibytesCom(SimpleHoster): self.retry() if post_data['step'] == 'last': - found = re.search(self.LINK_PATTERN, self.html) - if found: - url = found.group(1) + m = re.search(self.LINK_PATTERN, self.html) + if m: + url = m.group(1) self.correctCaptcha() break else: @@ -67,8 +67,8 @@ class UnibytesCom(SimpleHoster): action, post_data = self.parseHtmlForm('id="stepForm"') if last_step == 'timer': - found = re.search(self.WAIT_PATTERN, self.html) - self.wait(int(found.group(1)) if found else 60, False) + m = re.search(self.WAIT_PATTERN, self.html) + self.wait(int(m.group(1)) if m else 60, False) elif last_step in ("captcha", "last"): post_data['captcha'] = self.decryptCaptcha(domain + '/captcha.jpg') else: diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 2c39a5cf4..e41ae2e34 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -54,17 +54,22 @@ def getAPIData(urls): 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 + + name = url + size = 0 + fileid = None if re.search(self.OFFLINE_PATTERN, html): # File offline status = 1 else: - found = re.search(self.FILE_INFO_PATTERN, html) - if found: - name, fileid = html_unescape(found.group('N')), found.group('ID') - size = parseFileSize(found.group('S')) + m = re.search(self.FILE_INFO_PATTERN, html) + if m: + name, fileid = html_unescape(m.group('N')), m.group('ID') + size = parseFileSize(m.group('S')) status = 2 + else: + status = 3 return name, size, status, fileid @@ -163,10 +168,10 @@ class UploadedTo(Hoster): else: #Indirect download self.html = self.load("http://uploaded.net/file/%s" % self.fileID) - found = re.search(r'<div class="tfree".*\s*<form method="post" action="(.*?)"', self.html) - if found is None: - self.fail("Download URL not found. Try to enable direct downloads.") - url = found.group(1) + m = re.search(r'<div class="tfree".*\s*<form method="post" action="(.*?)"', self.html) + if m is None: + self.fail("Download URL not m. Try to enable direct downloads.") + url = m.group(1) print "Premium URL: " + url self.download(url, post={}) @@ -177,10 +182,10 @@ class UploadedTo(Hoster): self.logError("Free-download capacities exhausted.") self.retry(max_tries=24, wait_time=5 * 60) - found = re.search(r"Current waiting period: <span>(\d+)</span> seconds", self.html) - if found is None: + m = re.search(r"Current waiting period: <span>(\d+)</span> seconds", self.html) + if m is None: self.fail("File not downloadable for free users") - self.setWait(int(found.group(1))) + self.setWait(int(m.group(1))) js = self.load("http://uploaded.net/js/download.js", decode=True) diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index aefd30023..05f8e1199 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -48,18 +48,18 @@ class UploadheroCom(SimpleHoster): def handleFree(self): self.checkErrors() - found = re.search(self.CAPTCHA_PATTERN, self.html) - if found is None: + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m is None: self.parseError("Captcha URL") - captcha_url = "http://uploadhero.co" + found.group(1) + captcha_url = "http://uploadhero.co" + m.group(1) for _ in xrange(5): captcha = self.decryptCaptcha(captcha_url) self.html = self.load(self.pyfile.url, get={"code": captcha}) - found = re.search(self.FREE_URL_PATTERN, self.html) - if found: + m = re.search(self.FREE_URL_PATTERN, self.html) + if m: self.correctCaptcha() - download_url = found.group(1) or found.group(2) + download_url = m.group(1) or m.group(2) break else: self.invalidCaptcha() @@ -76,12 +76,12 @@ class UploadheroCom(SimpleHoster): self.download(link) def checkErrors(self): - found = re.search(self.IP_BLOCKED_PATTERN, self.html) - if found: - self.html = self.load("http://uploadhero.co%s" % found.group(1)) + m = re.search(self.IP_BLOCKED_PATTERN, self.html) + if m: + self.html = self.load("http://uploadhero.co%s" % m.group(1)) - found = re.search(self.IP_WAIT_PATTERN, self.html) - wait_time = (int(found.group(1)) * 60 + int(found.group(2))) if found else 5 * 60 + m = re.search(self.IP_WAIT_PATTERN, self.html) + wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 5 * 60 self.wait(wait_time, True) self.retry() diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index acb833dae..1c6583c12 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -67,11 +67,11 @@ class UploadingCom(SimpleHoster): raise Exception("Plugin defect.") def handleFree(self): - found = re.search('<h2>((Daily )?Download Limit)</h2>', self.html) - if found: - self.pyfile.error = found.group(1) + m = re.search('<h2>((Daily )?Download Limit)</h2>', self.html) + if m: + self.pyfile.error = m.group(1) self.logWarning(self.pyfile.error) - self.retry(max_tries=6, wait_time=6 * 60 * 60 if found.group(2) else 15 * 60, reason=self.pyfile.error) + self.retry(max_tries=6, wait_time=6 * 60 * 60 if m.group(2) else 15 * 60, reason=self.pyfile.error) ajax_url = "http://uploading.com/files/get/?ajax" self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) @@ -93,9 +93,9 @@ class UploadingCom(SimpleHoster): self.parseError("AJAX/URL") self.html = self.load(url) - found = re.search(r'<form id="file_form" action="(.*?)"', self.html) - if found: - url = found.group(1) + m = re.search(r'<form id="file_form" action="(.*?)"', self.html) + if m: + url = m.group(1) else: self.parseError("URL") diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py index cdb0d00ac..20a2d675a 100644 --- a/module/plugins/hoster/UptoboxCom.py +++ b/module/plugins/hoster/UptoboxCom.py @@ -42,22 +42,22 @@ class UptoboxCom(XFileSharingPro): LINK_PATTERN = r'"(https?://\w+\.uptobox\.com/d/.*?)"' def handleCaptcha(self, inputs): - found = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if found: - captcha_key = found.group(1) + m = re.search(self.SOLVEMEDIA_PATTERN, self.html) + if m: + captcha_key = m.group(1) captcha = SolveMedia(self) inputs['adcopy_challenge'], inputs['adcopy_response'] = captcha.challenge(captcha_key) return 4 else: - found = re.search(self.CAPTCHA_URL_PATTERN, self.html) - if found: - captcha_url = found.group(1) + m = re.search(self.CAPTCHA_URL_PATTERN, self.html) + if m: + captcha_url = m.group(1) inputs['code'] = self.decryptCaptcha(captcha_url) return 2 else: - found = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.DOTALL) - if found: - captcha_div = found.group(1) + m = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.DOTALL) + if m: + captcha_div = m.group(1) self.logDebug(captcha_div) numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div)) @@ -65,9 +65,9 @@ class UptoboxCom(XFileSharingPro): self.logDebug("CAPTCHA", inputs['code'], numerals) return 3 else: - found = re.search(self.RECAPTCHA_URL_PATTERN, self.html) - if found: - recaptcha_key = unquote(found.group(1)) + m = re.search(self.RECAPTCHA_URL_PATTERN, self.html) + if m: + recaptcha_key = unquote(m.group(1)) self.logDebug("RECAPTCHA KEY: %s" % recaptcha_key) recaptcha = ReCaptcha(self) inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge( diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index 33fa76d47..15cff646f 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -47,11 +47,11 @@ class VeehdCom(Hoster): if not self.html: self.download_html() - found = re.search(r'<title[^>]*>([^<]+) on Veehd</title>', self.html) - if found is None: + m = re.search(r'<title[^>]*>([^<]+) on Veehd</title>', self.html) + if m is None: self.fail("video title not found") - name = found.group(1) + name = m.group(1) # replace unwanted characters in filename if self.getConfig('filename_spaces'): @@ -67,9 +67,9 @@ class VeehdCom(Hoster): if not self.html: self.download_html() - found = re.search(r'<embed type="video/divx" src="(http://([^/]*\.)?veehd\.com/dl/[^"]+)"', + m = re.search(r'<embed type="video/divx" src="(http://([^/]*\.)?veehd\.com/dl/[^"]+)"', self.html) - if found is None: + if m is None: self.fail("embedded video url not found") - return found.group(1) + return m.group(1) diff --git a/module/plugins/hoster/VeohCom.py b/module/plugins/hoster/VeohCom.py index 472d40f01..9dbc9b8ad 100644 --- a/module/plugins/hoster/VeohCom.py +++ b/module/plugins/hoster/VeohCom.py @@ -46,10 +46,10 @@ class VeohCom(SimpleHoster): quality = ("High", "Low") for q in quality: pattern = r'"fullPreviewHash%sPath":"(.+?)"' % q - found = re.search(pattern, self.html) - if found: + m = re.search(pattern, self.html) + if m: self.pyfile.name += ".mp4" - link = found.group(1).replace("\\", "") + link = m.group(1).replace("\\", "") self.logDebug("Download link: " + link) self.download(link) return diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index d945ea758..7ad2d27c0 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -119,9 +119,9 @@ class XFileSharingPro(SimpleHoster): self.req.http.c.setopt(FOLLOWLOCATION, 1) location = None - found = re.search(r"Location\s*:\s*(.*)", self.header, re.I) - if found and re.match(self.LINK_PATTERN, found.group(1)): - location = found.group(1).strip() + m = re.search(r"Location\s*:\s*(.*)", self.header, re.I) + if m and re.match(self.LINK_PATTERN, m.group(1)): + location = m.group(1).strip() return location @@ -140,12 +140,12 @@ class XFileSharingPro(SimpleHoster): self.header = self.req.http.header self.req.http.c.setopt(FOLLOWLOCATION, 1) - found = re.search(r"Location\s*:\s*(.*)", self.header, re.I) - if found: + m = re.search(r"Location\s*:\s*(.*)", self.header, re.I) + if m: break - found = re.search(self.LINK_PATTERN, self.html, re.S) - if found: + m = re.search(self.LINK_PATTERN, self.html, re.S) + if m: break else: @@ -154,14 +154,14 @@ class XFileSharingPro(SimpleHoster): else: self.fail("Download link not found") - return found.group(1) + return m.group(1) def handlePremium(self): self.html = self.load(self.pyfile.url, post=self.getPostParameters()) - found = re.search(self.LINK_PATTERN, self.html) - if found is None: + m = re.search(self.LINK_PATTERN, self.html) + if m is None: self.parseError('DIRECT LINK') - self.startDownload(found.group(1)) + self.startDownload(m.group(1)) def handleOverriden(self): #only tested with easybytez.com @@ -190,10 +190,10 @@ class XFileSharingPro(SimpleHoster): self.fail(inputs['st']) #get easybytez.com link for uploaded file - found = re.search(self.OVR_LINK_PATTERN, self.html) - if found is None: + m = re.search(self.OVR_LINK_PATTERN, self.html) + if m is None: self.parseError('DIRECT LINK (OVR)') - self.pyfile.url = found.group(1) + self.pyfile.url = m.group(1) header = self.load(self.pyfile.url, just_header=True) if 'location' in header: # Direct link self.startDownload(self.pyfile.url) @@ -208,9 +208,9 @@ class XFileSharingPro(SimpleHoster): self.download(link, disposition=True) def checkErrors(self): - found = re.search(self.ERROR_PATTERN, self.html) - if found: - self.errmsg = found.group(1) + m = re.search(self.ERROR_PATTERN, self.html) + if m: + self.errmsg = m.group(1) self.logWarning(re.sub(r"<.*?>", " ", self.errmsg)) if 'wait' in self.errmsg: @@ -266,9 +266,9 @@ class XFileSharingPro(SimpleHoster): self.fail("No or invalid passport") if not self.premium: - found = re.search(self.WAIT_PATTERN, self.html) - if found: - wait_time = int(found.group(1)) + 1 + m = re.search(self.WAIT_PATTERN, self.html) + if m: + wait_time = int(m.group(1)) + 1 self.setWait(wait_time, False) else: wait_time = 0 @@ -300,32 +300,32 @@ class XFileSharingPro(SimpleHoster): self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN')) def handleCaptcha(self, inputs): - found = re.search(self.RECAPTCHA_URL_PATTERN, self.html) - if found: - recaptcha_key = unquote(found.group(1)) + m = re.search(self.RECAPTCHA_URL_PATTERN, self.html) + if m: + recaptcha_key = unquote(m.group(1)) self.logDebug("RECAPTCHA KEY: %s" % recaptcha_key) recaptcha = ReCaptcha(self) inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(recaptcha_key) return 1 else: - found = re.search(self.CAPTCHA_URL_PATTERN, self.html) - if found: - captcha_url = found.group(1) + m = re.search(self.CAPTCHA_URL_PATTERN, self.html) + if m: + captcha_url = m.group(1) inputs['code'] = self.decryptCaptcha(captcha_url) return 2 else: - found = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.DOTALL) - if found: - captcha_div = found.group(1) + m = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.DOTALL) + if m: + captcha_div = m.group(1) self.logDebug(captcha_div) numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div)) inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))]) self.logDebug("CAPTCHA", inputs['code'], numerals) return 3 else: - found = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if found: - captcha_key = found.group(1) + m = re.search(self.SOLVEMEDIA_PATTERN, self.html) + if m: + captcha_key = m.group(1) captcha = SolveMedia(self) inputs['adcopy_challenge'], inputs['adcopy_response'] = captcha.challenge(captcha_key) return 4 diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index 278758053..44a67ec0c 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -37,11 +37,11 @@ class YibaishiwuCom(SimpleHoster): def handleFree(self): - found = re.search(self.LINK_PATTERN, self.html) - if found is None: + m = re.search(self.LINK_PATTERN, self.html) + if m is None: self.parseError("AJAX URL") - url = found.group(1) - self.logDebug(('FREEUSER' if found.group(2) == 'download' else 'GUEST') + ' URL', url) + 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: @@ -51,9 +51,9 @@ class YibaishiwuCom(SimpleHoster): else: mirrors = None - for m in mirrors: + for mr in mirrors: try: - url = m['url'].replace("\\", "") + url = mr['url'].replace("\\", "") self.logDebug("Trying URL: " + url) self.download(url) break |