diff options
Diffstat (limited to 'module/plugins/hoster')
104 files changed, 858 insertions, 863 deletions
diff --git a/module/plugins/hoster/AndroidfilehostCom.py b/module/plugins/hoster/AndroidfilehostCom.py index 3fb77f83e..38f3b8392 100644 --- a/module/plugins/hoster/AndroidfilehostCom.py +++ b/module/plugins/hoster/AndroidfilehostCom.py @@ -42,7 +42,7 @@ class AndroidfilehostCom(SimpleHoster): self.log_debug("Waiting time: %s seconds" % wait.group(1)) fid = re.search(r'id="fid" value="(\d+)" />', self.html).group(1) - self.log_debug("fid: %s" % fid) + self.log_debug("FID: %s" % fid) html = self.load("https://www.androidfilehost.com/libs/otf/mirrors.otf.php", post={'submit': 'submit', diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 2e9ae4e48..1952309fe 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -12,7 +12,7 @@ from module.plugins.internal.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.45" + __version__ = "0.46" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -23,18 +23,6 @@ class BasePlugin(Hoster): ("Walter Purcaro", "vuolter@gmail.com")] - @classmethod - def get_info(cls, url="", html=""): #@TODO: Move to hoster class in 0.4.10 - url = urllib.unquote(url) - url_p = urlparse.urlparse(url) - return {'name' : (url_p.path.split('/')[-1] - or url_p.query.split('=', 1)[::-1][0].split('&', 1)[0] - or url_p.netloc.split('.', 1)[0]), - 'size' : 0, - 'status': 3 if url else 8, - 'url' : url} - - def setup(self): self.chunk_limit = -1 self.multiDL = True @@ -45,48 +33,48 @@ class BasePlugin(Hoster): """ Main function """ + netloc = urlparse.urlparse(pyfile.url).netloc + pyfile.name = self.get_info(pyfile.url)['name'] if not pyfile.url.startswith("http"): self.fail(_("No plugin matched")) - for _i in xrange(5): - try: - link = self.direct_link(urllib.unquote(pyfile.url)) + try: + link = self.direct_link(urllib.unquote(pyfile.url)) - if link: - self.download(link, ref=False, disposition=True) - else: - self.fail(_("File not found")) + if link: + self.download(link, ref=False, disposition=True) + else: + self.fail(_("File not found")) - except BadHeader, e: - if e.code == 404: - self.offline() + except BadHeader, e: + if e.code == 404: + self.offline() - elif e.code in (401, 403): - self.log_debug("Auth required", "Received HTTP status code: %d" % e.code) + elif e.code in (401, 403): + self.log_debug("Auth required", "Received HTTP status code: %d" % e.code) - account = self.pyload.accountManager.getAccountPlugin('Http') - servers = [x['login'] for x in account.getAllAccounts()] #@TODO: Recheck in 0.4.10 - server = urlparse.urlparse(pyfile.url).netloc + #@TODO: Recheck in 0.4.10 + if self.account: + servers = [x['login'] for x in self.account.getAllAccounts()] + else: + servers = [] + + if netloc in servers: + self.log_debug("Logging on to %s" % netloc) + self.req.addAuth(self.account.get_login('password')) - if server in servers: - self.log_debug("Logging on to %s" % server) - self.req.addAuth(account.get_info(server)['login']['password']) - else: - pwd = self.get_password() - if ':' in pwd: - self.req.addAuth(pwd) - else: - self.fail(_("Authorization required")) else: - self.fail(e) + pwd = self.get_password() + if ':' in pwd: + self.req.addAuth(pwd) + else: + self.fail(_("Authorization required")) else: - break - else: - self.fail(_("No file downloaded")) #@TODO: Move to hoster class in 0.4.10 + self.fail(e) - errmsg = self.check_download({'Empty file' : re.compile(r'\A\s*\Z'), + errmsg = self.check_file({'Empty file' : re.compile(r'\A\s*\Z'), 'Html error' : re.compile(r'\A(?:\s*<.+>)?((?:[\w\s]*(?:[Ee]rror|ERROR)\s*\:?)?\s*\d{3})(?:\Z|\s+)'), 'Html file' : re.compile(r'\A\s*<!DOCTYPE html'), 'Request error': re.compile(r'([Aa]n error occured while processing your request)')}) @@ -95,6 +83,7 @@ class BasePlugin(Hoster): try: errmsg += " | " + self.last_check.group(1).strip() + except Exception: pass diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index d2af8272a..204c981c6 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BezvadataCz(SimpleHoster): __name__ = "BezvadataCz" __type__ = "hoster" - __version__ = "0.29" + __version__ = "0.30" __status__ = "testing" __pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.+' @@ -39,24 +39,16 @@ class BezvadataCz(SimpleHoster): #: Captcha form self.html = self.load(url) self.check_errors() - for _i in xrange(5): - action, inputs = self.parse_html_form('frm-stahnoutFreeForm') - if not inputs: - self.error(_("FreeForm")) - - m = re.search(r'<img src="data:image/png;base64,(.*?)"', self.html) - if m is None: - self.error(_("Wrong captcha image")) - - inputs['captcha'] = self.captcha._decrypt(m.group(1).decode('base64'), input_type='png') - - if '<img src="data:image/png;base64' in self.html: - self.captcha.invalid() - else: - self.captcha.correct() - break - else: - self.fail(_("No valid captcha code entered")) + + action, inputs = self.parse_html_form('frm-stahnoutFreeForm') + if not inputs: + self.error(_("FreeForm")) + + m = re.search(r'<img src="data:image/png;base64,(.*?)"', self.html) + if m is None: + self.retry_captcha() + + inputs['captcha'] = self.captcha.decrypt_image(m.group(1).decode('base64'), input_type='png') #: Download url self.html = self.load("http://bezvadata.cz%s" % action, post=inputs) diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index b975a8ab0..e426de092 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" - __version__ = "0.55" + __version__ = "0.56" __status__ = "testing" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.+?)\.html)' @@ -39,7 +39,7 @@ class BitshareCom(SimpleHoster): def process(self, pyfile): if self.premium: - self.account.relogin(self.user) + self.account.relogin() #: File id m = re.match(self.__pattern__, pyfile.url) @@ -75,7 +75,7 @@ class BitshareCom(SimpleHoster): #: This may either download our file or forward us to an error page self.link = self.get_download_url() - if self.check_download({'error': ">Error occured<"}): + if self.check_file({'error': ">Error occured<"}): self.retry(5, 5 * 60, "Bitshare host : Error occured") @@ -114,16 +114,14 @@ class BitshareCom(SimpleHoster): self.log_debug("File is captcha protected") recaptcha = ReCaptcha(self) - #: Try up to 3 times - for i in xrange(3): - response, challenge = recaptcha.challenge() - 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' : response}) - if self.handle_captcha_errors(res): - break + response, challenge = recaptcha.challenge() + 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' : response}) + + self.handle_captcha_errors(res) #: Get download URL self.log_debug("Getting download url") @@ -141,6 +139,7 @@ class BitshareCom(SimpleHoster): self.log_debug("Checking response [%s]" % res) if "ERROR:Session timed out" in res: self.retry() + elif "ERROR" in res: msg = res.split(separator)[-1] self.fail(msg) @@ -150,11 +149,12 @@ class BitshareCom(SimpleHoster): self.log_debug("Result of captcha resolving [%s]" % res) if "SUCCESS" in res: self.captcha.correct() - return True + elif "ERROR:SESSION ERROR" in res: self.retry() - self.captcha.invalid() + else: + self.retry_captcha() getInfo = create_getInfo(BitshareCom) diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 5b7d61e05..c2b8d9257 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -46,7 +46,7 @@ class CatShareNet(SimpleHoster): 'recaptcha_response_field' : response}) m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: + if m is not None: self.link = m.group(1) diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index 60c66960d..d9466c954 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CloudzillaTo(SimpleHoster): __name__ = "CloudzillaTo" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P<ID>[\w^_]+)' @@ -34,7 +34,7 @@ class CloudzillaTo(SimpleHoster): self.fail(_("Missing password")) if re.search(self.PASSWORD_PATTERN, self.html): - self.retry(reason="Wrong password") + self.retry(msg="Wrong password") else: return super(CloudzillaTo, self).check_errors() @@ -49,7 +49,7 @@ class CloudzillaTo(SimpleHoster): if 'error' in ticket: if "File is password protected" in ticket['error']: - self.retry(reason="Wrong password") + self.retry(msg="Wrong password") else: self.fail(ticket['error']) diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 8f092ad0c..70f2be6fb 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CrockoCom(SimpleHoster): __name__ = "CrockoCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+' @@ -39,8 +39,8 @@ class CrockoCom(SimpleHoster): for _i in xrange(5): m = re.search(self.CAPTCHA_PATTERN, self.html) - if m: - url = urlparse.urljoin("http://crocko.com", m.group(1)) + if m is not None: + url = urlparse.urljoin("http://crocko.com/", m.group(1)) self.wait(m.group(2)) self.html = self.load(url) else: @@ -54,16 +54,11 @@ class CrockoCom(SimpleHoster): inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) recaptcha = ReCaptcha(self) - for _i in xrange(5): - inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() - self.download(action, post=inputs) + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() + self.download(action, post=inputs) - if self.check_download({'captcha': recaptcha.KEY_AJAX_PATTERN}): - self.captcha.invalid() - else: - break - else: - self.fail(_("No valid captcha solution received")) + if self.check_file({'captcha': recaptcha.KEY_AJAX_PATTERN}): + self.retry_captcha() getInfo = create_getInfo(CrockoCom) diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 3d2de5f7f..d678f25fa 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -12,7 +12,7 @@ from module.utils import parseFileSize as parse_size class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __version__ = "1.02" + __version__ = "1.04" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+' @@ -40,11 +40,11 @@ class CzshareCom(SimpleHoster): USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->' - def check_traffic_left(self): + def check_traffic(self): #: Check if user logged in m = re.search(self.USER_CREDIT_PATTERN, self.html) if m is None: - self.account.relogin(self.user) + self.account.relogin() self.html = self.load(self.pyfile.url) m = re.search(self.USER_CREDIT_PATTERN, self.html) if m is None: @@ -54,10 +54,11 @@ class CzshareCom(SimpleHoster): try: credit = parse_size(m.group(1).replace(' ', ''), m.group(2)) self.log_info(_("Premium download for %i KiB of Credit") % (self.pyfile.size / 1024)) - self.log_info(_("User %s has %i KiB left") % (self.user, credit / 1024)) + self.log_info(_("User %s has %i KiB left") % (self.account.user, credit / 1024)) if credit < self.pyfile.size: self.log_info(_("Not enough credit to download file: %s") % self.pyfile.name) return False + except Exception, e: #: let's continue and see what happens... self.log_error(e) @@ -66,13 +67,13 @@ class CzshareCom(SimpleHoster): def handle_premium(self, pyfile): - #: Parse download link try: 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.log_error(e) - self.restart(nopremium=True) + self.restart() #: Download the file, destination is determined by pyLoad self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True) @@ -104,21 +105,17 @@ class CzshareCom(SimpleHoster): #: Get and decrypt captcha captcha_url = 'http://sdilej.cz/captcha.php' - for _i in xrange(5): - inputs['captchastring2'] = self.captcha.decrypt(captcha_url) - self.html = self.load(parsed_url, post=inputs) + inputs['captchastring2'] = self.captcha.decrypt(captcha_url) + self.html = self.load(parsed_url, post=inputs) - if u"<li>ZadanÃœ ovÄÅovacà kód nesouhlasÃ!</li>" in self.html: - self.captcha.invalid() + if u"<li>ZadanÃœ ovÄÅovacà kód nesouhlasÃ!</li>" in self.html: + self.retry_captcha() - elif re.search(self.MULTIDL_PATTERN, self.html): - self.wait(5 * 60, 12, _("Download limit reached")) + elif re.search(self.MULTIDL_PATTERN, self.html): + self.wait(5 * 60, 12, _("Download limit reached")) - else: - self.captcha.correct() - break else: - self.fail(_("No valid captcha code entered")) + self.captcha.correct() m = re.search("countdown_number = (\d+);", self.html) self.set_wait(int(m.group(1)) if m else 50) @@ -135,9 +132,9 @@ class CzshareCom(SimpleHoster): self.wait() - def check_file(self): + def check_download(self): #: Check download - check = self.check_download({ + check = self.check_file({ "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), 'credit' : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), "multi-dl" : re.compile(self.MULTIDL_PATTERN), @@ -148,16 +145,15 @@ class CzshareCom(SimpleHoster): self.fail(_("File not available - try later")) elif check == "credit": - self.restart(nopremium=True) + self.restart() elif check == "multi-dl": self.wait(5 * 60, 12, _("Download limit reached")) elif check == "captcha": - self.captcha.invalid() - self.retry() + self.retry_captcha() - return super(CzshareCom, self).check_file() + return super(CzshareCom, self).check_download() getInfo = create_getInfo(CzshareCom) diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index 15caae1f7..fe304fdea 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -6,7 +6,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataportCz(SimpleHoster): __name__ = "DataportCz" __type__ = "hoster" - __version__ = "0.42" + __version__ = "0.43" __status__ = "testing" __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.+)' @@ -28,32 +28,26 @@ class DataportCz(SimpleHoster): def handle_free(self, pyfile): captchas = {'1': "jkeG", '2': "hMJQ", '3': "vmEK", '4': "ePQM", '5': "blBd"} - for _i in xrange(60): - action, inputs = self.parse_html_form('free_download_form') - self.log_debug(action, inputs) - if not action or not inputs: - self.error(_("free_download_form")) + action, inputs = self.parse_html_form('free_download_form') + self.log_debug(action, inputs) + if not action or not inputs: + self.error(_("free_download_form")) - if "captchaId" in inputs and inputs['captchaId'] in captchas: - inputs['captchaCode'] = captchas[inputs['captchaId']] - else: - self.error(_("captcha")) + if "captchaId" in inputs and inputs['captchaId'] in captchas: + inputs['captchaCode'] = captchas[inputs['captchaId']] + else: + self.error(_("Captcha not found")) - self.download("http://www.dataport.cz%s" % action, post=inputs) + self.download("http://www.dataport.cz%s" % action, post=inputs) - check = self.check_download({'captcha': 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', - 'slot' : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) - if check == "captcha": - self.error(_("invalid captcha")) + check = self.check_file({'captcha': 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', + 'slot' : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) + if check == "captcha": + self.retry_captcha() - elif check == "slot": - self.log_debug("No free slots - wait 60s and retry") - self.wait(60, False) - self.html = self.load(pyfile.url) - continue - - else: - break + elif check == "slot": + self.log_debug("No free slots - wait 60s and retry") + self.retry(wait=60) getInfo = create_getInfo(DataportCz) diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index d90fc5864..42aed2c77 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -49,7 +49,8 @@ class DateiTo(SimpleHoster): m = re.search(self.DATA_PATTERN, self.html) if m is None: - self.error(_("data")) + self.error(_("Data pattern not found")) + url = 'http://datei.to/' + m.group(1) data = dict(x.split('=') for x in m.group(2).split('&')) diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py index 7cf7c4663..ca6603a87 100644 --- a/module/plugins/hoster/DebridItaliaCom.py +++ b/module/plugins/hoster/DebridItaliaCom.py @@ -29,7 +29,7 @@ class DebridItaliaCom(MultiHoster): get={'generate': "on", 'link': pyfile.url, 'p': self.get_password()}) if "ERROR:" not in self.html: - self.link = self.html.strip() + self.link = self.html else: self.info['error'] = re.search(r'ERROR:(.*)', self.html).group(1).strip() diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 9d42935cb..b3854f581 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" - __version__ = "0.57" + __version__ = "0.58" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)' @@ -48,7 +48,7 @@ class DepositfilesCom(SimpleHoster): m = re.search(r"var fid = '(\w+)';", self.html) if m is None: - self.retry(wait_time=5) + self.retry(wait=5) params = {'fid': m.group(1)} self.log_debug("FID: %s" % params['fid']) @@ -66,7 +66,7 @@ class DepositfilesCom(SimpleHoster): self.html = self.load("https://dfiles.eu/get_file.php", get=params) m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: + if m is not None: self.link = urllib.unquote(m.group(1)) @@ -76,7 +76,7 @@ class DepositfilesCom(SimpleHoster): self.retry(25, 60 * 60, "Download limit reached") elif 'onClick="show_gold_offer' in self.html: - self.account.relogin(self.user) + self.account.relogin() self.retry() else: diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index f9d427c1b..f77b9596a 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -100,15 +100,16 @@ class DlFreeFr(SimpleHoster): if headers.get("code") == 302 and "set-cookie" in headers and "location" in headers: m = re.search("(.*?)=(.*?); path=(.*?); domain=(.*)", headers.get("set-cookie")) cj = CookieJar(self.__name__) - if m: + if m is not None: cj.setCookie(m.group(4), m.group(1), m.group(2), m.group(3)) else: self.fail(_("Cookie error")) self.link = headers.get("location") self.req.setCookieJar(cj) + else: - self.fail(_("Invalid response")) + self.fail(_("Bad header")) def get_last_headers(self): diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 53ac9ff06..3cfa014dd 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class EuroshareEu(SimpleHoster): __name__ = "EuroshareEu" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.32" __status__ = "testing" __pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.+' @@ -32,17 +32,17 @@ class EuroshareEu(SimpleHoster): def handle_premium(self, pyfile): if self.ERROR_PATTERN in self.html: - self.account.relogin(self.user) - self.retry(reason=_("User not logged in")) + self.account.relogin() + self.retry(msg=_("User not logged in")) self.link = pyfile.url.rstrip('/') + "/download/" - check = self.check_download({'login': re.compile(self.ERROR_PATTERN), + check = self.check_file({'login': re.compile(self.ERROR_PATTERN), 'json' : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) if check == "login" or (check == "json" and self.last_check.group(1) == "Access token expired"): - self.account.relogin(self.user) - self.retry(reason=_("Access token expired")) + self.account.relogin() + self.retry(msg=_("Access token expired")) elif check == "json": self.fail(self.last_check.group(1)) diff --git a/module/plugins/hoster/ExashareCom.py b/module/plugins/hoster/ExashareCom.py index 19cd1b46c..c3a4b43dc 100644 --- a/module/plugins/hoster/ExashareCom.py +++ b/module/plugins/hoster/ExashareCom.py @@ -28,11 +28,7 @@ class ExashareCom(XFSHoster): def handle_free(self, pyfile): - m = re.search(self.LINK_FREE_PATTERN, self.html) - if m is None: - self.error(_("Free download link not found")) - else: - self.link = m.group(1) + return super(XFSHoster, self).handle_free(pyfile) getInfo = create_getInfo(ExashareCom) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 3442e7d27..b21db38bb 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, s class ExtabitCom(SimpleHoster): __name__ = "ExtabitCom" __type__ = "hoster" - __version__ = "0.67" + __version__ = "0.68" __status__ = "testing" __pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)' @@ -35,32 +35,30 @@ class ExtabitCom(SimpleHoster): self.fail(_("Only premium users can download this file")) m = re.search(r"Next free download from your ip will be available in <b>(\d+)\s*minutes", self.html) - if m: + if m is not None: self.wait(int(m.group(1)) * 60, True) elif "The daily downloads limit from your IP is exceeded" in self.html: self.log_warning(_("You have reached your daily downloads limit for today")) - self.wait(seconds_to_midnight(gmt=2), True) + self.wait(seconds_to_midnight(), True) self.log_debug("URL: " + self.req.http.lastEffectiveURL) m = re.match(self.__pattern__, self.req.http.lastEffectiveURL) fileID = m.group('ID') if m else self.info['pattern']['ID'] m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.html) - if m: + if m is not None: recaptcha = ReCaptcha(self) captcha_key = m.group(1) - for _i in xrange(5): - get_data = {'type': "recaptcha"} - get_data['capture'], get_data['challenge'] = recaptcha.challenge(captcha_key) - res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) - if "ok" in res: - self.captcha.correct() - break - else: - self.captcha.invalid() + get_data = {'type': "recaptcha"} + get_data['capture'], get_data['challenge'] = recaptcha.challenge(captcha_key) + + res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) + + if "ok" in res: + self.captcha.correct() else: - self.fail(_("Invalid captcha")) + self.retry_captcha() else: self.error(_("Captcha")) diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 0019cf3c2..d932bb22e 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -10,7 +10,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}' @@ -27,13 +27,11 @@ class FastixRu(MultiHoster): def handle_premium(self, pyfile): - api_key = self.account.get_data(self.user) - api_key = api_key['api'] - - self.html = self.load("http://fastix.ru/api_v2/", - get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url}) - - data = json_loads(self.html) + self.html = json_loads(self.load("http://fastix.ru/api_v2/", + get={'apikey': self.account.get_data('apikey'), + 'sub' : "getdirectlink", + 'link' : pyfile.url}) + data = self.html) self.log_debug("Json data", data) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 485d69d15..b05edfb27 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FastshareCz(SimpleHoster): __name__ = "FastshareCz" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.35" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+' @@ -42,14 +42,14 @@ class FastshareCz(SimpleHoster): if self.CREDIT_ERROR in self.html: errmsg = self.info['error'] = _("Not enough traffic left") self.log_warning(errmsg) - self.restart(nopremium=True) + self.restart() self.info.pop('error', None) def handle_free(self, pyfile): m = re.search(self.FREE_URL_PATTERN, self.html) - if m: + if m is not None: action, captcha_src = m.groups() else: self.error(_("FREE_URL_PATTERN not found")) @@ -59,8 +59,8 @@ class FastshareCz(SimpleHoster): self.download(urlparse.urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18}) - def check_file(self): - check = self.check_download({ + def check_download(self): + check = self.check_file({ 'paralell-dl' : re.compile(r"<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"), 'wrong captcha': re.compile(r'Download for FREE'), 'credit' : re.compile(self.CREDIT_ERROR) @@ -70,12 +70,12 @@ class FastshareCz(SimpleHoster): self.retry(6, 10 * 60, _("Paralell download")) elif check == "wrong captcha": - self.retry(max_tries=5, reason=_("Wrong captcha")) + self.retry_captcha() elif check == "credit": - self.restart(nopremium=True) + self.restart() - return super(FastshareCz, self).check_file() + return super(FastshareCz, self).check_download() getInfo = create_getInfo(FastshareCz) diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index 62a7a553f..23aa7ea61 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileSharkPl(SimpleHoster): __name__ = "FileSharkPl" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d+/\w+' @@ -50,12 +50,12 @@ class FileSharkPl(SimpleHoster): def check_errors(self): #: Check if file is now available for download (-> file name can be found in html body) m = re.search(self.WAIT_PATTERN, self.html) - if m: + if m is not None: errmsg = self.info['error'] = _("Another download already run") self.retry(15, int(m.group(1)), errmsg) m = re.search(self.ERROR_PATTERN, self.html) - if m: + if m is not None: alert = m.group(1) if re.match(self.IP_ERROR_PATTERN, alert): @@ -78,12 +78,12 @@ class FileSharkPl(SimpleHoster): if m is None: self.error(_("Download url not found")) - link = urlparse.urljoin("http://fileshark.pl", m.group(1)) + link = urlparse.urljoin("http://fileshark.pl/", m.group(1)) self.html = self.load(link) m = re.search(self.WAIT_PATTERN, self.html) - if m: + if m is not None: seconds = int(m.group(1)) self.log_debug("Wait %s seconds" % seconds) self.wait(seconds) @@ -92,15 +92,15 @@ class FileSharkPl(SimpleHoster): m = re.search(self.TOKEN_PATTERN, self.html) if m is None: - self.retry(reason=_("Captcha form not found")) + self.retry(msg=_("Captcha form not found")) inputs['form[_token]'] = m.group(1) m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: - self.retry(reason=_("Captcha image not found")) + self.retry(msg=_("Captcha image not found")) - inputs['form[captcha]'] = self.captcha._decrypt(m.group(1).decode('base64'), input_type='jpeg') + inputs['form[captcha]'] = self.captcha.decrypt_image(m.group(1).decode('base64'), input_type='jpeg') inputs['form[start]'] = "" self.download(link, post=inputs, disposition=True) diff --git a/module/plugins/hoster/FileboomMe.py b/module/plugins/hoster/FileboomMe.py index 2798d9eda..1a2c89b0b 100644 --- a/module/plugins/hoster/FileboomMe.py +++ b/module/plugins/hoster/FileboomMe.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -37,67 +36,53 @@ class FileboomMe(SimpleHoster): def handle_free(self, pyfile): - post_url = urljoin(pyfile.url, "/file/" + self.info['pattern']['ID']) + post_url = urlparse.urljoin(pyfile.url, "file/" + self.info['pattern']['ID']) m = re.search(r'data-slow-id="(\w+)"', self.html) - if m: + if m is not None: self.html = self.load(post_url, post={'slow_id': m.group(1)}) m = re.search(self.LINK_PATTERN, self.html) - if m: - self.link = urljoin(pyfile.url, m.group(0)) + if m is not None: + self.link = urlparse.urljoin(pyfile.url, m.group(0)) else: - for _i in xrange(5): - m = re.search(r'<input type="hidden" name="uniqueId" value="(\w+)">', self.html) - if m: - uniqueId = m.group(1) - - m = re.search(self.CAPTCHA_PATTERN, self.html) - if m: - captcha = self.captcha.decrypt(urljoin(pyfile.url, m.group(1))) - - self.html = self.load(post_url, - post={'CaptchaForm[code]' : captcha, - 'free' : 1, - 'freeDownloadRequest': 1, - 'uniqueId' : uniqueId}) - - if 'The verification code is incorrect' in self.html: - self.captcha.invalid() - - else: - self.check_errors() + m = re.search(r'<input type="hidden" name="uniqueId" value="(\w+)">', self.html) + if m is None: + m = re.search(r'>\s*Please wait ([\d:]+)', self.html) + if m is not None: + wait_time = 0 + for v in re.findall(r'(\d+)', m.group(1), re.I): + wait_time = 60 * wait_time + int(v) + self.wait(wait_time) + self.retry() - self.html = self.load(post_url, - post={'free' : 1, - 'uniqueId': uniqueId}) - - m = re.search(self.LINK_PATTERN, self.html) - if m: - self.link = urljoin(pyfile.url, m.group(0)) + else: + uniqueId = m.group(1) - else: - self.captcha.invalid() + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m is not None: + captcha = self.captcha.decrypt(urlparse.urljoin(pyfile.url, m.group(1))) + self.html = self.load(post_url, + post={'CaptchaForm[code]' : captcha, + 'free' : 1, + 'freeDownloadRequest': 1, + 'uniqueId' : uniqueId}) - break + if 'The verification code is incorrect' in self.html: + self.retry_captcha() else: - self.fail(_("Captcha not found")) - - else: - m = re.search(r'>\s*Please wait ([\d:]+)', self.html) - if m: - wait_time = 0 - for v in re.findall(r'(\d+)', m.group(1), re.I): - wait_time = 60 * wait_time + int(v) - self.wait(wait_time) - self.retry() - break + self.check_errors() - else: - self.fail(_("Invalid captcha")) + self.html = self.load(post_url, + post={'free' : 1, + 'uniqueId': uniqueId}) + + m = re.search(self.LINK_PATTERN, self.html) + if m is not None: + self.link = urlparse.urljoin(pyfile.url, m.group(0)) getInfo = create_getInfo(FileboomMe) diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 21654fee3..da81d3f37 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+)' @@ -64,7 +64,7 @@ class FilecloudIo(SimpleHoster): response, challenge = recaptcha.challenge(captcha_key) self.account.form_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response} - self.account.relogin(self.user) + self.account.relogin() self.retry(2) json_url = "http://filecloud.io/download-request.json" @@ -78,22 +78,18 @@ class FilecloudIo(SimpleHoster): self.log_debug(res) if res['captcha']: data['ctype'] = "recaptcha" + data['recaptcha_response'], data['recaptcha_challenge'] = recaptcha.challenge(captcha_key) - for _i in xrange(5): - data['recaptcha_response'], data['recaptcha_challenge'] = recaptcha.challenge(captcha_key) + json_url = "http://filecloud.io/download-request.json" + res = self.load(json_url, post=data) + self.log_debug(res) + res = json_loads(res) - json_url = "http://filecloud.io/download-request.json" - res = self.load(json_url, post=data) - self.log_debug(res) - res = json_loads(res) - - if "retry" in res and res['retry']: - self.captcha.invalid() - else: - self.captcha.correct() - break + if "retry" in res and res['retry']: + self.retry_captcha() else: - self.fail(_("Incorrect captcha")) + self.captcha.correct() + if res['dl']: self.html = self.load('http://filecloud.io/download.html') @@ -111,7 +107,7 @@ class FilecloudIo(SimpleHoster): def handle_premium(self, pyfile): - akey = self.account.get_data(self.user)['akey'] + akey = self.account.get_data('akey') ukey = self.info['pattern']['ID'] self.log_debug("Akey: %s | Ukey: %s" % (akey, ukey)) rep = self.load("http://api.filecloud.io/api-fetch_download_url.api", diff --git a/module/plugins/hoster/FiledropperCom.py b/module/plugins/hoster/FiledropperCom.py index 3f5e2b761..8cef6c709 100644 --- a/module/plugins/hoster/FiledropperCom.py +++ b/module/plugins/hoster/FiledropperCom.py @@ -32,16 +32,14 @@ class FiledropperCom(SimpleHoster): def handle_free(self, pyfile): m = re.search(r'img id="img" src="(.+?)"', self.html) if m is None: - self.fail("Captcha not found") + self.fail(_("Captcha not found")) captcha_code = self.captcha.decrypt("http://www.filedropper.com/%s" % m.group(1)) m = re.search(r'method="post" action="(.+?)"', self.html) - if m is None: - self.fail("Download link not found") - - self.download(urlparse.urljoin("http://www.filedropper.com/", m.group(1)), - post={'code': captcha_code}) + if m is not None: + self.download(urlparse.urljoin("http://www.filedropper.com/", m.group(1)), + post={'code': captcha_code}) getInfo = create_getInfo(FiledropperCom) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 325b4bb27..637f3b2e0 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import re -import urlparse from module.network.RequestFactory import getURL as get_url from module.plugins.internal.SimpleHoster import SimpleHoster, parse_fileInfo @@ -20,7 +19,7 @@ def get_info(urls): class FilefactoryCom(SimpleHoster): __name__ = "FilefactoryCom" __type__ = "hoster" - __version__ = "0.57" + __version__ = "0.59" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?filefactory\.com/(file|trafficshare/\w+)/\w+' @@ -51,36 +50,24 @@ class FilefactoryCom(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("Free download link not found")) + return self.link = m.group(1) m = re.search(self.WAIT_PATTERN, self.html) - if m: + if m is not None: self.wait(m.group(1)) - def check_file(self): - check = self.check_download({'multiple': "You are currently downloading too many files at once.", + def check_download(self): + check = self.check_file({'multiple': "You are currently downloading too many files at once.", 'error' : '<div id="errorMessage">'}) if check == "multiple": self.log_debug("Parallel downloads detected; waiting 15 minutes") - self.retry(wait_time=15 * 60, reason=_("Parallel downloads")) + self.retry(wait=15 * 60, msg=_("Parallel downloads")) elif check == "error": self.error(_("Unknown error")) - return super(FilefactoryCom, self).check_file() - - - def handle_premium(self, pyfile): - self.link = self.direct_link(self.load(pyfile.url, just_header=True)) - - if not self.link: - html = self.load(pyfile.url) - m = re.search(self.LINK_PREMIUM_PATTERN, html) - if m: - self.link = m.group(1) - else: - self.error(_("Premium download link not found")) + return super(FilefactoryCom, self).check_download() diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index d8c626ef2..3d42bebed 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/(?P<ID>[^/]+)' @@ -64,27 +64,20 @@ class FilepostCom(SimpleHoster): self.link = self.get_json_response(get_dict, post_dict, 'link') if not self.link: - self.fail(_("Incorrect password")) + self.fail(_("Wrong password")) else: self.fail(_("No password found")) else: - #: Solve recaptcha - recaptcha = ReCaptcha(self) - - for i in xrange(5): - get_dict['JsHttpRequest'] = str(int(time.time() * 10000)) + '-xml' - if i: - post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = recaptcha.challenge( - captcha_key) - self.log_debug(u"RECAPTCHA: %s : %s : %s" % ( - captcha_key, post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'])) + get_dict['JsHttpRequest'] = str(int(time.time() * 10000)) + '-xml' + self.link = self.get_json_response(get_dict, post_dict, 'link') + if not self.link: + #: Solve recaptcha + recaptcha = ReCaptcha(self) + post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = recaptcha.challenge(captcha_key) self.link = self.get_json_response(get_dict, post_dict, 'link') - else: - self.fail(_("Invalid captcha")) - def get_json_response(self, get_dict, post_dict, field): res = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict)) @@ -101,8 +94,8 @@ class FilepostCom(SimpleHoster): if 'error' in res['js']: if res['js']['error'] == "download_delay": - self.retry(wait_time=res['js']['params']['next_download']) - #: ~? self.retry(wait_time=js_answer['params']['next_download']) + self.retry(wait=res['js']['params']['next_download']) + #: ~? self.retry(wait=js_answer['params']['next_download']) elif 'Wrong file password' in res['js']['error'] \ or 'You entered a wrong CAPTCHA code' in res['js']['error'] \ diff --git a/module/plugins/hoster/FilepupNet.py b/module/plugins/hoster/FilepupNet.py index 8bb23adb1..7793afe53 100644 --- a/module/plugins/hoster/FilepupNet.py +++ b/module/plugins/hoster/FilepupNet.py @@ -39,11 +39,9 @@ class FilepupNet(SimpleHoster): def handle_free(self, pyfile): m = re.search(self.LINK_FREE_PATTERN, self.html) - if m is None: - self.error(_("Download link not found")) - - dl_link = m.group(1) - self.download(dl_link, post={'task': "download"}) + if m is not None: + dl_link = m.group(1) + self.download(dl_link, post={'task': "download"}) getInfo = create_getInfo(FilepupNet) diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index f8c41f4d1..37c88dec7 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -6,7 +6,6 @@ import pycurl import re -import urlparse from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -58,10 +57,10 @@ class FilerNet(SimpleHoster): self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) if 'location' in self.req.http.header.lower(): - self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1) self.captcha.correct() + self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1) else: - self.captcha.invalid() + self.retry_captcha() getInfo = create_getInfo(FilerNet) diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index a6dd56152..fcb29b922 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -21,6 +21,7 @@ def get_info(urls): url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' file_name = re.search(url_pattern, html).group(0).split(', event)">')[1].split('</a>')[0] result.append((file_name, 0, 2, url)) + except Exception: pass @@ -32,7 +33,7 @@ def get_info(urls): class FilesMailRu(Hoster): __name__ = "FilesMailRu" __type__ = "hoster" - __version__ = "0.34" + __version__ = "0.35" __status__ = "testing" __pattern__ = r'http://(?:www\.)?files\.mail\.ru/.+' @@ -103,7 +104,7 @@ class FilesMailRu(Hoster): #: so i set it to check every download because sometimes there are downloads #: that contain the HTML-Text and 60MB ZEROs after that in a xyzfile.part1.rar file #: (Loading 100MB in to ram is not an option) - check = self.check_download({'html': "<meta name="}, read_size=50000) + check = self.check_file({'html': "<meta name="}, read_size=50000) if check == "html": self.log_info(_( "There was HTML Code in the Downloaded File (%s)...redirect error? The Download will be restarted." % diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index a74589cff..277d4f2a8 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -24,6 +24,7 @@ def check_file(plugin, urls): parse_size(cols[2]) if cols[2] != '--' else 0, 2 if cols[3].startswith('Available') else 1, cols[0])) + except Exception, e: continue @@ -33,7 +34,7 @@ def check_file(plugin, urls): class FileserveCom(Hoster): __name__ = "FileserveCom" __type__ = "hoster" - __version__ = "0.58" + __version__ = "0.61" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<ID>[^/]+)' @@ -94,7 +95,7 @@ class FileserveCom(Hoster): elif action['fail'] == "parallelDownload": self.log_warning(_("Parallel download error, now waiting 60s")) - self.retry(wait_time=60, reason=_("parallelDownload")) + self.retry(wait=60, msg=_("parallelDownload")) else: self.fail(_("Download check returned: %s") % action['fail']) @@ -119,7 +120,7 @@ class FileserveCom(Hoster): self.download(self.url, post={'download': "normal"}) self.log_debug(self.req.http.lastEffectiveURL) - check = self.check_download({'expired': self.LINK_EXPIRED_PATTERN, + check = self.check_file({'expired': self.LINK_EXPIRED_PATTERN, 'wait' : re.compile(self.LONG_WAIT_PATTERN), 'limit' : self.DL_LIMIT_PATTERN}) @@ -132,7 +133,7 @@ class FileserveCom(Hoster): elif check == "limit": self.log_warning(_("Download limited reached for today")) - self.wait(seconds_to_midnight(gmt=2), True) + self.wait(seconds_to_midnight(), True) self.retry() self.thread.m.reconnecting.wait(3) #: Ease issue with later downloads appearing to be in parallel @@ -160,19 +161,15 @@ class FileserveCom(Hoster): captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1) recaptcha = ReCaptcha(self) - for _i in xrange(5): - response, challenge = recaptcha.challenge(captcha_key) - res = json_loads(self.load(self.URLS[2], - post={'recaptcha_challenge_field' : challenge, - 'recaptcha_response_field' : response, - 'recaptcha_shortencode_field': self.file_id})) - if not res['success']: - self.captcha.invalid() - else: - self.captcha.correct() - break + response, challenge = recaptcha.challenge(captcha_key) + res = json_loads(self.load(self.URLS[2], + post={'recaptcha_challenge_field' : challenge, + 'recaptcha_response_field' : response, + 'recaptcha_shortencode_field': self.file_id})) + if res['success']: + self.captcha.correct() else: - self.fail(_("Invalid captcha")) + self.retry_captcha() def do_long_wait(self, m): @@ -186,8 +183,8 @@ class FileserveCom(Hoster): if self.__name__ == "FileserveCom": #: Try api download res = self.load("http://app.fileserve.com/api/download/premium/", - post={'username': self.user, - 'password': self.account.get_info(self.user)['login']['password'], + post={'username': self.account.user, + 'password': self.account.get_login('password'), 'shorten': self.file_id}) if res: res = json_loads(res) @@ -196,7 +193,7 @@ class FileserveCom(Hoster): elif res['error_code'] in ["305", "500"]: self.temp_offline() elif res['error_code'] in ["403", "605"]: - self.restart(nopremium=True) + self.restart() elif res['error_code'] in ["606", "607", "608"]: self.offline() else: @@ -204,9 +201,9 @@ class FileserveCom(Hoster): self.download(premium_url or self.pyfile.url) - if not premium_url and self.check_download({'login': re.compile(self.NOT_LOGGED_IN_PATTERN)}): - self.account.relogin(self.user) - self.retry(reason=_("Not logged in")) + if not premium_url and self.check_file({'login': re.compile(self.NOT_LOGGED_IN_PATTERN)}): + self.account.relogin() + self.retry(msg=_("Not logged in")) def get_info(urls): diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index e5b309dc1..d767f4ca1 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -38,7 +38,7 @@ class FourSharedCom(SimpleHoster): def handle_free(self, pyfile): m = re.search(self.LINK_BTN_PATTERN, self.html) - if m: + if m is not None: link = m.group(1) else: link = re.sub(r'/(download|get|file|document|photo|video|audio)/', r'/get/', pyfile.url) @@ -47,7 +47,7 @@ class FourSharedCom(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("Download link")) + return self.link = m.group(1) @@ -55,6 +55,7 @@ class FourSharedCom(SimpleHoster): m = re.search(self.ID_PATTERN, self.html) res = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1)) self.log_debug(res) + except Exception: pass diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 4564ee03e..450f11095 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import seconds_to_midnight class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" - __version__ = "0.43" + __version__ = "0.44" __status__ = "testing" __pattern__ = r'http://(?:www\.)?freakshare\.(net|com)/files/\S*?/' @@ -44,7 +44,7 @@ class FreakshareCom(Hoster): self.download(pyfile.url, post=self.req_opts) - check = self.check_download({'bad' : "bad try", + check = self.check_file({'bad' : "bad try", 'paralell' : "> Sorry, you cant download more then 1 files at time. <", 'empty' : "Warning: Unknown: Filename cannot be empty", 'wrong_captcha' : "Wrong Captcha!", @@ -61,8 +61,7 @@ class FreakshareCom(Hoster): self.fail(_("File not downloadable")) elif check == "wrong_captcha": - self.captcha.invalid() - self.retry() + self.retry_captcha() elif check == "downloadserver": self.retry(5, 15 * 60, _("No Download server")) @@ -111,7 +110,7 @@ class FreakshareCom(Hoster): if not self.wantReconnect: m = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html) - if m: + if m is not None: file_name = m.group(1) else: file_name = self.pyfile.url @@ -128,7 +127,7 @@ class FreakshareCom(Hoster): if not self.wantReconnect: m = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html) - if m: + if m is not None: units = float(m.group(1).replace(",", "")) pow = {'KB': 1, 'MB': 2, 'GB': 3}[m.group(2)] size = int(units * 1024 ** pow) @@ -142,7 +141,7 @@ class FreakshareCom(Hoster): if "Your Traffic is used up for today" in self.html: self.wantReconnect = True - return seconds_to_midnight(gmt=2) + return seconds_to_midnight() timestring = re.search('\s*var\s(?:downloadWait|time)\s=\s(\d*)[\d.]*;', self.html) if timestring: diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py index ed7c4bf7f..c0053fc76 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FreeWayMe(MultiHoster): __name__ = "FreeWayMe" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?free-way\.(bz|me)/.+' @@ -33,7 +33,7 @@ class FreeWayMe(MultiHoster): get={'multiget': 7, 'url' : pyfile.url, 'user' : user, - 'pw' : self.account.get_info(self.user)['login']['password'], + 'pw' : self.account.get_login('password'), 'json' : ""}, just_header=True) diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index a5aac222c..b387151f7 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -68,7 +68,7 @@ class FshareVn(SimpleHoster): self.html = self.load(url, post=inputs) if 'name="link_file_pwd_dl"' in self.html: - self.fail(_("Incorrect password")) + self.fail(_("Wrong password")) else: self.fail(_("No password found")) @@ -93,7 +93,7 @@ class FshareVn(SimpleHoster): self.offline() m = re.search(self.WAIT_PATTERN, self.html) - if m: + if m is not None: self.log_info(_("Wait until %s ICT") % m.group(1)) wait_until = time.mktime.time(time.strptime.time(m.group(1), "%d/%m/%Y %H:%M")) self.wait(wait_until - time.mktime.time(time.gmtime.time()) - 7 * 60 * 60, True) diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 25eb44604..2ff1755f4 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -11,7 +11,7 @@ from module.plugins.internal.Hoster import Hoster class Ftp(Hoster): __name__ = "Ftp" __type__ = "hoster" - __version__ = "0.54" + __version__ = "0.55" __status__ = "testing" __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' @@ -29,30 +29,41 @@ class Ftp(Hoster): def process(self, pyfile): - parsed_url = urlparse.urlparse(pyfile.url) - netloc = parsed_url.netloc + p_url = urlparse.urlparse(pyfile.url) + netloc = p_url.netloc - pyfile.name = parsed_url.path.rpartition('/')[2] + pyfile.name = p_url.path.rpartition('/')[2] try: pyfile.name = urllib.unquote(str(pyfile.name)).decode('utf8') + except Exception: pass if not "@" in netloc: - servers = [x['login'] for x in self.account.getAllAccounts()] if self.account else [] + self.log_debug("Auth required") + + #@TODO: Recheck in 0.4.10 + if self.account: + servers = [x['login'] for x in self.account.getAllAccounts()] + else: + servers = [] if netloc in servers: self.log_debug("Logging on to %s" % netloc) - self.req.addAuth(self.account.get_info(netloc)['login']['password']) + self.req.addAuth(self.account.get_login('password')) + else: pwd = self.get_password() if ':' in pwd: self.req.addAuth(pwd) + else: + self.fail(_("Authorization required")) self.req.http.c.setopt(pycurl.NOBODY, 1) try: res = self.load(pyfile.url) + except pycurl.error, e: self.fail(_("Error %d: %s") % e.args) @@ -60,19 +71,25 @@ class Ftp(Hoster): self.log_debug(self.req.http.header) m = re.search(r"Content-Length:\s*(\d+)", res) - if m: + if m is not None: pyfile.size = int(m.group(1)) self.download(pyfile.url) + else: #: Naive ftp directory listing if re.search(r'^25\d.*?"', self.req.http.header, re.M): pyfile.url = pyfile.url.rstrip('/') pkgname = "/".join([pyfile.package().name, urlparse.urlparse(pyfile.url).path.rpartition('/')[2]]) + pyfile.url += '/' + self.req.http.c.setopt(48, 1) #: CURLOPT_DIRLISTONLY res = self.load(pyfile.url, decode=False) + links = [pyfile.url + x for x in res.splitlines()] self.log_debug("LINKS", links) + self.pyload.api.addPackage(pkgname, links) + else: self.fail(_("Unexpected server response")) diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index 381c39a21..85e5e4843 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -36,23 +36,22 @@ class GigapetaCom(SimpleHoster): self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) - for _i in xrange(5): - self.check_errors() - - captcha = self.captcha.decrypt(captcha_url) - self.html = self.load(pyfile.url, post={ - 'captcha_key': captcha_key, - 'captcha': captcha, - 'download': "Download"}) - - m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I) - if m: - self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 - break - elif "Entered figures don`t coincide with the picture" in self.html: - self.captcha.invalid() - else: - self.fail(_("No valid captcha code entered")) + self.check_errors() + + captcha = self.captcha.decrypt(captcha_url) + self.html = self.load(pyfile.url, post={ + 'captcha_key': captcha_key, + 'captcha': captcha, + 'download': "Download"}) + + m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I) + if m is not None: + self.captcha.correct() + self.link = m.group(1) + + elif "Entered figures don`t coincide with the picture" in self.html: + self.retry_captcha() + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 903b5361e..c6b84b776 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -41,19 +41,16 @@ class GoogledriveCom(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("Free download link not found")) + return + link = self.fixurl(link, "https://docs.google.com/") + direct_link = self.direct_link(link, False) + + if not direct_link: + self.html = self.load(link) else: - link = html_unescape(m.group(1).decode('unicode-escape')) - if not urlparse.urlparse(link).scheme: - link = urlparse.urljoin("https://docs.google.com/", link) - - direct_link = self.direct_link(link, False) - if not direct_link: - self.html = self.load(link) - else: - self.link = direct_link - break + self.link = direct_link + break getInfo = create_getInfo(GoogledriveCom) diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index eab819ad9..012b6be63 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- -import urlparse - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo diff --git a/module/plugins/hoster/HighWayMe.py b/module/plugins/hoster/HighWayMe.py index 119ddb70e..53a8960c1 100644 --- a/module/plugins/hoster/HighWayMe.py +++ b/module/plugins/hoster/HighWayMe.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import seconds_to_midnight class HighWayMe(MultiHoster): __name__ = "HighWayMe" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'https?://.+high-way\.my' @@ -27,7 +27,7 @@ class HighWayMe(MultiHoster): def check_errors(self): if self.html.get('code') == 302: #@NOTE: This is not working. It should by if 302 Moved Temporarily then... But I don't now how to implement it. - self.account.relogin(self.user) + self.account.relogin() self.retry() elif "<code>9</code>" in self.html: @@ -39,7 +39,7 @@ class HighWayMe(MultiHoster): elif "trafficlimit" in self.html: self.log_warning(_("Reached daily limit")) - self.retry(wait_time=seconds_to_midnight(gmt=2), reason="Daily limit for this host reached") + self.retry(wait=seconds_to_midnight(), msg="Daily limit for this host reached") elif "<code>8</code>" in self.html: self.log_warning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) diff --git a/module/plugins/hoster/HostujeNet.py b/module/plugins/hoster/HostujeNet.py index 4dbf550b3..3c0a53535 100644 --- a/module/plugins/hoster/HostujeNet.py +++ b/module/plugins/hoster/HostujeNet.py @@ -30,19 +30,19 @@ class HostujeNet(SimpleHoster): def handle_free(self, pyfile): m = re.search(r'<script src="([\w^_]+.php)"></script>', self.html) - if m: + if m is not None: jscript = self.load("http://hostuje.net/" + m.group(1)) m = re.search(r"\('(\w+\.php\?i=\w+)'\);", jscript) - if m: + if m is not None: self.load("http://hostuje.net/" + m.group(1)) else: - self.error(_("unexpected javascript format")) + self.error(_("Unexpected javascript format")) else: - self.error(_("script not found")) + self.error(_("Script not found")) action, inputs = self.parse_html_form(pyfile.url.replace(".", "\.").replace( "?", "\?")) if not action: - self.error(_("form not found")) + self.error(_("Form not found")) self.download(action, post=inputs) diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index 85d03489d..08e22a9df 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -45,21 +45,16 @@ class IfolderRu(SimpleHoster): self.get_fileInfo() session_id = re.search(self.SESSION_ID_PATTERN, self.html).groups() - captcha_url = "http://ints.rusfolder.com/random/images/?session=%s" % session_id - for _i in xrange(5): - action, inputs = self.parse_html_form('id="download-step-one-form"') - inputs['confirmed_number'] = self.captcha.decrypt(captcha_url, cookies=True) - inputs['action'] = '1' - self.log_debug(inputs) - - self.html = self.load(url, post=inputs) - if self.WRONG_CAPTCHA_PATTERN in self.html: - self.captcha.invalid() - else: - break - else: - self.fail(_("Invalid captcha")) + + action, inputs = self.parse_html_form('id="download-step-one-form"') + inputs['confirmed_number'] = self.captcha.decrypt(captcha_url, cookies=True) + inputs['action'] = '1' + self.log_debug(inputs) + + self.html = self.load(url, post=inputs) + if self.WRONG_CAPTCHA_PATTERN in self.html: + self.retry_captcha() self.link = re.search(self.LINK_FREE_PATTERN, self.html).group(1) diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index bf4b157cb..427dbbec7 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2ShareCc(SimpleHoster): __name__ = "Keep2ShareCc" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.26" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+)' @@ -42,18 +42,18 @@ class Keep2ShareCc(SimpleHoster): def check_errors(self): m = re.search(self.TEMP_ERROR_PATTERN, self.html) - if m: + if m is not None: self.info['error'] = m.group(1) self.wantReconnect = True - self.retry(wait_time=30 * 60, reason=m.group(0)) + self.retry(wait=30 * 60, msg=m.group(0)) m = re.search(self.ERROR_PATTERN, self.html) - if m: + if m is not None: errmsg = self.info['error'] = m.group(1) self.error(errmsg) m = re.search(self.WAIT_PATTERN, self.html) - if m: + if m is not None: self.log_debug("Hoster told us to wait for %s" % m.group(1)) #: String to time convert courtesy of https://stackoverflow.com/questions/10663720 @@ -61,7 +61,7 @@ class Keep2ShareCc(SimpleHoster): wait_time = sum(a * b for a, b in zip(ftr, map(int, m.group(1).split(':')))) self.wantReconnect = True - self.retry(wait_time=wait_time, reason="Please wait to download this file") + self.retry(wait=wait_time, msg="Please wait to download this file") self.info.pop('error', None) @@ -95,11 +95,11 @@ class Keep2ShareCc(SimpleHoster): 'yt0' : ''} m = re.search(r'id="(captcha\-form)"', self.html) - self.log_debug("captcha-form found %s" % m) + self.log_debug("Captcha form found", m) m = re.search(self.CAPTCHA_PATTERN, self.html) self.log_debug("CAPTCHA_PATTERN found %s" % m) - if m: + if m is not None: captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1)) post_data['CaptchaForm[code]'] = self.captcha.decrypt(captcha_url) else: @@ -110,10 +110,10 @@ class Keep2ShareCc(SimpleHoster): self.html = self.load(self.pyfile.url, post=post_data) - if 'verification code is incorrect' not in self.html: - self.captcha.correct() + if 'verification code is incorrect' in self.html: + self.retry_captcha() else: - self.captcha.invalid() + self.captcha.correct() getInfo = create_getInfo(Keep2ShareCc) diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py index 98f74ad0d..3f7b0bfb9 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -56,7 +56,7 @@ class KingfilesNet(SimpleHoster): self.error(_("Random key not found")) rand = m.group(1) - self.log_debug("rand = ", rand) + self.log_debug("rand = " + rand) post_data = {'op' : "download2", 'id' : self.info['pattern']['ID'], diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index e93b60460..b8a563007 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -35,7 +35,7 @@ def get_info(urls): class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.33" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+' @@ -60,7 +60,7 @@ class LetitbitNet(SimpleHoster): def handle_free(self, pyfile): action, inputs = self.parse_html_form('id="ifree_form"') if not action: - self.error(_("ifree_form")) + self.error(_("Form not found")) pyfile.size = float(inputs['sssize']) self.log_debug(action, inputs) @@ -99,16 +99,12 @@ class LetitbitNet(SimpleHoster): self.log_debug(res) - if not res: - self.captcha.invalid() + if not res or res == "error_wrong_captcha": + self.retry_captcha() - if res == "error_free_download_blocked": + elif res == "error_free_download_blocked": self.log_warning(_("Daily limit reached")) - self.wait(seconds_to_midnight(gmt=2), True) - - if res == "error_wrong_captcha": - self.captcha.invalid() - self.retry() + self.wait(seconds_to_midnight(), True) elif res.startswith('['): urls = json_loads(res) @@ -123,10 +119,9 @@ class LetitbitNet(SimpleHoster): def handle_premium(self, pyfile): - api_key = self.user - premium_key = self.account.get_info(self.user)['login']['password'] + premium_key = self.account.get_login('password') - json_data = [api_key, ["download/direct_links", {'pass': premium_key, 'link': pyfile.url}]] + json_data = [self.account.user, ["download/direct_links", {'pass': premium_key, 'link': pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) self.log_debug("API Data: " + api_rep) api_rep = json_loads(api_rep) diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 1c3f86d4a..f92681f60 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class LinksnappyCom(MultiHoster): __name__ = "LinksnappyCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __pattern__ = r'https?://(?:[^/]+\.)?linksnappy\.com' @@ -26,8 +26,8 @@ class LinksnappyCom(MultiHoster): host = self._get_host(pyfile.url) json_params = json_dumps({'link' : pyfile.url, 'type' : host, - 'username': self.user, - 'password': self.account.get_info(self.user)['login']['password']}) + 'username': self.account.user, + 'password': self.account.get_login('password')}) r = self.load("http://linksnappy.com/api/linkgen", post={'genLinks': json_params}) diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py index 7a42e0360..722f0e518 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -50,7 +50,7 @@ class LoadTo(SimpleHoster): #: Set Timer - may be obsolete m = re.search(self.WAIT_PATTERN, self.html) - if m: + if m is not None: self.wait(m.group(1)) #: Load.to is using solvemedia captchas since ~july 2014: diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 788c1aca8..f9c7a89ef 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LuckyShareNet(SimpleHoster): __name__ = "LuckyShareNet" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?luckyshare\.net/(?P<ID>\d{10,})' @@ -29,14 +29,14 @@ class LuckyShareNet(SimpleHoster): if 'AJAX Error' in rep: html = self.load(self.pyfile.url) m = re.search(r"waitingtime = (\d+);", html) - if m: + if m is not None: seconds = int(m.group(1)) self.log_debug("You have to wait %d seconds between free downloads" % seconds) - self.retry(wait_time=seconds) + self.retry(wait=seconds) else: self.error(_("Unable to detect wait time between free downloads")) elif 'Hash expired' in rep: - self.retry(reason=_("Hash expired")) + self.retry(msg=_("Hash expired")) return json_loads(rep) @@ -52,24 +52,20 @@ class LuckyShareNet(SimpleHoster): recaptcha = ReCaptcha(self) - for _i in xrange(5): - response, challenge = recaptcha.challenge() - rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % - (challenge, response, json['hash'])) - self.log_debug("JSON: " + rep) - if 'link' in rep: - json.update(self.parse_json(rep)) - self.captcha.correct() - break - elif 'Verification failed' in rep: - self.captcha.invalid() - else: - self.error(_("Unable to get downlaod link")) + response, challenge = recaptcha.challenge() + rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % + (challenge, response, json['hash'])) + + self.log_debug("JSON: " + rep) - if not json['link']: - self.fail(_("No Download url retrieved/all captcha attempts failed")) + if 'Verification failed' in rep: + self.retry_captcha() - self.link = json['link'] + elif 'link' in rep: + self.captcha.correct() + json.update(self.parse_json(rep)) + if json['link']: + self.link = json['link'] getInfo = create_getInfo(LuckyShareNet) diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 3ba191160..1abe87cd2 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -8,10 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MediafireCom(SimpleHoster): __name__ = "MediafireCom" __type__ = "hoster" - __version__ = "0.90" + __version__ = "0.91" __status__ = "testing" - __pattern__ = r'https?://(?:www\.)?mediafire\.com/(file/|view/\??|download(\.php\?|/)|\?)(?P<ID>\w{15})' + __pattern__ = r'https?://(?:www\.)?mediafire\.com/(file/|view/\??|download(\.php\?|/)|\?)(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Mediafire.com hoster plugin""" @@ -69,7 +69,7 @@ class MediafireCom(SimpleHoster): self.html = self.load(self.link, post={'downloadp': password}) if self.PASSWORD_PATTERN in self.html: - self.fail(_("Incorrect password")) + self.fail(_("Wrong password")) return super(MediafireCom, self).handle_free(pyfile) diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 4afba0a3a..0dfc16c34 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -48,7 +48,7 @@ class MegaDebridEu(MultiHoster): Return The debrided link if succeed or original link if fail """ if not self.api_load(): - self.error("Unable to connect to remote API") + self.error(_("Unable to connect to remote API")) jsonResponse = self.load(self.API_URL, get={'action': 'getLink', 'token': self.token}, diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index 13f462585..69c1c411b 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -22,7 +22,7 @@ def get_info(urls): class MegaRapidCz(SimpleHoster): __name__ = "MegaRapidCz" __type__ = "hoster" - __version__ = "0.57" + __version__ = "0.59" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' @@ -54,15 +54,12 @@ class MegaRapidCz(SimpleHoster): def handle_premium(self, pyfile): m = re.search(self.LINK_PREMIUM_PATTERN, self.html) - if m: + if m is not None: self.link = m.group(1) - else: - if re.search(self.ERR_LOGIN_PATTERN, self.html): - self.relogin(self.user) - self.retry(wait_time=60, reason=_("User login failed")) - elif re.search(self.ERR_CREDIT_PATTERN, self.html): - self.fail(_("Not enough credit left")) + elif re.search(self.ERR_LOGIN_PATTERN, self.html): + self.relogin() + self.retry(wait=60, msg=_("User login failed")) - else: - self.fail(_("Download link not found")) + elif re.search(self.ERR_CREDIT_PATTERN, self.html): + self.fail(_("Not enough credit left")) diff --git a/module/plugins/hoster/MegaRapidoNet.py b/module/plugins/hoster/MegaRapidoNet.py index 6676a565d..573586639 100644 --- a/module/plugins/hoster/MegaRapidoNet.py +++ b/module/plugins/hoster/MegaRapidoNet.py @@ -23,7 +23,7 @@ def random_with_n_digits(n): class MegaRapidoNet(MultiHoster): __name__ = "MegaRapidoNet" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'http://(?:www\.)?\w+\.megarapido\.net/\?file=\w+' @@ -42,15 +42,15 @@ class MegaRapidoNet(MultiHoster): def handle_premium(self, pyfile): self.html = self.load("http://megarapido.net/gerar.php", - post={'rand' :random_with_N_digits(16), - 'urllist' : pyfile.url, - 'links' : pyfile.url, - 'exibir' : "normal", - 'usar' : "premium", - 'user' : self.account.get_data(self.user).get('sid', None), - 'autoreset': ""}) + post={'rand' :random_with_N_digits(16), + 'urllist' : pyfile.url, + 'links' : pyfile.url, + 'exibir' : "normal", + 'usar' : "premium", + 'user' : self.account.get_data('sid'), + 'autoreset': ""}) if "desloga e loga novamente para gerar seus links" in self.html.lower(): - self.error("You have logged in at another place") + self.error(_("You have logged in at another place")) return super(MegaRapidoNet, self).handle_premium(pyfile) diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index b6692263f..b183b882d 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" - __version__ = "0.29" + __version__ = "0.32" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+' @@ -46,43 +46,40 @@ class MegasharesCom(SimpleHoster): def handle_free(self, pyfile): if self.NO_SLOTS_PATTERN in self.html: - self.retry(wait_time=5 * 60) + self.retry(wait=5 * 60) m = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) - if m: + if m is not None: passport_num = m.group(1) request_uri = re.search(self.REQUEST_URI_PATTERN, self.html).group(1) - for _i in xrange(5): - random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1) + random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1) - verifyinput = self.captcha.decrypt("http://d01.megashares.com/index.php", - get={'secgfx': "gfx", 'random_num': random_num}) + verifyinput = self.captcha.decrypt("http://d01.megashares.com/index.php", + get={'secgfx': "gfx", 'random_num': random_num}) - self.log_info(_("Reactivating passport %s: %s %s") % (passport_num, random_num, verifyinput)) + self.log_info(_("Reactivating passport %s: %s %s") % (passport_num, random_num, verifyinput)) - res = self.load("http://d01.megashares.com%s" % request_uri, - get={'rs' : "check_passport_renewal", - 'rsargs[]': verifyinput, - 'rsargs[]': random_num, - 'rsargs[]': passport_num, - 'rsargs[]': "replace_sec_pprenewal", - 'rsrnd[]' : str(int(time.time() * 1000))}) + res = self.load("http://d01.megashares.com%s" % request_uri, + get={'rs' : "check_passport_renewal", + 'rsargs[]': verifyinput, + 'rsargs[]': random_num, + 'rsargs[]': passport_num, + 'rsargs[]': "replace_sec_pprenewal", + 'rsrnd[]' : str(int(time.time() * 1000))}) - if 'Thank you for reactivating your passport.' in res: - self.captcha.correct() - self.retry() - else: - self.captcha.invalid() + if 'Thank you for reactivating your passport' in res: + self.captcha.correct() + self.restart(premium=True) else: - self.fail(_("Failed to reactivate passport")) + self.retry_captcha(msg=_("Failed to reactivate passport")) m = re.search(self.PASSPORT_RENEW_PATTERN, self.html) - if m: + if m is not None: time = [int(x) for x in m.groups()] renew = time[0] + (time[1] * 60) + (time[2] * 60) self.log_debug("Waiting %d seconds for a new passport" % renew) - self.retry(wait_time=renew, reason=_("Passport renewal")) + self.retry(wait=renew, msg=_("Passport renewal")) #: Check traffic left on passport m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S) @@ -94,13 +91,12 @@ class MegasharesCom(SimpleHoster): self.log_info(_("Data left: %s %s (%d MB needed)") % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: - self.retry(wait_time=600, reason=_("Passport renewal")) + self.retry(wait=600, msg=_("Passport renewal")) self.handle_download(False) def handle_download(self, premium=False): - #: Find download link m = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) msg = _('%s download URL' % ('Premium' if premium else 'Free')) if m is None: diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index 6b69fa9c2..1124dadce 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MultishareCz(SimpleHoster): __name__ = "MultishareCz" __type__ = "hoster" - __version__ = "0.42" + __version__ = "0.43" __status__ = "testing" __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+)' @@ -42,7 +42,7 @@ class MultishareCz(SimpleHoster): self.check_info() - if not self.check_traffic_left(): + if not self.check_traffic(): self.fail(_("Not enough credit left to download file")) self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random.random() * 10000 * random.random()), diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py index bbd678ba0..ff28d5dfd 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class MyfastfileCom(MultiHoster): __name__ = "MyfastfileCom" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' @@ -27,7 +27,8 @@ class MyfastfileCom(MultiHoster): def handle_premium(self, pyfile): self.html = self.load('http://myfastfile.com/api.php', - get={'user': self.user, 'pass': self.account.get_info(self.user)['login']['password'], + get={'user': self.account.user, + 'pass': self.account.get_login('password'), 'link': pyfile.url}) self.log_debug("JSON data: " + self.html) diff --git a/module/plugins/hoster/MystoreTo.py b/module/plugins/hoster/MystoreTo.py index e4432f491..b23ca10bd 100644 --- a/module/plugins/hoster/MystoreTo.py +++ b/module/plugins/hoster/MystoreTo.py @@ -19,7 +19,7 @@ class MystoreTo(SimpleHoster): __description__ = """Mystore.to hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zapp-brannigan", "")] + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] NAME_PATTERN = r'<h1>(?P<N>.+?)<' diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index b0d4a4960..bea04c9cd 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -34,33 +34,25 @@ class NarodRu(SimpleHoster): def handle_free(self, pyfile): - for _i in xrange(5): - self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random.random() * 777)) + self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random.random() * 777)) - m = re.search(self.CAPTCHA_PATTERN, self.html) - if m is None: - self.error(_("Captcha")) + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m is None: + self.error(_("Captcha")) - post_data = {'action': "sendcapcha"} - captcha_url, post_data['key'] = m.groups() - post_data['rep'] = self.captcha.decrypt(captcha_url) + post_data = {'action': "sendcapcha"} + captcha_url, post_data['key'] = m.groups() + post_data['rep'] = self.captcha.decrypt(captcha_url) - self.html = self.load(pyfile.url, post=post_data) + self.html = self.load(pyfile.url, post=post_data) - m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: - self.link = urlparse.urljoin("http://narod.ru", m.group(1)) - self.captcha.correct() - break + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is not None: + self.captcha.correct() + self.link = urlparse.urljoin("http://narod.ru/", m.group(1)) - elif u'<b class="error-msg"><strong>ÐÑОблОÑÑ?</strong>' in self.html: - self.captcha.invalid() - - else: - self.error(_("Download link")) - - else: - self.fail(_("No valid captcha code entered")) + elif u'<b class="error-msg"><strong>ÐÑОблОÑÑ?</strong>' in self.html: + self.retry_captcha() getInfo = create_getInfo(NarodRu) diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 9e2a5a93c..8657d4527 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster class NoPremiumPl(MultiHoster): __name__ = "NoPremiumPl" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'https?://direct\.nopremium\.pl.+' @@ -39,7 +39,7 @@ class NoPremiumPl(MultiHoster): def prepare(self): super(NoPremiumPl, self).prepare() - data = self.account.get_data(self.user) + data = self.account.get_data() self.usr = data['usr'] self.pwd = data['pwd'] @@ -66,14 +66,14 @@ class NoPremiumPl(MultiHoster): data = self.run_file_query(pyfile.url, 'fileinfo') except Exception: - self.log_debug("runFileQuery error") + self.log_debug("Query error #1") self.temp_offline() try: parsed = json_loads(data) except Exception: - self.log_debug("loads error") + self.log_debug("Data not found") self.temp_offline() self.log_debug(parsed) @@ -84,10 +84,8 @@ class NoPremiumPl(MultiHoster): self.fail(self.ERROR_CODES[parsed['errno']] % self.__name__) else: #: Error code isn't yet added to plugin - self.fail( - parsed['errstring'] - or _("Unknown error (code: %s)") % parsed['errno'] - ) + self.fail(parsed['errstring'] or + _("Unknown error (code: %s)") % parsed['errno']) if "sdownload" in parsed: if parsed['sdownload'] == "1": @@ -102,5 +100,5 @@ class NoPremiumPl(MultiHoster): self.link = self.run_file_query(pyfile.url, 'filedownload') except Exception: - self.log_debug("runFileQuery error #2") + self.log_debug("Query error #2") self.temp_offline() diff --git a/module/plugins/hoster/NosuploadCom.py b/module/plugins/hoster/NosuploadCom.py index 7de26f3fb..45521eebf 100644 --- a/module/plugins/hoster/NosuploadCom.py +++ b/module/plugins/hoster/NosuploadCom.py @@ -25,18 +25,18 @@ class NosuploadCom(XFSHoster): def get_download_link(self): - #: stage1: press the "Free Download" button + #: Stage1: press the "Free Download" button data = self.get_post_parameters() self.html = self.load(self.pyfile.url, post=data) - #: stage2: wait some time and press the "Download File" button + #: Stage2: wait some time and press the "Download File" button data = self.get_post_parameters() wait_time = re.search(self.WAIT_PATTERN, self.html, re.M | re.S).group(1) self.log_debug("Hoster told us to wait %s seconds" % wait_time) self.wait(wait_time) self.html = self.load(self.pyfile.url, post=data) - #: stage3: get the download link + #: Stage3: get the download link return re.search(self.LINK_PATTERN, self.html, re.S).group(1) diff --git a/module/plugins/hoster/NowDownloadSx.py b/module/plugins/hoster/NowDownloadSx.py index 876a7bcb5..73b0efeaa 100644 --- a/module/plugins/hoster/NowDownloadSx.py +++ b/module/plugins/hoster/NowDownloadSx.py @@ -3,7 +3,6 @@ import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.utils import fixup class NowDownloadSx(SimpleHoster): @@ -29,7 +28,7 @@ class NowDownloadSx(SimpleHoster): WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),' LINK_FREE_PATTERN = r'(http://s\d+(?:\.coolcdn\.info|\.mighycdndelivery\.com)/nowdownload/.+?)["\']' - NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<.*?>', '')] + NAME_REPLACEMENTS = [(r'<.*?>', '')] def setup(self): @@ -45,7 +44,7 @@ class NowDownloadSx(SimpleHoster): self.error() m = re.search(self.WAIT_PATTERN, self.html) - if m: + if m is not None: wait = int(m.group(1)) else: wait = 60 @@ -57,10 +56,8 @@ class NowDownloadSx(SimpleHoster): self.html = self.load(baseurl + str(continuelink.group(1))) m = re.search(self.LINK_FREE_PATTERN, self.html) - if m is None: - self.error(_("Download link not found")) - - self.link = m.group(1) + if m is not None: + self.link = m.group(1) getInfo = create_getInfo(NowDownloadSx) diff --git a/module/plugins/hoster/NowVideoSx.py b/module/plugins/hoster/NowVideoSx.py index c1f369f2a..b919d74ab 100644 --- a/module/plugins/hoster/NowVideoSx.py +++ b/module/plugins/hoster/NowVideoSx.py @@ -37,10 +37,8 @@ class NowVideoSx(SimpleHoster): self.html = self.load("http://www.nowvideo.sx/mobile/video.php", get={'id': self.info['pattern']['ID']}) m = re.search(self.LINK_FREE_PATTERN, self.html) - if m is None: - self.error(_("Free download link not found")) - - self.link = m.group(1) + if m is not None: + self.link = m.group(1) getInfo = create_getInfo(NowVideoSx) diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 8420c6f02..77cf6b68f 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -13,7 +13,7 @@ from module.plugins.captcha.ReCaptcha import ReCaptcha class OboomCom(Hoster): __name__ = "OboomCom" __type__ = "hoster" - __version__ = "0.36" + __version__ = "0.38" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?oboom\.com/(?:#(?:id=|/)?)?(?P<ID>\w{8})' @@ -58,7 +58,7 @@ class OboomCom(Hoster): def get_session_token(self): if self.premium: - accountInfo = self.account.get_data(self.user, True) + accountInfo = self.account.get_data() if "session" in accountInfo: self.session_token = accountInfo['session'] else: @@ -74,41 +74,36 @@ class OboomCom(Hoster): def solve_captcha(self): recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) - for _i in xrange(5): - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) - apiUrl = "http://www.oboom.com/1.0/download/ticket" - params = {'recaptcha_challenge_field': challenge, - 'recaptcha_response_field': response, - 'download_id': self.file_id, - 'token': self.session_token} - result = self.load_url(apiUrl, params) + apiUrl = "http://www.oboom.com/1.0/download/ticket" + params = {'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': response, + 'download_id': self.file_id, + 'token': self.session_token} - if result[0] == 200: - self.download_token = result[1] - self.download_auth = result[2] - self.captcha.correct() - self.wait(30) - break - - elif result[0] == 400: - if result[1] == "incorrect-captcha-sol": - self.captcha.invalid() - elif result[1] == "captcha-timeout": - self.captcha.invalid() - elif result[1] == "forbidden": - self.retry(5, 15 * 60, _("Service unavailable")) - - elif result[0] == 403: + result = self.load_url(apiUrl, params) + + if result[0] == 200: + self.download_token = result[1] + self.download_auth = result[2] + self.captcha.correct() + self.wait(30) + + else: + if result[0] == 403: if result[1] == -1: #: Another download is running self.set_wait(15 * 60) else: self.set_wait(result[1], True) + self.wait() self.retry(5) - else: - self.captcha.invalid() - self.fail(_("Received invalid captcha 5 times")) + + elif result[0] == 400 and result[1] == "forbidden": + self.retry(5, 15 * 60, _("Service unavailable")) + + self.retry_captcha() def get_fileInfo(self, token, fileId): @@ -141,6 +136,6 @@ class OboomCom(Hoster): self.download_domain = result[1] self.download_ticket = result[2] elif result[0] == 421: - self.retry(wait_time=result[2] + 60, reason=_("Connection limit exceeded")) + self.retry(wait=result[2] + 60, msg=_("Connection limit exceeded")) else: self.fail(_("Could not retrieve download ticket. Error code: %s") % result[0]) diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index c564dc677..f525e5b33 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -2,13 +2,14 @@ import re +from module.network.RequestFactory import getURL as get_url from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.86" + __version__ = "0.90" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?' @@ -28,7 +29,9 @@ class OneFichierCom(SimpleHoster): COOKIES = [("1fichier.com", "LG", "en")] - NAME_PATTERN = r'>FileName :</td>\s*<td.*>(?P<N>.+?)<' + DIRECT_LINK = True + + NAME_PATTERN = r'>File\s*Name :</td>\s*<td.*>(?P<N>.+?)<' SIZE_PATTERN = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'File not found !\s*<' @@ -40,12 +43,66 @@ class OneFichierCom(SimpleHoster): self.resume_download = True + @classmethod + def get_info(cls, url="", html=""): + redirect = url + for i in xrange(10): + try: + headers = dict(re.findall(r"(?P<name>.+?): (?P<value>.+?)\r?\n", get_url(redirect, just_header=True).lower())) + if 'location' in headers and headers['location']: + redirect = headers['location'] + else: + if 'content-type' in headers and headers['content-type'] == "application/octet-stream": + if "filename=" in headers.get('content-disposition'): + name = dict(_i.split("=") for _i in map(str.strip, headers['content-disposition'].split(";"))[1:])['filename'].strip("\"'") + else: + name = url + + info = {'name' : name, + 'size' : long(headers.get('content-length')), + 'status': 3, + 'url' : url} + + else: + info = super(OneFichierCom, cls).get_info(url, html) + + break + + except Exception, e: + info = {'status' : 8, + 'error' : e.message} + + else: + info = {'status' : 8, + 'error' : _("Too many redirects")} + + return info + + + def handle_direct(self, pyfile): + redirect = pyfile.url + for i in xrange(self.get_config("maxredirs", plugin="UserAgentSwitcher")): + + headers = self.load(redirect, just_header=True) + if 'location' in headers and headers['location']: + self.log_debug("Redirect #%d to: %s" % (i, redirect)) + redirect = headers['location'] + else: + if 'content-type' in headers and headers['content-type'] == "application/octet-stream": + self.link = pyfile.url + break + else: + self.fail(_("Too many redirects")) + + def handle_free(self, pyfile): + self.check_errors() + id = self.info['pattern']['ID1'] or self.info['pattern']['ID2'] url, inputs = self.parse_html_form('action="https://1fichier.com/\?%s' % id) if not url: - self.fail(_("Download link not found")) + return if "pass" in inputs: inputs['pass'] = self.get_password() diff --git a/module/plugins/hoster/OpenloadIo.py b/module/plugins/hoster/OpenloadIo.py index c46462344..6213a9c09 100644 --- a/module/plugins/hoster/OpenloadIo.py +++ b/module/plugins/hoster/OpenloadIo.py @@ -1,31 +1,74 @@ # -*- coding: utf-8 -*- +import json +import re + +from module.network.RequestFactory import getURL from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OpenloadIo(SimpleHoster): __name__ = "OpenloadIo" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.07" __status__ = "testing" - __pattern__ = r'https?://(?:www\.)?openload\.io/f/[\w_-]{11}' + __pattern__ = r'https?://(?:www\.)?openload\.(?:co|io)/f/([\w-_]+)' - __description__ = """Openload.io hoster plugin""" + __description__ = """Openload.co hoster plugin""" __license__ = "GPLv3" __authors__ = [(None, None)] - NAME_PATTERN = r'<span id="filename">(?P<N>.+?)</' - SIZE_PATTERN = r'<span class="count">(?P<S>[\d.,]+) (?P<U>[\w^_]+)<' - OFFLINE_PATTERN = r">(We can't find the file you are looking for)" + # The API reference, that this implementation uses is available at https://openload.co/api + API_URL = 'https://api.openload.co/1' + + _FILE_ID_PATTERN = '/f/([\w-_]+)' + + _DOWNLOAD_TICKET_URI_PATTERN = '/file/dlticket?file={0}' + _DOWNLOAD_FILE_URI_PATTERN = '/file/dl?file={0}&ticket={1}' + _FILE_INFO_URI_PATTERN = '/file/info?file={0}' + + + @classmethod + def _load_json(cls, uri): + return json.loads(getURL(cls.API_URL + uri)) + + + @classmethod + def get_info(cls, url="", html=""): + file_id = re.findall(cls._FILE_ID_PATTERN, url, re.I) + if not file_id: + return super(OpenloadIo, cls).get_info(url) - LINK_FREE_PATTERN = r'id="real\w*download"><a href="(https?://[\w\.]+\.openload\.io/dl/.*?)"' + file_id = file_id[0] + info_json = cls._load_json(cls._FILE_INFO_URI_PATTERN.format(file_id)) + file_info = info_json['result'][file_id] + + return {'name' : file_info['name'], + 'size' : file_info['size'], + 'status': 3 if url.strip() else 8, + 'url' : url} def setup(self): - self.multiDL = True + self.multiDL = True self.chunk_limit = 1 + def handle_free(self, pyfile): + # If the link is being handled here, then it matches the file_id_pattern, + # therefore, we can call [0] safely. + file_id = re.findall(self._FILE_ID_PATTERN, pyfile.url, re.I)[0] + + ticket_json = self._load_json(self._DOWNLOAD_TICKET_URI_PATTERN.format(file_id)) + + self.wait(ticket_json['result']['wait_time']) + + ticket = ticket_json['result']['ticket'] + + download_json = self._load_json(self._DOWNLOAD_FILE_URI_PATTERN.format(file_id, ticket)) + self.link = download_json['result']['url'] + + getInfo = create_getInfo(OpenloadIo) diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index 0b5bab6a5..a2bbfc701 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -11,7 +11,7 @@ from module.utils import parseFileSize as parse_size class OverLoadMe(MultiHoster): __name__ = "OverLoadMe" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r'https?://.*overload\.me/.+' @@ -28,7 +28,7 @@ class OverLoadMe(MultiHoster): def handle_premium(self, pyfile): - data = self.account.get_data(self.user) + data = self.account.get_data() page = self.load("https://api.over-load.me/getdownload.php", get={'auth': data['password'], 'link': pyfile.url}) diff --git a/module/plugins/hoster/PornhostCom.py b/module/plugins/hoster/PornhostCom.py index 8b0a80c7f..e9d199a2e 100644 --- a/module/plugins/hoster/PornhostCom.py +++ b/module/plugins/hoster/PornhostCom.py @@ -49,7 +49,7 @@ class PornhostCom(Hoster): url = re.search(r'"http://file\d+\.pornhost\.com/\d+/.*?"', self.html) #@TODO: fix this one since it doesn't match - return url.group(1).strip() + return url.group(1) def get_file_name(self): diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index 5345566a1..ce6badedd 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -67,7 +67,7 @@ class PornhubCom(Hoster): self.download_html() m = re.search(r'<title.+?>([^<]+) - ', self.html) - if m: + if m is not None: name = m.group(1) else: matches = re.findall('<h1>(.*?)</h1>', self.html) diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index ec02bb12d..8186c6224 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -11,7 +11,7 @@ from module.utils import fs_encode class PremiumTo(MultiHoster): __name__ = "PremiumTo" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -37,8 +37,8 @@ class PremiumTo(MultiHoster): disposition=True) - def check_file(self): - if self.check_download({'nopremium': "No premium account available"}): + def check_download(self): + if self.check_file({'nopremium': "No premium account available"}): self.retry(60, 5 * 60, "No premium account available") err = "" @@ -52,7 +52,7 @@ class PremiumTo(MultiHoster): if err: self.fail(err) - return super(PremiumTo, self).check_file() + return super(PremiumTo, self).check_download() getInfo = create_getInfo(PremiumTo) diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py index d968eccec..16c252dc1 100644 --- a/module/plugins/hoster/PremiumizeMe.py +++ b/module/plugins/hoster/PremiumizeMe.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class PremiumizeMe(MultiHoster): __name__ = "PremiumizeMe" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate @@ -44,11 +44,17 @@ class PremiumizeMe(MultiHoster): status = data['status'] if status == 200: + if 'filename' in data['result']: + self.pyfile.name = data['result']['filename'] + + if 'filesize' in data['result']: + self.pyfile.size = data['result']['filesize'] + self.link = data['result']['location'] return elif status == 400: - self.fail(_("Invalid link")) + self.fail(_("Invalid url")) elif status == 404: self.offline() diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 4311a82aa..62240667c 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class QuickshareCz(SimpleHoster): __name__ = "QuickshareCz" __type__ = "hoster" - __version__ = "0.57" + __version__ = "0.58" __status__ = "testing" __pattern__ = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.+' @@ -39,7 +39,7 @@ class QuickshareCz(SimpleHoster): if 'UU_prihlasen' in self.jsvars: if self.jsvars['UU_prihlasen'] == "0": self.log_warning(_("User not logged in")) - self.relogin(self.user) + self.relogin() self.retry() elif float(self.jsvars['UU_kredit']) < float(self.jsvars['kredit_odecet']): self.log_warning(_("Not enough credit left")) @@ -50,7 +50,7 @@ class QuickshareCz(SimpleHoster): else: self.handle_free(pyfile) - if self.check_download({'error': re.compile(r"\AChyba!")}, max_size=100): + if self.check_file({'error': re.compile(r"\AChyba!")}, max_size=100): self.fail(_("File not m or plugin defect")) @@ -69,12 +69,12 @@ class QuickshareCz(SimpleHoster): if m is None: self.fail(_("File not found")) - self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 + self.link = m.group(1) self.log_debug("FREE URL2:" + self.link) #: Check errors m = re.search(r'/chyba/(\d+)', self.link) - if m: + if m is not None: if m.group(1) == "1": self.retry(60, 2 * 60, "This IP is already downloading") elif m.group(1) == "2": diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index 62e6bee4e..cbe3e2a52 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -28,7 +28,6 @@ class RPNetBiz(MultiHoster): def handle_premium(self, pyfile): user, info = self.account.select() - #: Get the download link res = self.load("https://premium.rpnet.biz/client_api.php", get={'username': user, 'password': info['login']['password'], @@ -44,10 +43,10 @@ class RPNetBiz(MultiHoster): self.wait(30) #: Wait for 30 seconds #: Lets query the server again asking for the status on the link, #: We need to keep doing this until we reach 100 - max_tries = 30 + attemps = 30 my_try = 0 - while (my_try <= max_tries): - self.log_debug("Try: %d ; Max Tries: %d" % (my_try, max_tries)) + while (my_try <= attemps): + self.log_debug("Try: %d ; Max Tries: %d" % (my_try, attemps)) res = self.load("https://premium.rpnet.biz/client_api.php", get={'username': user, 'password': info['login']['password'], @@ -66,7 +65,7 @@ class RPNetBiz(MultiHoster): self.wait(30) my_try += 1 - if my_try > max_tries: #: We went over the limit! + if my_try > attemps: #: We went over the limit! self.fail(_("Waited for about 15 minutes for download to finish but failed")) if 'generated' in link_status: diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index e1a0d278f..a43440e61 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster class RapideoPl(MultiHoster): __name__ = "RapideoPl" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -39,7 +39,7 @@ class RapideoPl(MultiHoster): def prepare(self): super(RapideoPl, self).prepare() - data = self.account.get_data(self.user) + data = self.account.get_data() self.usr = data['usr'] self.pwd = data['pwd'] @@ -84,10 +84,8 @@ class RapideoPl(MultiHoster): self.fail(self.ERROR_CODES[parsed['errno']] % self.__name__) else: #: Error code isn't yet added to plugin - self.fail( - parsed['errstring'] - or _("Unknown error (code: %s)") % parsed['errno'] - ) + self.fail(parsed['errstring'] or + _("Unknown error (code: %s)") % parsed['errno']) if "sdownload" in parsed: if parsed['sdownload'] == "1": diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 636ea1bcc..711f33e87 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -14,7 +14,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' @@ -51,7 +51,7 @@ class RapidgatorNet(SimpleHoster): def setup(self): if self.account: - self.sid = self.account.get_data(self.user).get('sid', None) + self.sid = self.account.get_data('sid') else: self.sid = None @@ -81,12 +81,12 @@ class RapidgatorNet(SimpleHoster): return json['response'] elif status == 423: - self.account.empty(self.user) + self.account.empty() self.retry() else: - self.account.relogin(self.user) - self.retry(wait_time=60) + self.account.relogin() + self.retry(wait=60) def handle_premium(self, pyfile): @@ -122,29 +122,25 @@ class RapidgatorNet(SimpleHoster): url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha') self.html = self.load(url) - for _i in xrange(5): - m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: - self.link = m.group(1) - break - else: - captcha = self.handle_captcha() + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is not None: + self.link = m.group(1) + else: + captcha = self.handle_captcha() - if not captcha: - self.error(_("Captcha pattern not found")) + if not captcha: + self.error(_("Captcha pattern not found")) - response, challenge = captcha.challenge() + response, challenge = captcha.challenge() - self.html = self.load(url, post={'DownloadCaptchaForm[captcha]': "", - 'adcopy_challenge' : challenge, - 'adcopy_response' : response}) + self.html = self.load(url, post={'DownloadCaptchaForm[captcha]': "", + 'adcopy_challenge' : challenge, + 'adcopy_response' : response}) - if "The verification code is incorrect" in self.html: - self.captcha.invalid() - else: - self.captcha.correct() - else: - self.error(_("Download link")) + if "The verification code is incorrect" in self.html: + self.retry_captcha() + else: + self.captcha.correct() def handle_captcha(self): diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py index 267f41f36..99c877226 100644 --- a/module/plugins/hoster/RapiduNet.py +++ b/module/plugins/hoster/RapiduNet.py @@ -20,7 +20,7 @@ class RapiduNet(SimpleHoster): __description__ = """Rapidu.net hoster plugin""" __license__ = "GPLv3" - __authors__ = [("prOq", "")] + __authors__ = [("prOq", None)] COOKIES = [("rapidu.net", "rapidu_lang", "en")] diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index 6f0645e9f..af8ba3fd9 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class RehostTo(MultiHoster): __name__ = "RehostTo" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.24" __status__ = "testing" __pattern__ = r'https?://.*rehost\.to\..+' @@ -23,7 +23,7 @@ class RehostTo(MultiHoster): def handle_premium(self, pyfile): self.download("http://rehost.to/process_download.php", get={'user': "cookie", - 'pass': self.account.get_data(self.user)['session'], + 'pass': self.account.get_data('session'), 'dl' : pyfile.url}, disposition=True) diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py index 13dd20b7c..ece048ed9 100644 --- a/module/plugins/hoster/SendspaceCom.py +++ b/module/plugins/hoster/SendspaceCom.py @@ -30,32 +30,31 @@ class SendspaceCom(SimpleHoster): def handle_free(self, pyfile): - params = {} - for _i in xrange(3): - m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: - if 'captcha_hash' in params: - self.captcha.correct() - self.link = m.group(1) - break + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is not None: + self.link = m.group(1) + else: m = re.search(self.CAPTCHA_PATTERN, self.html) - if m: - if 'captcha_hash' in params: - self.captcha.invalid() + if m is None: + params = {'download': "Regular Download"} + else: 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.captcha.decrypt(captcha_url1) + " " + self.captcha.decrypt(captcha_url2)} - else: - params = {'download': "Regular Download"} self.log_debug(params) + self.html = self.load(pyfile.url, post=params) - else: - self.fail(_("Download link not found")) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.retry_captcha() + else: + self.link = m.group(1) getInfo = create_getInfo(SendspaceCom) diff --git a/module/plugins/hoster/Share4WebCom.py b/module/plugins/hoster/Share4WebCom.py index 3f128be5e..898e12927 100644 --- a/module/plugins/hoster/Share4WebCom.py +++ b/module/plugins/hoster/Share4WebCom.py @@ -7,7 +7,7 @@ from module.plugins.internal.SimpleHoster import create_getInfo class Share4WebCom(UnibytesCom): __name__ = "Share4WebCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?share4web\.com/get/\w+' @@ -17,7 +17,7 @@ class Share4WebCom(UnibytesCom): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "share4web.com" + PLUGIN_DOMAIN = "share4web.com" getInfo = create_getInfo(Share4WebCom) diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index b5af3ea35..2223068e5 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -3,7 +3,6 @@ import re import time import urllib -import urlparse from module.network.RequestFactory import getURL as get_url from module.plugins.captcha.ReCaptcha import ReCaptcha @@ -13,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.55" + __version__ = "0.58" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)' @@ -68,25 +67,20 @@ class ShareonlineBiz(SimpleHoster): def handle_captcha(self): recaptcha = ReCaptcha(self) - - for _i in xrange(5): - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) - - m = re.search(r'var wait=(\d+);', self.html) - self.set_wait(int(m.group(1)) if m else 30) - - res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time.time() * 1000)), - post={'dl_free' : "1", - 'recaptcha_challenge_field': challenge, - 'recaptcha_response_field' : response}) - if not res == "0": - self.captcha.correct() - return res - else: - self.captcha.invalid() + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + + m = re.search(r'var wait=(\d+);', self.html) + self.set_wait(int(m.group(1)) if m else 30) + + res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time.time() * 1000)), + post={'dl_free' : "1", + 'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) + if res != "0": + self.captcha.correct() + return res else: - self.captcha.invalid() - self.fail(_("No valid captcha solution received")) + self.retry_captcha() def handle_free(self, pyfile): @@ -101,30 +95,28 @@ class ShareonlineBiz(SimpleHoster): self.link = res.decode('base64') if not self.link.startswith("http://"): - self.error(_("Wrong download url")) + self.error(_("Invalid url")) self.wait() - def check_file(self): - check = self.check_download({'cookie': re.compile(r'<div id="dl_failure"'), + def check_download(self): + check = self.check_file({'cookie': re.compile(r'<div id="dl_failure"'), 'fail' : re.compile(r"<title>Share-Online")}) if check == "cookie": - self.captcha.invalid() - self.retry(5, 60, _("Cookie failure")) + self.retry_captcha(5, 60, _("Cookie failure")) elif check == "fail": - self.captcha.invalid() - self.retry(5, 5 * 60, _("Download failed")) + self.retry_captcha(5, 5 * 60, _("Download failed")) - return super(ShareonlineBiz, self).check_file() + return super(ShareonlineBiz, self).check_download() def handle_premium(self, pyfile): #: Should be working better loading (account) api internally html = self.load("https://api.share-online.biz/account.php", - get={'username': self.user, - 'password': self.account.get_info(self.user)['login']['password'], + get={'username': self.account.user, + 'password': self.account.get_login('password'), 'act' : "download", 'lid' : self.info['fileid']}) @@ -136,7 +128,7 @@ class ShareonlineBiz(SimpleHoster): self.log_debug(dlinfo) - if not dlinfo['status'] == "online": + if dlinfo['status'] != "online": self.offline() else: pyfile.name = dlinfo['name'] @@ -160,6 +152,7 @@ class ShareonlineBiz(SimpleHoster): try: self.log_error(errmsg, re.search(self.ERROR_PATTERN, self.html).group(1)) + except Exception: self.log_error(_("Unknown error occurred"), errmsg) @@ -170,18 +163,18 @@ class ShareonlineBiz(SimpleHoster): self.fail(_("Premium account needed")) elif errmsg in ("expired", "server"): - self.retry(wait_time=600, reason=errmsg) + self.retry(wait=600, msg=errmsg) elif errmsg == "full": self.retry(10, 600, _("Server is full")) elif 'slot' in errmsg: - self.wantReconnect = True - self.retry(24, 3600, errmsg) + self.wait(3600, reconnect=True) + self.restart(errmsg, premium=True) else: - self.wantReconnect = True - self.retry(wait_time=60, reason=errmsg) + self.wait(60, reconnect=True) + self.restart(errmsg, premium=True) getInfo = create_getInfo(ShareonlineBiz) diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index 11aef0c90..6b4cfed2b 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -40,7 +40,7 @@ class ShareplaceCom(Hoster): #: var zzipitime = 15 m = re.search(r'var zzipitime = (\d+);', self.html) - if m: + if m is not None: sec = int(m.group(1)) else: sec = 0 diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index be1578bfb..8e3890fb8 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import seconds_to_midnight class SimplyPremiumCom(MultiHoster): __name__ = "SimplyPremiumCom" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.12" __status__ = "testing" __pattern__ = r'https?://.+simply-premium\.com' @@ -28,7 +28,7 @@ class SimplyPremiumCom(MultiHoster): def check_errors(self): if '<valid>0</valid>' in self.html or ( "You are not allowed to download from this host" in self.html and self.premium): - self.account.relogin(self.user) + self.account.relogin() self.retry() elif "NOTFOUND" in self.html: @@ -40,7 +40,7 @@ class SimplyPremiumCom(MultiHoster): elif "trafficlimit" in self.html: self.log_warning(_("Reached daily limit for this host")) - self.retry(wait_time=seconds_to_midnight(gmt=2), reason="Daily limit for this host reached") + self.retry(wait=seconds_to_midnight(), msg="Daily limit for this host reached") elif "hostererror" in self.html: self.log_warning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py index 829609228..d26439d68 100644 --- a/module/plugins/hoster/SimplydebridCom.py +++ b/module/plugins/hoster/SimplydebridCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo, rep class SimplydebridCom(MultiHoster): __name__ = "SimplydebridCom" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd\.php' @@ -41,11 +41,11 @@ class SimplydebridCom(MultiHoster): self.wait(5) - def check_file(self): - if self.check_download({'error': "No address associated with hostname"}): + def check_download(self): + if self.check_file({'error': "No address associated with hostname"}): self.retry(24, 3 * 60, _("Bad file downloaded")) - return super(SimplydebridCom, self).check_file() + return super(SimplydebridCom, self).check_download() getInfo = create_getInfo(SimplydebridCom) diff --git a/module/plugins/hoster/SizedriveCom.py b/module/plugins/hoster/SizedriveCom.py index 8bfe46e86..d0db9985b 100644 --- a/module/plugins/hoster/SizedriveCom.py +++ b/module/plugins/hoster/SizedriveCom.py @@ -35,7 +35,7 @@ class SizedriveCom(SimpleHoster): post={'id': self.info['pattern']['ID']}) m = re.search(r'<span id="boton_download" ><a href="(.+?)"', self.html) - if m: + if m is not None: self.link = m.group(1) diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py index 33d098a00..e864bb2c0 100644 --- a/module/plugins/hoster/SmoozedCom.py +++ b/module/plugins/hoster/SmoozedCom.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster class SmoozedCom(MultiHoster): __name__ = "SmoozedCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate @@ -16,7 +16,7 @@ class SmoozedCom(MultiHoster): __description__ = """Smoozed.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("", "")] + __authors__ = [(None, None)] FILE_ERRORS = [("Error", r'{"state":"error"}'), @@ -36,7 +36,7 @@ class SmoozedCom(MultiHoster): pyfile.name = ".".join(temp) #: Check the link - get_data = {'session_key': self.account.get_data(self.user)['session'], + get_data = {'session_key': self.account.get_data('session'), 'url' : pyfile.url} data = json_loads(self.load("http://www2.smoozed.com/api/check", get=get_data)) diff --git a/module/plugins/hoster/SpeedyshareCom.py b/module/plugins/hoster/SpeedyshareCom.py index 7d7a60f04..4a71c179d 100644 --- a/module/plugins/hoster/SpeedyshareCom.py +++ b/module/plugins/hoster/SpeedyshareCom.py @@ -4,7 +4,6 @@ # http://speedy.sh/ep2qY/Zapp-Brannigan.jpg import re -import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index d323a214b..d20d1cadd 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -10,13 +10,14 @@ import urllib from Crypto.Cipher import ARC4 from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp +from module.plugins.internal.Plugin import timestamp +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class TurbobitNet(SimpleHoster): __name__ = "TurbobitNet" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" __status__ = "testing" __pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)' @@ -56,64 +57,64 @@ class TurbobitNet(SimpleHoster): self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With:"]) m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: + if m is not None: self.link = m.group(1) def solve_captcha(self): - for _i in xrange(5): - 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() + m = re.search(self.LIMIT_WAIT_PATTERN, self.html) + if m is not None: + wait_time = int(m.group(1)) + self.wait(wait_time, wait_time > 60) + self.retry() - action, inputs = self.parse_html_form("action='#'") - if not inputs: - self.error(_("Captcha form not found")) - self.log_debug(inputs) + action, inputs = self.parse_html_form("action='#'") + if not inputs: + self.error(_("Captcha form not found")) - if inputs['captcha_type'] == "recaptcha": - recaptcha = ReCaptcha(self) - inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() - else: - m = re.search(self.CAPTCHA_PATTERN, self.html) - if m is None: - self.error(_("captcha")) - captcha_url = m.group(1) - inputs['captcha_response'] = self.captcha.decrypt(captcha_url) + self.log_debug(inputs) - self.log_debug(inputs) - self.html = self.load(self.url, post=inputs) + if inputs['captcha_type'] == "recaptcha": + recaptcha = ReCaptcha(self) + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() + else: + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m is None: + self.error(_("Captcha pattern not found")) + captcha_url = m.group(1) + inputs['captcha_response'] = self.captcha.decrypt(captcha_url) - if '<div class="captcha-error">Incorrect, try again!<' in self.html: - self.captcha.invalid() - else: - self.captcha.correct() - break + self.log_debug(inputs) + + self.html = self.load(self.url, post=inputs) + + if '<div class="captcha-error">Incorrect, try again' in self.html: + self.retry_captcha() else: - self.fail(_("Invalid captcha")) + self.captcha.correct() def get_rt_update(self): rtUpdate = self.retrieve("rtUpdate") - if not rtUpdate: - if self.retrieve("version") is not self.__version__ \ - or int(self.retrieve("timestamp", 0)) + 86400000 < timestamp(): - #: that's right, we are even using jdownloader updates - rtUpdate = self.load("http://update0.jdownloader.org/pluginstuff/tbupdate.js") - rtUpdate = self.decrypt(rtUpdate.splitlines()[1]) - #: But we still need to fix the syntax to work with other engines than rhino - rtUpdate = re.sub(r'for each\(var (\w+) in(\[[^\]]+\])\)\{', - r'zza=\2;for(var zzi=0;zzi<zza.length;zzi++){\1=zza[zzi];', rtUpdate) - rtUpdate = re.sub(r"for\((\w+)=", r"for(var \1=", rtUpdate) - - self.store("rtUpdate", rtUpdate) - self.store("timestamp", timestamp()) - self.store("version", self.__version__) - else: - self.log_error(_("Unable to download, wait for update...")) - self.temp_offline() + if rtUpdate: + return rtUpdate + + if self.retrieve("version") is not self.__version__ or \ + int(self.retrieve("timestamp", 0)) + 86400000 < timestamp(): + #: that's right, we are even using jdownloader updates + rtUpdate = self.load("http://update0.jdownloader.org/pluginstuff/tbupdate.js") + rtUpdate = self.decrypt(rtUpdate.splitlines()[1]) + #: But we still need to fix the syntax to work with other engines than rhino + rtUpdate = re.sub(r'for each\(var (\w+) in(\[[^\]]+\])\)\{', + r'zza=\2;for(var zzi=0;zzi<zza.length;zzi++){\1=zza[zzi];', rtUpdate) + rtUpdate = re.sub(r"for\((\w+)=", r"for(var \1=", rtUpdate) + + self.store("rtUpdate", rtUpdate) + self.store("timestamp", timestamp()) + self.store("version", self.__version__) + else: + self.log_error(_("Unable to download, wait for update...")) + self.temp_offline() return rtUpdate @@ -122,7 +123,7 @@ class TurbobitNet(SimpleHoster): self.req.http.lastURL = self.url m = re.search("(/\w+/timeout\.js\?\w+=)([^\"\'<>]+)", self.html) - if m: + if m is not None: url = "http://turbobit.net%s%s" % m.groups() else: url = "http://turbobit.net/files/timeout.js?ver=%s" % "".join(random.choice('0123456789ABCDEF') for _i in xrange(32)) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index b402433a4..cc07770d4 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -15,7 +15,7 @@ def convert_decimal_prefix(m): class UlozTo(SimpleHoster): __name__ = "UlozTo" __type__ = "hoster" - __version__ = "1.13" + __version__ = "1.16" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)' @@ -26,8 +26,7 @@ class UlozTo(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - INFO_PATTERN = r'<p>File <strong>(?P<N>[^<]+)</strong> is password protected</p>' - NAME_PATTERN = r'<title>(?P<N>[^<]+) \| Uloz\.to</title>' + NAME_PATTERN = r'(<p>File <strong>|<title>)(?P<N>.+?)(<| \|)' SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[\d.,]+\s[kMG]?B)</span>' OFFLINE_PATTERN = r'<title>404 - Page not found</title>|<h1 class="h1">File (has been deleted|was banned)</h1>' @@ -53,7 +52,7 @@ class UlozTo(SimpleHoster): if not action or not inputs: self.error(_("Free download form not found")) - self.log_debug("inputs.keys = " + str(inputs.keys())) + self.log_debug("inputs.keys = %s" % inputs.keys()) #: Get and decrypt captcha if all(key in inputs for key in ("captcha_value", "captcha_id", "captcha_key")): #: Old version - last seen 9.12.2013 @@ -68,8 +67,10 @@ class UlozTo(SimpleHoster): #: New version - better to get new parameters (like captcha reload) because of image url - since 6.12.2013 self.log_debug('Using "new" version') - xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={'rnd': str(int(time.time()))}) - self.log_debug("xapca = " + str(xapca)) + xapca = self.load("http://www.ulozto.net/reloadXapca.php", + get={'rnd': str(int(time.time()))}) + xapca = xapca.replace('sound":"', 'sound":"http:').replace('image":"', 'image":"http:') + self.log_debug("xapca = %s" % xapca) data = json_loads(xapca) captcha_value = self.captcha.decrypt(str(data['image'])) @@ -109,7 +110,7 @@ class UlozTo(SimpleHoster): post={'password': password, 'password_send': 'Send'}) if self.PASSWD_PATTERN in self.html: - self.fail(_("Incorrect password")) + self.fail(_("Wrong password")) else: self.fail(_("No password found")) @@ -119,9 +120,9 @@ class UlozTo(SimpleHoster): return super(UlozTo, self).check_errors() - def check_file(self): - check = self.check_download({ - 'wrong_captcha': re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'), + def check_download(self): + check = self.check_file({ + 'wrong_captcha': ">An error ocurred while verifying the user", 'offline' : re.compile(self.OFFLINE_PATTERN), 'passwd' : self.PASSWD_PATTERN, 'server_error' : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', #: Paralell dl, server overload etc. @@ -129,8 +130,7 @@ class UlozTo(SimpleHoster): }) if check == "wrong_captcha": - self.captcha.invalid() - self.retry(reason=_("Wrong captcha code")) + self.retry_captcha() elif check == "offline": self.offline() @@ -147,7 +147,7 @@ class UlozTo(SimpleHoster): elif check == "not_found": self.fail(_("Server error, file not downloadable")) - return super(UlozTo, self).check_file() + return super(UlozTo, self).check_download() getInfo = create_getInfo(UlozTo) diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index 7cbcb4d40..5bbbb1f7c 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -35,7 +35,7 @@ class UloziskoSk(SimpleHoster): self.get_fileInfo() m = re.search(self.IMG_PATTERN, self.html) - if m: + if m is not None: self.link = "http://ulozisko.sk" + m.group(1) else: self.handle_free(pyfile) @@ -58,7 +58,7 @@ class UloziskoSk(SimpleHoster): if m is None: self.error(_("CAPTCHA_PATTERN not found")) - captcha_url = urlparse.urljoin("http://www.ulozisko.sk", m.group(1)) + captcha_url = urlparse.urljoin("http://www.ulozisko.sk/", m.group(1)) captcha = self.captcha.decrypt(captcha_url, cookies=True) self.log_debug("CAPTCHA_URL:" + captcha_url + ' CAPTCHA:' + captcha) diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index ac2589f47..50006dd27 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UnibytesCom(SimpleHoster): __name__ = "UnibytesCom" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?unibytes\.com/[\w .-]{11}B' @@ -21,7 +21,7 @@ class UnibytesCom(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "unibytes.com" + PLUGIN_DOMAIN = "unibytes.com" INFO_PATTERN = r'<span[^>]*?id="fileName".*?>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)' @@ -30,7 +30,7 @@ class UnibytesCom(SimpleHoster): def handle_free(self, pyfile): - domain = "http://www.%s/" % self.HOSTER_DOMAIN + domain = "http://www.%s/" % self.PLUGIN_DOMAIN action, post_data = self.parse_html_form('id="startForm"') self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) @@ -40,7 +40,7 @@ class UnibytesCom(SimpleHoster): self.html = self.load(urlparse.urljoin(domain, action), post=post_data) m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) - if m: + if m is not None: self.link = m.group(1) break @@ -50,12 +50,12 @@ class UnibytesCom(SimpleHoster): if post_data['step'] == "last": m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: - self.link = m.group(1) + if m is not None: self.captcha.correct() + self.link = m.group(1) break else: - self.captcha.invalid() + self.retry_captcha() last_step = post_data['step'] action, post_data = self.parse_html_form('id="stepForm"') @@ -65,7 +65,7 @@ class UnibytesCom(SimpleHoster): self.wait(m.group(1) if m else 60, False) elif last_step in ("captcha", "last"): - post_data['captcha'] = self.captcha.decrypt(urlparse.urljoin(domain, "/captcha.jpg")) + post_data['captcha'] = self.captcha.decrypt(urlparse.urljoin(domain, "captcha.jpg")) else: self.fail(_("No valid captcha code entered")) diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index db9517f42..9c422ce01 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class UpleaCom(XFSHoster): __name__ = "UpleaCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?uplea\.com/dl/\w{15}' @@ -20,7 +20,7 @@ class UpleaCom(XFSHoster): ("GammaC0de", None)] - HOSTER_DOMAIN = "uplea.com" + PLUGIN_DOMAIN = "uplea.com" SIZE_REPLACEMENTS = [('ko','KB'), ('mo','MB'), ('go','GB'), ('Ko','KB'), ('Mo','MB'), ('Go','GB')] @@ -49,7 +49,7 @@ class UpleaCom(XFSHoster): self.html = self.load(urlparse.urljoin("http://uplea.com/", m.group(1))) m = re.search(self.WAIT_PATTERN, self.html) - if m: + if m is not None: self.log_debug("Waiting %s seconds" % m.group(1)) self.wait(m.group(1), True) self.retry() diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index 88d79e9ba..a3d54e8ef 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadableCh(SimpleHoster): __name__ = "UploadableCh" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __pattern__ = r'http://(?:www\.)?uploadable\.ch/file/(?P<ID>\w+)' @@ -65,13 +65,13 @@ class UploadableCh(SimpleHoster): self.download(pyfile.url, post={'download': "normal"}, disposition=True) - def check_file(self): - if self.check_download({'wait': re.compile("Please wait for")}): + def check_download(self): + if self.check_file({'wait': re.compile("Please wait for")}): self.log_info(_("Downloadlimit reached, please wait or reconnect")) self.wait(60 * 60, True) self.retry() - return super(UploadableCh, self).check_file() + return super(UploadableCh, self).check_download() getInfo = create_getInfo(UploadableCh) diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index c90f2bb0f..a3b9fbc2f 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -2,7 +2,6 @@ import re import time -import urlparse from module.network.RequestFactory import getURL as get_url from module.plugins.captcha.ReCaptcha import ReCaptcha @@ -12,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadedTo(SimpleHoster): __name__ = "UploadedTo" __type__ = "hoster" - __version__ = "0.96" + __version__ = "0.97" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' @@ -31,6 +30,7 @@ class UploadedTo(SimpleHoster): OFFLINE_PATTERN = r'>Page not found' TEMP_OFFLINE_PATTERN = r'<title>uploaded\.net - Maintenance' + PREMIUM_ONLY_PATTERN = r'This file exceeds the max\. filesize which can be downloaded by free users' LINK_FREE_PATTERN = r"url:\s*'(.+?)'" LINK_PREMIUM_PATTERN = r'<div class="tfree".*\s*<form method="post" action="(.+?)"' @@ -77,6 +77,7 @@ class UploadedTo(SimpleHoster): self.html = self.load("http://uploaded.net/io/ticket/captcha/%s" % self.info['pattern']['ID'], post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) + self.check_errors() super(UploadedTo, self).handle_free(pyfile) self.check_errors() diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index 2af0f32fc..517ed293a 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -44,21 +44,21 @@ class UploadheroCom(SimpleHoster): if m is None: self.error(_("Captcha not found")) - captcha = self.captcha.decrypt(urlparse.urljoin("http://uploadhero.co", m.group(1))) + captcha = self.captcha.decrypt(urlparse.urljoin("http://uploadhero.co/", m.group(1))) self.html = self.load(pyfile.url, get={'code': captcha}) m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: + if m is not None: self.link = m.group(1) or m.group(2) self.wait(50) def check_errors(self): m = re.search(self.IP_BLOCKED_PATTERN, self.html) - if m: - self.html = self.load(urlparse.urljoin("http://uploadhero.co", m.group(1))) + if m is not None: + self.html = self.load(urlparse.urljoin("http://uploadhero.co/", m.group(1))) 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 diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index 36f0c766e..c8f8a8169 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -4,14 +4,14 @@ import pycurl import re from module.common.json_layer import json_loads -from module.plugins.internal.Plugin import encode -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp +from module.plugins.internal.Plugin import encode, timestamp +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadingCom(SimpleHoster): __name__ = "UploadingCom" __type__ = "hoster" - __version__ = "0.43" + __version__ = "0.44" __status__ = "testing" __pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>\w+)' @@ -61,7 +61,7 @@ class UploadingCom(SimpleHoster): def handle_free(self, pyfile): m = re.search('<h2>((Daily )?Download Limit)</h2>', self.html) - if m: + if m is not None: pyfile.error = encode(m.group(1)) self.log_warning(pyfile.error) self.retry(6, (6 * 60 if m.group(2) else 15) * 60, pyfile.error) @@ -88,7 +88,7 @@ class UploadingCom(SimpleHoster): self.html = self.load(url) m = re.search(r'<form id="file_form" action="(.*?)"', self.html) - if m: + if m is not None: url = m.group(1) else: self.error(_("No URL")) diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index 12c667efb..caa12e8af 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -62,13 +62,11 @@ class UpstoreNet(SimpleHoster): #: STAGE 3: get direct link m = re.search(self.LINK_FREE_PATTERN, self.html, re.S) - if m: + if m is not None: break - if m is None: - self.error(_("Download link not found")) - - self.link = m.group(1) + if m is not None: + self.link = m.group(1) getInfo = create_getInfo(UpstoreNet) diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py index d6baa3990..4f29b24b7 100644 --- a/module/plugins/hoster/UptoboxCom.py +++ b/module/plugins/hoster/UptoboxCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class UptoboxCom(XFSHoster): __name__ = "UptoboxCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(uptobox|uptostream)\.com/\w{12}' @@ -22,6 +22,8 @@ class UptoboxCom(XFSHoster): LINK_PATTERN = r'"(https?://\w+\.uptobox\.com/d/.*?)"' + DL_LIMIT_PATTERN = r'>You have to wait (.+) to launch a new download<' + def setup(self): self.multiDL = True diff --git a/module/plugins/hoster/UserscloudCom.py b/module/plugins/hoster/UserscloudCom.py new file mode 100644 index 000000000..ebaed4859 --- /dev/null +++ b/module/plugins/hoster/UserscloudCom.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class UserscloudCom(SimpleHoster): + __name__ = "UserscloudCom" + __type__ = "hoster" + __version__ = "0.01" + __status__ = "testing" + + __pattern__ = r'https?://(?:www\.)?userscloud\.com/\w{12}' + + __description__ = """Userscloud.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", None)] + + + NAME_PATTERN = r'<h2 class="strong margin-none">(?P<N>.+?)<' + SIZE_PATTERN = r'<div class="ribbon">(?P<S>[\d.,]+) (?P<U>[\w^_]+)<' + OFFLINE_PATTERN = r'The file you are trying to download is no longer available' + + + def setup(self): + self.multiDL = True + self.resume_download = False + self.chunk_limit = 1 + + + def handle_free(self, pyfile): + self.download(pyfile.url, + post=dict(re.findall(r'<input type="hidden" name="(.+?)" value="(.*?)">', self.html))) + + +getInfo = create_getInfo(UserscloudCom) diff --git a/module/plugins/hoster/VeohCom.py b/module/plugins/hoster/VeohCom.py index 7d46ee335..ba18fd529 100644 --- a/module/plugins/hoster/VeohCom.py +++ b/module/plugins/hoster/VeohCom.py @@ -42,7 +42,7 @@ class VeohCom(SimpleHoster): for q in quality: pattern = r'"fullPreviewHash%sPath":"(.+?)"' % q m = re.search(pattern, self.html) - if m: + if m is not None: pyfile.name += ".mp4" self.link = m.group(1).replace("\\", "") return diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index 0a89363f8..a11b59492 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class WebshareCz(SimpleHoster): __name__ = "WebshareCz" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(en\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)' @@ -41,7 +41,7 @@ class WebshareCz(SimpleHoster): def handle_free(self, pyfile): - wst = self.account.get_data(self.user).get('wst', None) if self.account else None + wst = self.account.get_data('wst') if self.account else None api_data = get_url("https://webshare.cz/api/file_link/", post={'ident': self.info['pattern']['ID'], 'wst': wst}) @@ -49,7 +49,7 @@ class WebshareCz(SimpleHoster): self.log_debug("API data: " + api_data) m = re.search('<link>(.+)</link>', api_data) - if m: + if m is not None: self.link = m.group(1) diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 8ede709de..c7d8a7761 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -8,7 +8,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class XFileSharingPro(XFSHoster): __name__ = "XFileSharingPro" __type__ = "hoster" - __version__ = "0.53" + __version__ = "0.54" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)' @@ -24,25 +24,25 @@ class XFileSharingPro(XFSHoster): def _log(self, level, plugintype, pluginname, messages): return super(XFileSharingPro, self)._log(level, plugintype, - "%s: %s" % (pluginname, self.HOSTER_NAME), + "%s: %s" % (pluginname, self.PLUGIN_NAME), messages) def init(self): self.__pattern__ = self.pyload.pluginManager.hosterPlugins[self.__name__]['pattern'] - self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() - self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.HOSTER_DOMAIN) if part != '.') + self.PLUGIN_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() + self.PLUGIN_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.PLUGIN_DOMAIN) if part != '.') def _setup(self): - account_name = self.__name__ if self.account.HOSTER_DOMAIN is None else self.HOSTER_NAME + account_name = self.__name__ if self.account.PLUGIN_DOMAIN is None else self.PLUGIN_NAME self.chunk_limit = 1 self.multiDL = True if self.account: - self.req = self.pyload.requestFactory.getRequest(accountname, self.user) - self.premium = self.account.is_premium(self.user) + self.req = self.pyload.requestFactory.getRequest(accountname, self.account.user) + self.premium = self.account.premium self.resume_download = self.premium else: self.req = self.pyload.requestFactory.getRequest(account_name) @@ -55,19 +55,19 @@ class XFileSharingPro(XFSHoster): self.req.close() if not self.account: - self.account = self.pyload.accountManager.getAccountPlugin(self.HOSTER_NAME) + self.account = self.pyload.accountManager.getAccountPlugin(self.PLUGIN_NAME) if not self.account: self.account = self.pyload.accountManager.getAccountPlugin(self.__name__) if self.account: - if not self.account.HOSTER_DOMAIN: - self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + if not self.account.PLUGIN_DOMAIN: + self.account.PLUGIN_DOMAIN = self.PLUGIN_DOMAIN - if not self.user: - self.user = self.account.select()[0] + if not self.account.user: #@TODO: Move to `Account` in 0.4.10 + self.account.user = self.account.select()[0] - if not self.user or not self.account.is_logged(self.user, True): + if not self.account.logged: self.account = False diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index 8df1a441f..576451644 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -79,6 +79,7 @@ class XHamsterCom(Hoster): file_url = re.search(r"<a href=\"" + srv_url + "(.+?)\"", self.html) if file_url is None: self.error(_("file_url not found")) + file_url = file_url.group(1) long_url = srv_url + file_url self.log_debug("long_url = " + long_url) diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index aba66ee94..098143751 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -172,10 +172,10 @@ class Xdcc(Hoster): retry = time.time() + 300 if "you must be on a known channel to request a pack" in msg['text']: - self.fail(_("Wrong channel")) + self.fail(_("Invalid channel")) m = re.match('\x01DCC SEND (.*?) (\d+) (\d+)(?: (\d+))?\x01', msg['text']) - if m: + if m is not None: done = True #: Get connection data diff --git a/module/plugins/hoster/YadiSk.py b/module/plugins/hoster/YadiSk.py index a907cd282..354ba1b4c 100644 --- a/module/plugins/hoster/YadiSk.py +++ b/module/plugins/hoster/YadiSk.py @@ -34,7 +34,7 @@ class YadiSk(SimpleHoster): info ['idclient'] += random.choice('0123456abcdef') m = re.search(r'<script id="models-client" type="application/json">(.+?)</script>', html) - if m: + if m is not None: api_data = json_loads(m.group(1)) try: for sect in api_data: diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index e0e90a311..b68e87ba6 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -37,7 +37,7 @@ class YibaishiwuCom(SimpleHoster): self.log_debug(('FREEUSER' if m.group(2) == "download" else 'GUEST') + ' URL', url) - res = json_loads(self.load(urlparse.urljoin("http://115.com", url), decode=False)) + res = json_loads(self.load(urlparse.urljoin("http://115.com/", url), decode=False)) if "urls" in res: mirrors = res['urls'] @@ -52,8 +52,9 @@ class YibaishiwuCom(SimpleHoster): self.link = mr['url'].replace("\\", "") self.log_debug("Trying URL: " + self.link) break + except Exception: - continue + pass else: self.fail(_("No working link found")) diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index a75bbcc94..cdf69afbe 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -41,7 +41,7 @@ class YourfilesTo(Hoster): #: var zzipitime = 15 m = re.search(r'var zzipitime = (\d+);', self.html) - if m: + if m is not None: sec = int(m.group(1)) else: sec = 0 diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 865eeef2e..5c7c13962 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -6,37 +6,17 @@ import subprocess import urllib from module.plugins.internal.Hoster import Hoster -from module.plugins.internal.Plugin import replace_patterns +from module.plugins.internal.Plugin import replace_patterns, which from module.utils import html_unescape -def which(program): - """ - Works exactly like the unix command which - Courtesy of http://stackoverflow.com/a/377028/675646 - """ - isExe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK) - - fpath, fname = os.path.split(program) - - if fpath: - if isExe(program): - return program - else: - for path in os.environ['PATH'].split(os.pathsep): - path = path.strip('"') - exe_file = os.path.join(path, program) - if isExe(exe_file): - return exe_file - - class YoutubeCom(Hoster): __name__ = "YoutubeCom" __type__ = "hoster" - __version__ = "0.44" + __version__ = "0.46" __status__ = "testing" - __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com|youtu\.be)/watch\?(?:.*&)?v=.+' + __pattern__ = r'https?://(?:[^/]*\.)?(youtu\.be/|youtube\.com/watch\?(?:.*&)?v=)\w+' __config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting" , "hd" ), ("fmt" , "int" , "FMT/ITAG Number (0 for auto)", 0 ), (".mp4" , "bool" , "Allow .mp4" , True ), @@ -51,10 +31,10 @@ class YoutubeCom(Hoster): ("zoidberg", "zoidberg@mujmail.cz")] - URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/')] + URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/watch?v=')] #: Invalid characters that must be removed from the file name - invalidChars = u'\u2605:?><"|\\' + invalid_chars = u'\u2605:?><"|\\' #: name, width, height, quality ranking, 3D formats = {5 : (".flv" , 400 , 240 , 1 , False), diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py index ff3a43e6d..9f3fea189 100644 --- a/module/plugins/hoster/ZeveraCom.py +++ b/module/plugins/hoster/ZeveraCom.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import re -import urlparse from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo @@ -9,7 +8,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class ZeveraCom(MultiHoster): __name__ = "ZeveraCom" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.33" __status__ = "testing" __pattern__ = r'https?://(?:www\.)zevera\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' @@ -26,7 +25,7 @@ class ZeveraCom(MultiHoster): def handle_premium(self, pyfile): - self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url) + self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.PLUGIN_DOMAIN, pyfile.url) getInfo = create_getInfo(ZeveraCom) diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 1b29948ce..221ec8c42 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.82" + __version__ = "0.83" __status__ = "testing" __pattern__ = r'http://www\d{0,3}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)' @@ -52,7 +52,7 @@ class ZippyshareCom(SimpleHoster): self.error(e) else: - self.link = self.get_link() + self.link = self.fixurl(self.get_link()) if self.link and pyfile.name == "file.html": pyfile.name = urllib.unquote(self.link.split('/')[-1]) |