diff options
Diffstat (limited to 'module/plugins/hoster')
214 files changed, 2295 insertions, 1996 deletions
diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index 2ed09f58c..753712d5c 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -5,16 +5,18 @@ import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.utils import parseFileSize +from module.utils import parseFileSize as parse_size class AlldebridCom(MultiHoster): __name__ = "AlldebridCom" __type__ = "hoster" - __version__ = "0.46" + __version__ = "0.48" + __status__ = "testing" __pattern__ = r'https?://(?:www\.|s\d+\.)?alldebrid\.com/dl/[\w^_]+' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Alldebrid.com multi-hoster plugin""" __license__ = "GPLv3" @@ -22,33 +24,28 @@ class AlldebridCom(MultiHoster): def setup(self): - self.chunkLimit = 16 + self.chunk_limit = 16 - def handlePremium(self, pyfile): - password = self.getPassword() + def handle_premium(self, pyfile): + password = self.get_password() data = json_loads(self.load("http://www.alldebrid.com/service.php", get={'link': pyfile.url, 'json': "true", 'pw': password})) - self.logDebug("Json data", data) + self.log_debug("Json data", data) if data['error']: if data['error'] == "This link isn't available on the hoster website.": self.offline() else: - self.logWarning(data['error']) - self.tempOffline() + self.log_warning(data['error']) + self.temp_offline() else: if pyfile.name and not pyfile.name.endswith('.tmp'): pyfile.name = data['filename'] - pyfile.size = parseFileSize(data['filesize']) + pyfile.size = parse_size(data['filesize']) self.link = data['link'] - if self.getConfig('ssl'): - self.link = self.link.replace("http://", "https://") - else: - self.link = self.link.replace("https://", "http://") - getInfo = create_getInfo(AlldebridCom) diff --git a/module/plugins/hoster/AndroidfilehostCom.py b/module/plugins/hoster/AndroidfilehostCom.py index 08005de0f..3fb77f83e 100644 --- a/module/plugins/hoster/AndroidfilehostCom.py +++ b/module/plugins/hoster/AndroidfilehostCom.py @@ -11,7 +11,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class AndroidfilehostCom(SimpleHoster): __name__ = "AndroidfilehostCom" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?androidfilehost\.com/\?fid=\d+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -32,33 +33,31 @@ class AndroidfilehostCom(SimpleHoster): def setup(self): self.multiDL = True - self.resumeDownload = True - self.chunkLimit = 1 + self.resume_download = True + self.chunk_limit = 1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): wait = re.search(self.WAIT_PATTERN, self.html) - self.logDebug("Waiting time: %s seconds" % wait.group(1)) + self.log_debug("Waiting time: %s seconds" % wait.group(1)) fid = re.search(r'id="fid" value="(\d+)" />', self.html).group(1) - self.logDebug("fid: %s" % fid) + self.log_debug("fid: %s" % fid) html = self.load("https://www.androidfilehost.com/libs/otf/mirrors.otf.php", post={'submit': 'submit', 'action': 'getdownloadmirrors', - 'fid' : fid}, - decode=True) + 'fid' : fid}) self.link = re.findall('"url":"(.*?)"', html)[0].replace("\\", "") mirror_host = self.link.split("/")[2] - self.logDebug("Mirror Host: %s" % mirror_host) + self.log_debug("Mirror Host: %s" % mirror_host) html = self.load("https://www.androidfilehost.com/libs/otf/stats.otf.php", get={'fid' : fid, 'w' : 'download', - 'mirror': mirror_host}, - decode=True) + 'mirror': mirror_host}) getInfo = create_getInfo(AndroidfilehostCom) diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 2228516aa..2e9ae4e48 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -5,14 +5,15 @@ import urllib import urlparse from module.network.HTTPRequest import BadHeader -from module.plugins.internal.SimpleHoster import create_getInfo, getFileURL -from module.plugins.Hoster import Hoster +from module.plugins.internal.SimpleHoster import create_getInfo +from module.plugins.internal.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.43" + __version__ = "0.45" + __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -23,7 +24,7 @@ class BasePlugin(Hoster): @classmethod - def getInfo(cls, url="", html=""): #@TODO: Move to hoster class in 0.4.10 + 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] @@ -35,22 +36,23 @@ class BasePlugin(Hoster): def setup(self): - self.chunkLimit = -1 + self.chunk_limit = -1 self.multiDL = True - self.resumeDownload = True + self.resume_download = True def process(self, pyfile): - """main function""" - - pyfile.name = self.getInfo(pyfile.url)['name'] + """ + Main function + """ + 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 = getFileURL(self, urllib.unquote(pyfile.url)) + link = self.direct_link(urllib.unquote(pyfile.url)) if link: self.download(link, ref=False, disposition=True) @@ -58,21 +60,21 @@ class BasePlugin(Hoster): self.fail(_("File not found")) except BadHeader, e: - if e.code is 404: + if e.code == 404: self.offline() elif e.code in (401, 403): - self.logDebug("Auth required", "Received HTTP status code: %d" % e.code) + self.log_debug("Auth required", "Received HTTP status code: %d" % e.code) - account = self.core.accountManager.getAccountPlugin('Http') - servers = [x['login'] for x in account.getAllAccounts()] + 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 if server in servers: - self.logDebug("Logging on to %s" % server) - self.req.addAuth(account.getAccountData(server)['password']) + self.log_debug("Logging on to %s" % server) + self.req.addAuth(account.get_info(server)['login']['password']) else: - pwd = self.getPassword() + pwd = self.get_password() if ':' in pwd: self.req.addAuth(pwd) else: @@ -84,7 +86,7 @@ class BasePlugin(Hoster): else: self.fail(_("No file downloaded")) #@TODO: Move to hoster class in 0.4.10 - errmsg = self.checkDownload({'Empty file' : re.compile(r'\A\s*\Z'), + errmsg = self.check_download({'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)')}) @@ -92,11 +94,11 @@ class BasePlugin(Hoster): return try: - errmsg += " | " + self.lastCheck.group(1).strip() + errmsg += " | " + self.last_check.group(1).strip() except Exception: pass - self.logWarning("Check result: " + errmsg, "Waiting 1 minute and retry") + self.log_warning(_("Check result: ") + errmsg, _("Waiting 1 minute and retry")) self.retry(3, 60, errmsg) diff --git a/module/plugins/hoster/BasketbuildCom.py b/module/plugins/hoster/BasketbuildCom.py index 89e4d39f9..9bbd0ea60 100644 --- a/module/plugins/hoster/BasketbuildCom.py +++ b/module/plugins/hoster/BasketbuildCom.py @@ -12,12 +12,13 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BasketbuildCom(SimpleHoster): __name__ = "BasketbuildCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\w\.)?basketbuild\.com/filedl/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """basketbuild.com hoster plugin""" + __description__ = """Basketbuild.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] @@ -29,11 +30,11 @@ class BasketbuildCom(SimpleHoster): def setup(self): self.multiDL = True - self.resumeDownload = True - self.chunkLimit = 1 + self.resume_download = True + self.chunk_limit = 1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): try: link1 = re.search(r'href="(.+dlgate/.+)"', self.html).group(1) self.html = self.load(link1) @@ -42,15 +43,15 @@ class BasketbuildCom(SimpleHoster): self.error(_("Hop #1 not found")) else: - self.logDebug("Next hop: %s" % link1) + self.log_debug("Next hop: %s" % link1) try: wait = re.search(r'var sec = (\d+)', self.html).group(1) - self.logDebug("Wait %s seconds" % wait) + self.log_debug("Wait %s seconds" % wait) self.wait(wait) except AttributeError: - self.logDebug("No wait time found") + self.log_debug("No wait time found") try: self.link = re.search(r'id="dlLink">\s*<a href="(.+?)"', self.html).group(1) diff --git a/module/plugins/hoster/BayfilesCom.py b/module/plugins/hoster/BayfilesCom.py index cccd4acc7..6e9397d4f 100644 --- a/module/plugins/hoster/BayfilesCom.py +++ b/module/plugins/hoster/BayfilesCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class BayfilesCom(DeadHoster): __name__ = "BayfilesCom" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?bayfiles\.(com|net)/file/(?P<ID>\w+/\w+/[^/]+)' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index b47c2902d..d2af8272a 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BezvadataCz(SimpleHoster): __name__ = "BezvadataCz" __type__ = "hoster" - __version__ = "0.27" + __version__ = "0.29" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -24,22 +25,22 @@ class BezvadataCz(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - def handleFree(self, pyfile): - #download button + def handle_free(self, pyfile): + #: Download button m = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html) if m is None: self.error(_("Page 1 URL not found")) url = "http://bezvadata.cz%s" % m.group(1) - #captcha form + #: Captcha form self.html = self.load(url) - self.checkErrors() + self.check_errors() for _i in xrange(5): - action, inputs = self.parseHtmlForm('frm-stahnoutFreeForm') + action, inputs = self.parse_html_form('frm-stahnoutFreeForm') if not inputs: self.error(_("FreeForm")) @@ -47,31 +48,26 @@ class BezvadataCz(SimpleHoster): if m is None: self.error(_("Wrong captcha image")) - #captcha image is contained in html page as base64encoded data but decryptCaptcha() expects image url - self.load, proper_load = self.loadcaptcha, self.load - try: - inputs['captcha'] = self.decryptCaptcha(m.group(1), imgtype='png') - finally: - self.load = proper_load + inputs['captcha'] = self.captcha._decrypt(m.group(1).decode('base64'), input_type='png') if '<img src="data:image/png;base64' in self.html: - self.invalidCaptcha() + self.captcha.invalid() else: - self.correctCaptcha() + self.captcha.correct() break else: self.fail(_("No valid captcha code entered")) - #download url + #: Download url self.html = self.load("http://bezvadata.cz%s" % action, post=inputs) - self.checkErrors() + self.check_errors() m = re.search(r'<a class="stahnoutSoubor2" href="(.*?)">', self.html) if m is None: self.error(_("Page 2 URL not found")) url = "http://bezvadata.cz%s" % m.group(1) - self.logDebug("DL URL %s" % url) + self.log_debug("DL URL %s" % url) - #countdown + #: countdown m = re.search(r'id="countdown">(\d\d):(\d\d)<', self.html) wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 120 self.wait(wait_time, False) @@ -79,17 +75,13 @@ class BezvadataCz(SimpleHoster): self.link = url - def checkErrors(self): + def check_errors(self): if 'images/button-download-disable.png' in self.html: - self.longWait(5 * 60, 24) #: parallel dl limit + self.wait(5 * 60, 24, _("Download limit reached")) #: Parallel dl limit elif '<div class="infobox' in self.html: - self.tempOffline() + self.temp_offline() else: - return super(BezvadataCz, self).checkErrors() - - - def loadcaptcha(self, data, *args, **kwargs): - return data.decode('base64') + return super(BezvadataCz, self).check_errors() getInfo = create_getInfo(BezvadataCz) diff --git a/module/plugins/hoster/BillionuploadsCom.py b/module/plugins/hoster/BillionuploadsCom.py index d0fbd7a8b..a142f4ab3 100644 --- a/module/plugins/hoster/BillionuploadsCom.py +++ b/module/plugins/hoster/BillionuploadsCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class BillionuploadsCom(DeadHoster): __name__ = "BillionuploadsCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?billionuploads\.com/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 5c709e4f7..b975a8ab0 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -4,14 +4,15 @@ from __future__ import with_statement import re -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" - __version__ = "0.54" + __version__ = "0.55" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.+?)\.html)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -33,32 +34,32 @@ class BitshareCom(SimpleHoster): def setup(self): self.multiDL = self.premium - self.chunkLimit = 1 + self.chunk_limit = 1 def process(self, pyfile): if self.premium: self.account.relogin(self.user) - # File id + #: File id m = re.match(self.__pattern__, pyfile.url) self.file_id = max(m.group('ID1'), m.group('ID2')) - self.logDebug("File id is [%s]" % self.file_id) + self.log_debug("File id is [%s]" % self.file_id) - # Load main page - self.html = self.load(pyfile.url, ref=False, decode=True) + #: Load main page + self.html = self.load(pyfile.url, ref=False) - # Check offline + #: Check offline if re.search(self.OFFLINE_PATTERN, self.html): self.offline() - # Check Traffic used up + #: Check Traffic used up if re.search(self.TRAFFIC_USED_UP, self.html): - self.logInfo(_("Your Traffic is used up for today")) + self.log_info(_("Your Traffic is used up for today")) self.wait(30 * 60, True) self.retry() - # File name + #: File name m = re.match(self.__pattern__, pyfile.url) name1 = m.group('NAME') if m else None @@ -67,77 +68,77 @@ class BitshareCom(SimpleHoster): pyfile.name = max(name1, name2) - # Ajax file id + #: Ajax file id self.ajaxid = re.search(self.AJAXID_PATTERN, self.html).group(1) - self.logDebug("File ajax id is [%s]" % self.ajaxid) + self.log_debug("File ajax id is [%s]" % self.ajaxid) - # This may either download our file or forward us to an error page - self.link = self.getDownloadUrl() + #: This may either download our file or forward us to an error page + self.link = self.get_download_url() - if self.checkDownload({"error": ">Error occured<"}): + if self.check_download({'error': ">Error occured<"}): self.retry(5, 5 * 60, "Bitshare host : Error occured") - def getDownloadUrl(self): - # Return location if direct download is active + def get_download_url(self): + #: Return location if direct download is active if self.premium: header = self.load(self.pyfile.url, just_header=True) if 'location' in header: return header['location'] - # Get download info - self.logDebug("Getting download info") + #: Get download info + self.log_debug("Getting download info") res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", - post={"request": "generateID", "ajaxid": self.ajaxid}) + post={'request': "generateID", 'ajaxid': self.ajaxid}) - self.handleErrors(res, ':') + self.handle_errors(res, ':') parts = res.split(":") filetype = parts[0] wait = int(parts[1]) captcha = int(parts[2]) - self.logDebug("Download info [type: '%s', waiting: %d, captcha: %d]" % (filetype, wait, captcha)) + self.log_debug("Download info [type: '%s', waiting: %d, captcha: %d]" % (filetype, wait, captcha)) - # Waiting + #: Waiting if wait > 0: - self.logDebug("Waiting %d seconds." % wait) + self.log_debug("Waiting %d seconds." % wait) if wait < 120: self.wait(wait, False) else: self.wait(wait - 55, True) self.retry() - # Resolve captcha + #: Resolve captcha if captcha == 1: - self.logDebug("File is captcha protected") + self.log_debug("File is captcha protected") recaptcha = ReCaptcha(self) - # Try up to 3 times + #: 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.handleCaptchaErrors(res): + post={'request' : "validateCaptcha", + 'ajaxid' : self.ajaxid, + 'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) + if self.handle_captcha_errors(res): break - # Get download URL - self.logDebug("Getting download url") + #: Get download URL + self.log_debug("Getting download url") res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", - post={"request": "getDownloadURL", "ajaxid": self.ajaxid}) + post={'request': "getDownloadURL", 'ajaxid': self.ajaxid}) - self.handleErrors(res, '#') + self.handle_errors(res, '#') url = res.split("#")[-1] return url - def handleErrors(self, res, separator): - self.logDebug("Checking response [%s]" % res) + def handle_errors(self, res, separator): + self.log_debug("Checking response [%s]" % res) if "ERROR:Session timed out" in res: self.retry() elif "ERROR" in res: @@ -145,15 +146,15 @@ class BitshareCom(SimpleHoster): self.fail(msg) - def handleCaptchaErrors(self, res): - self.logDebug("Result of captcha resolving [%s]" % res) + def handle_captcha_errors(self, res): + self.log_debug("Result of captcha resolving [%s]" % res) if "SUCCESS" in res: - self.correctCaptcha() + self.captcha.correct() return True elif "ERROR:SESSION ERROR" in res: self.retry() - self.invalidCaptcha() + self.captcha.invalid() getInfo = create_getInfo(BitshareCom) diff --git a/module/plugins/hoster/BoltsharingCom.py b/module/plugins/hoster/BoltsharingCom.py index db813ba2e..c33049e01 100644 --- a/module/plugins/hoster/BoltsharingCom.py +++ b/module/plugins/hoster/BoltsharingCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class BoltsharingCom(DeadHoster): __name__ = "BoltsharingCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?boltsharing\.com/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index c966dbe1a..5b7d61e05 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -3,13 +3,14 @@ import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.16" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -21,8 +22,6 @@ class CatShareNet(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] - TEXT_ENCODING = True - INFO_PATTERN = r'<title>(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)<' OFFLINE_PATTERN = r'<div class="alert alert-error"' @@ -35,10 +34,10 @@ class CatShareNet(SimpleHoster): def setup(self): self.multiDL = self.premium - self.resumeDownload = True + self.resume_download = True - def handleFree(self, pyfile): + def handle_free(self, pyfile): recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() diff --git a/module/plugins/hoster/CloudzerNet.py b/module/plugins/hoster/CloudzerNet.py index af40b8d5f..fa0bccba3 100644 --- a/module/plugins/hoster/CloudzerNet.py +++ b/module/plugins/hoster/CloudzerNet.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class CloudzerNet(DeadHoster): __name__ = "CloudzerNet" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(cloudzer\.net/file/|clz\.to/(file/)?)\w+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index 09453137d..60c66960d 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CloudzillaTo(SimpleHoster): __name__ = "CloudzillaTo" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P<ID>[\w^_]+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -24,9 +25,9 @@ class CloudzillaTo(SimpleHoster): PASSWORD_PATTERN = r'<div id="pwd_protected">' - def checkErrors(self): + def check_errors(self): if re.search(self.PASSWORD_PATTERN, self.html): - pw = self.getPassword() + pw = self.get_password() if pw: self.html = self.load(self.pyfile.url, get={'key': pw}) else: @@ -35,16 +36,16 @@ class CloudzillaTo(SimpleHoster): if re.search(self.PASSWORD_PATTERN, self.html): self.retry(reason="Wrong password") else: - return super(CloudzillaTo, self).checkErrors() + return super(CloudzillaTo, self).check_errors() - def handleFree(self, pyfile): + def handle_free(self, pyfile): self.html = self.load("http://www.cloudzilla.to/generateticket/", - post={'file_id': self.info['pattern']['ID'], 'key': self.getPassword()}) + post={'file_id': self.info['pattern']['ID'], 'key': self.get_password()}) ticket = dict(re.findall(r'<(.+?)>([^<>]+?)</', self.html)) - self.logDebug(ticket) + self.log_debug(ticket) if 'error' in ticket: if "File is password protected" in ticket['error']: @@ -60,8 +61,8 @@ class CloudzillaTo(SimpleHoster): 'ticket_id': ticket['ticket_id']} - def handlePremium(self, pyfile): - return self.handleFree(pyfile) + def handle_premium(self, pyfile): + return self.handle_free(pyfile) getInfo = create_getInfo(CloudzillaTo) diff --git a/module/plugins/hoster/CramitIn.py b/module/plugins/hoster/CramitIn.py index 44dac958d..f14ae0c71 100644 --- a/module/plugins/hoster/CramitIn.py +++ b/module/plugins/hoster/CramitIn.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class CramitIn(XFSHoster): __name__ = "CramitIn" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?cramit\.in/\w{12}' diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 098ba5fab..8f092ad0c 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -3,14 +3,15 @@ import re import urlparse -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CrockoCom(SimpleHoster): __name__ = "CrockoCom" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -32,7 +33,7 @@ class CrockoCom(SimpleHoster): NAME_REPLACEMENTS = [(r'<.*?>', '')] - def handleFree(self, pyfile): + def handle_free(self, pyfile): if "You need Premium membership to download this file." in self.html: self.fail(_("You need Premium membership to download this file")) @@ -57,8 +58,8 @@ class CrockoCom(SimpleHoster): inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() self.download(action, post=inputs) - if self.checkDownload({"captcha": recaptcha.KEY_AJAX_PATTERN}): - self.invalidCaptcha() + if self.check_download({'captcha': recaptcha.KEY_AJAX_PATTERN}): + self.captcha.invalid() else: break else: diff --git a/module/plugins/hoster/CyberlockerCh.py b/module/plugins/hoster/CyberlockerCh.py index 9d748bf85..8cb9f7851 100644 --- a/module/plugins/hoster/CyberlockerCh.py +++ b/module/plugins/hoster/CyberlockerCh.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class CyberlockerCh(DeadHoster): __name__ = "CyberlockerCh" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?cyberlocker\.ch/\w+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 8f72f2148..3d2de5f7f 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -6,13 +6,14 @@ import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.utils import parseFileSize +from module.utils import parseFileSize as parse_size class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __version__ = "0.99" + __version__ = "1.02" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -39,58 +40,58 @@ class CzshareCom(SimpleHoster): USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->' - def checkTrafficLeft(self): - # check if user logged in + def check_traffic_left(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.html = self.load(self.pyfile.url, decode=True) + self.html = self.load(self.pyfile.url) m = re.search(self.USER_CREDIT_PATTERN, self.html) if m is None: return False - # check user credit + #: Check user credit try: - credit = parseFileSize(m.group(1).replace(' ', ''), m.group(2)) - self.logInfo(_("Premium download for %i KiB of Credit") % (self.pyfile.size / 1024)) - self.logInfo(_("User %s has %i KiB left") % (self.user, credit / 1024)) + 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)) if credit < self.pyfile.size: - self.logInfo(_("Not enough credit to download file: %s") % self.pyfile.name) + 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.logError(e) + #: let's continue and see what happens... + self.log_error(e) return True - def handlePremium(self, pyfile): - # parse download link + 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.logError(e) - self.resetAccount() + self.log_error(e) + self.restart(nopremium=True) - # download the file, destination is determined by pyLoad + #: Download the file, destination is determined by pyLoad self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True) - def handleFree(self, pyfile): - # get free url + def handle_free(self, pyfile): + #: Get free url m = re.search(self.FREE_URL_PATTERN, self.html) if m is None: self.error(_("FREE_URL_PATTERN not found")) parsed_url = "http://sdilej.cz" + m.group(1) - self.logDebug("PARSED_URL:" + parsed_url) + self.log_debug("PARSED_URL:" + parsed_url) - # get download ticket and parse html - self.html = self.load(parsed_url, decode=True) + #: Get download ticket and parse html + self.html = self.load(parsed_url) if re.search(self.MULTIDL_PATTERN, self.html): - self.longWait(5 * 60, 12) + self.wait(5 * 60, 12, _("Download limit reached")) try: form = re.search(self.FREE_FORM_PATTERN, self.html, re.S).group(1) @@ -98,32 +99,32 @@ class CzshareCom(SimpleHoster): pyfile.size = int(inputs['size']) except Exception, e: - self.logError(e) + self.log_error(e) self.error(_("Form")) - # get and decrypt captcha + #: Get and decrypt captcha captcha_url = 'http://sdilej.cz/captcha.php' for _i in xrange(5): - inputs['captchastring2'] = self.decryptCaptcha(captcha_url) - self.html = self.load(parsed_url, post=inputs, decode=True) + 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.invalidCaptcha() + self.captcha.invalid() elif re.search(self.MULTIDL_PATTERN, self.html): - self.longWait(5 * 60, 12) + self.wait(5 * 60, 12, _("Download limit reached")) else: - self.correctCaptcha() + self.captcha.correct() break else: self.fail(_("No valid captcha code entered")) m = re.search("countdown_number = (\d+);", self.html) - self.setWait(int(m.group(1)) if m else 50) + self.set_wait(int(m.group(1)) if m else 50) - # download the file, destination is determined by pyLoad - self.logDebug("WAIT URL", self.req.lastEffectiveURL) + #: Download the file, destination is determined by pyLoad + self.log_debug("WAIT URL", self.req.lastEffectiveURL) m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) if m is None: @@ -134,29 +135,29 @@ class CzshareCom(SimpleHoster): self.wait() - def checkFile(self, rules={}): - # check download - check = self.checkDownload({ + def check_file(self): + #: Check download + check = self.check_download({ "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), - "credit" : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), + 'credit' : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), "multi-dl" : re.compile(self.MULTIDL_PATTERN), - "captcha" : "<li>ZadanÃœ ovÄÅovacà kód nesouhlasÃ!</li>" + 'captcha' : "<li>ZadanÃœ ovÄÅovacà kód nesouhlasÃ!</li>" }) if check == "temp offline": self.fail(_("File not available - try later")) elif check == "credit": - self.resetAccount() + self.restart(nopremium=True) elif check == "multi-dl": - self.longWait(5 * 60, 12) + self.wait(5 * 60, 12, _("Download limit reached")) elif check == "captcha": - self.invalidCaptcha() + self.captcha.invalid() self.retry() - return super(CzshareCom, self).checkFile(rules) + return super(CzshareCom, self).check_file() getInfo = create_getInfo(CzshareCom) diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py index c6939e5e5..63003dc06 100644 --- a/module/plugins/hoster/DailymotionCom.py +++ b/module/plugins/hoster/DailymotionCom.py @@ -4,19 +4,19 @@ import re from module.PyFile import statusMap from module.common.json_layer import json_loads -from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL as get_url +from module.plugins.internal.Hoster import Hoster -def getInfo(urls): +def get_info(urls): result = [] regex = re.compile(DailymotionCom.__pattern__) apiurl = "https://api.dailymotion.com/video/%s" - request = {"fields": "access_error,status,title"} + request = {'fields': "access_error,status,title"} for url in urls: id = regex.match(url).group('ID') - html = getURL(apiurl % id, get=request) + html = get_url(apiurl % id, get=request) info = json_loads(html) name = info['title'] + ".mp4" if "title" in info else url @@ -40,7 +40,8 @@ def getInfo(urls): class DailymotionCom(Hoster): __name__ = "DailymotionCom" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.22" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?dailymotion\.com/.*video/(?P<ID>[\w^_]+)' __config__ = [("quality", "Lowest;LD 144p;LD 240p;SD 384p;HQ 480p;HD 720p;HD 1080p;Highest", "Quality", "Highest")] @@ -51,11 +52,11 @@ class DailymotionCom(Hoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - def getStreams(self): + def get_streams(self): streams = [] for result in re.finditer(r"\"(?P<URL>http:\\/\\/www.dailymotion.com\\/cdn\\/H264-(?P<QF>.*?)\\.*?)\"", @@ -71,8 +72,8 @@ class DailymotionCom(Hoster): return sorted(streams, key=lambda x: x[0][::-1]) - def getQuality(self): - q = self.getConfig('quality') + def get_quality(self): + q = self.get_config('quality') if q == "Lowest": quality = 0 @@ -84,7 +85,7 @@ class DailymotionCom(Hoster): return quality - def getLink(self, streams, quality): + def get_link(self, streams, quality): if quality > 0: for x, s in [item for item in enumerate(streams)][::-1]: qf = s[0][1] @@ -98,28 +99,28 @@ class DailymotionCom(Hoster): s = streams[idx] - self.logInfo(_("Download video quality %sx%s") % s[0]) + self.log_info(_("Download video quality %sx%s") % s[0]) return s[1] - def checkInfo(self, pyfile): - pyfile.name, pyfile.size, pyfile.status, pyfile.url = getInfo([pyfile.url])[0] + def check_info(self, pyfile): + pyfile.name, pyfile.size, pyfile.status, pyfile.url = get_info([pyfile.url])[0] if pyfile.status == 1: self.offline() elif pyfile.status == 6: - self.tempOffline() + self.temp_offline() def process(self, pyfile): - self.checkInfo(pyfile) + self.check_info(pyfile) id = re.match(self.__pattern__, pyfile.url).group('ID') - self.html = self.load("http://www.dailymotion.com/embed/video/" + id, decode=True) + self.html = self.load("http://www.dailymotion.com/embed/video/" + id) - streams = self.getStreams() - quality = self.getQuality() + streams = self.get_streams() + quality = self.get_quality() - self.download(self.getLink(streams, quality)) + self.download(self.get_link(streams, quality)) diff --git a/module/plugins/hoster/DataHu.py b/module/plugins/hoster/DataHu.py index 955c94437..c0f1e4aa4 100644 --- a/module/plugins/hoster/DataHu.py +++ b/module/plugins/hoster/DataHu.py @@ -11,7 +11,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataHu(SimpleHoster): __name__ = "DataHu" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?data\.hu/get/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -28,7 +29,7 @@ class DataHu(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = self.premium diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index ad514f5eb..15caae1f7 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -6,7 +6,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataportCz(SimpleHoster): __name__ = "DataportCz" __type__ = "hoster" - __version__ = "0.41" + __version__ = "0.42" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -24,12 +25,12 @@ class DataportCz(SimpleHoster): FREE_SLOTS_PATTERN = ur'PoÄet volnÃœch slotů: <span class="darkblue">(\d+)</span><br />' - def handleFree(self, pyfile): - captchas = {"1": "jkeG", "2": "hMJQ", "3": "vmEK", "4": "ePQM", "5": "blBd"} + def handle_free(self, pyfile): + captchas = {'1': "jkeG", '2': "hMJQ", '3': "vmEK", '4': "ePQM", '5': "blBd"} for _i in xrange(60): - action, inputs = self.parseHtmlForm('free_download_form') - self.logDebug(action, inputs) + 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")) @@ -40,15 +41,15 @@ class DataportCz(SimpleHoster): self.download("http://www.dataport.cz%s" % action, post=inputs) - check = self.checkDownload({"captcha": 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', - "slot" : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) + 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")) elif check == "slot": - self.logDebug("No free slots - wait 60s and retry") + self.log_debug("No free slots - wait 60s and retry") self.wait(60, False) - self.html = self.load(pyfile.url, decode=True) + self.html = self.load(pyfile.url) continue else: diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index 92a96b9ec..d90fc5864 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -2,14 +2,15 @@ import re -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DateiTo(SimpleHoster): __name__ = "DateiTo" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -29,21 +30,21 @@ class DateiTo(SimpleHoster): DATA_PATTERN = r'url: "(.*?)", data: "(.*?)",' - def handleFree(self, pyfile): + def handle_free(self, pyfile): url = 'http://datei.to/ajax/download.php' data = {'P': 'I', 'ID': self.info['pattern']['ID']} recaptcha = ReCaptcha(self) for _i in xrange(10): - self.logDebug("URL", url, "POST", data) + self.log_debug("URL", url, "POST", data) self.html = self.load(url, post=data) - self.checkErrors() + self.check_errors() if url.endswith('download.php') and 'P' in data: - if data['P'] == 'I': - self.doWait() + if data['P'] == "I": + self.do_wait() - elif data['P'] == 'IV': + elif data['P'] == "IV": break m = re.search(self.DATA_PATTERN, self.html) @@ -60,7 +61,7 @@ class DateiTo(SimpleHoster): self.link = self.html - def doWait(self): + def do_wait(self): m = re.search(self.WAIT_PATTERN, self.html) wait_time = int(m.group(1)) if m else 30 diff --git a/module/plugins/hoster/DdlstorageCom.py b/module/plugins/hoster/DdlstorageCom.py index 976d9ccf9..5a826452b 100644 --- a/module/plugins/hoster/DdlstorageCom.py +++ b/module/plugins/hoster/DdlstorageCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class DdlstorageCom(DeadHoster): __name__ = "DdlstorageCom" __type__ = "hoster" - __version__ = "1.02" + __version__ = "1.03" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?ddlstorage\.com/\w+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py index 4f64215fa..7cf7c4663 100644 --- a/module/plugins/hoster/DebridItaliaCom.py +++ b/module/plugins/hoster/DebridItaliaCom.py @@ -8,10 +8,12 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class DebridItaliaCom(MultiHoster): __name__ = "DebridItaliaCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.19" + __status__ = "testing" __pattern__ = r'https?://(?:www\.|s\d+\.)?debriditalia\.com/dl/\d+' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Debriditalia.com multi-hoster plugin""" __license__ = "GPLv3" @@ -22,9 +24,9 @@ class DebridItaliaCom(MultiHoster): URL_REPLACEMENTS = [("https://", "http://")] - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): self.html = self.load("http://www.debriditalia.com/api.php", - get={'generate': "on", 'link': pyfile.url, 'p': self.getPassword()}) + get={'generate': "on", 'link': pyfile.url, 'p': self.get_password()}) if "ERROR:" not in self.html: self.link = self.html.strip() @@ -34,7 +36,7 @@ class DebridItaliaCom(MultiHoster): self.html = self.load("http://debriditalia.com/linkgen2.php", post={'xjxfun' : "convertiLink", 'xjxargs[]': "S<![CDATA[%s]]>" % pyfile.url, - 'xjxargs[]': "S%s" % self.getPassword()}) + 'xjxargs[]': "S%s" % self.get_password()}) try: self.link = re.search(r'<a href="(.+?)"', self.html).group(1) except AttributeError: diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 18f23f552..9d42935cb 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -3,14 +3,15 @@ import re import urllib -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" - __version__ = "0.56" + __version__ = "0.57" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -40,18 +41,18 @@ class DepositfilesCom(SimpleHoster): LINK_MIRROR_PATTERN = r'class="repeat_mirror"><a href="(.+?)"' - def handleFree(self, pyfile): + def handle_free(self, pyfile): self.html = self.load(pyfile.url, post={'gateway_result': "1"}) - self.checkErrors() + self.check_errors() m = re.search(r"var fid = '(\w+)';", self.html) if m is None: self.retry(wait_time=5) params = {'fid': m.group(1)} - self.logDebug("FID: %s" % params['fid']) + self.log_debug("FID: %s" % params['fid']) - self.checkErrors() + self.check_errors() recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() @@ -69,9 +70,9 @@ class DepositfilesCom(SimpleHoster): self.link = urllib.unquote(m.group(1)) - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): if '<span class="html_download_api-gold_traffic_limit">' in self.html: - self.logWarning(_("Download limit reached")) + self.log_warning(_("Download limit reached")) self.retry(25, 60 * 60, "Download limit reached") elif 'onClick="show_gold_offer' in self.html: diff --git a/module/plugins/hoster/DevhostSt.py b/module/plugins/hoster/DevhostSt.py index e7a23f6b1..d999cdf96 100644 --- a/module/plugins/hoster/DevhostSt.py +++ b/module/plugins/hoster/DevhostSt.py @@ -11,12 +11,13 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DevhostSt(SimpleHoster): __name__ = "DevhostSt" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?d-h\.st/(?!users/)\w{3}' __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """d-h.st hoster plugin""" + __description__ = """D-h.st hoster plugin""" __license__ = "GPLv3" __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] @@ -31,7 +32,7 @@ class DevhostSt(SimpleHoster): def setup(self): self.multiDL = True - self.chunkLimit = 1 + self.chunk_limit = 1 getInfo = create_getInfo(DevhostSt) diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 030f7e971..f9d427c1b 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -5,7 +5,6 @@ import re from module.network.Browser import Browser from module.network.CookieJar import CookieJar -from module.plugins.internal.AdYouLike import AdYouLike from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns @@ -36,7 +35,8 @@ class CustomBrowser(Browser): class DlFreeFr(SimpleHoster): __name__ = "DlFreeFr" __type__ = "hoster" - __version__ = "0.29" + __version__ = "0.32" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?dl\.free\.fr/(\w+|getfile\.pl\?file=/\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -44,24 +44,24 @@ class DlFreeFr(SimpleHoster): __description__ = """Dl.free.fr hoster plugin""" __license__ = "GPLv3" __authors__ = [("the-razer", "daniel_ AT gmx DOT net"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("Toilal", "toilal.dev@gmail.com")] + ("zoidberg" , "zoidberg@mujmail.cz" ), + ("Toilal" , "toilal.dev@gmail.com" )] - NAME_PATTERN = r'Fichier:</td>\s*<td.*?>(?P<N>[^>]*)</td>' - SIZE_PATTERN = r'Taille:</td>\s*<td.*?>(?P<S>[\d.,]+\w)o' + NAME_PATTERN = r'Fichier:</td>\s*<td.*?>(?P<N>[^>]*)</td>' + SIZE_PATTERN = r'Taille:</td>\s*<td.*?>(?P<S>[\d.,]+\w)o' OFFLINE_PATTERN = r'Erreur 404 - Document non trouv|Fichier inexistant|Le fichier demandé n\'a pas été trouvé' def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True self.limitDL = 5 - self.chunkLimit = 1 + self.chunk_limit = 1 def init(self): - factory = self.core.requestFactory + factory = self.pyload.requestFactory self.req = CustomBrowser(factory.bucket, factory.getOptions()) @@ -77,13 +77,15 @@ class DlFreeFr(SimpleHoster): if headers.get('code') == 200: content_type = headers.get('content-type') if content_type and content_type.startswith("text/html"): - # Undirect acces to requested file, with a web page providing it (captcha) + #: Undirect acces to requested file, with a web page providing it (captcha) self.html = self.load(valid_url) - self.handleFree(pyfile) + self.handle_free(pyfile) else: - # Direct access to requested file for users using free.fr as Internet Service Provider. + #: Direct access to requested file for users using free.fr as Internet Service Provider. self.link = valid_url + self.download(self.link, disposition=True) + elif headers.get('code') == 404: self.offline() @@ -91,33 +93,27 @@ class DlFreeFr(SimpleHoster): self.fail(_("Invalid return code: ") + str(headers.get('code'))) - def handleFree(self, pyfile): - action, inputs = self.parseHtmlForm('action="getfile.pl"') - - adyoulike = AdYouLike(self) - response, challenge = adyoulike.challenge() - inputs.update(response) - + def handle_free(self, pyfile): + action, inputs = self.parse_html_form('action="getfile.pl"') self.load("http://dl.free.fr/getfile.pl", post=inputs) - headers = self.getLastHeaders() + headers = self.get_last_headers() 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(__name__) + m = re.search("(.*?)=(.*?); path=(.*?); domain=(.*)", headers.get("set-cookie")) + cj = CookieJar(self.__name__) if m: 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")) - def getLastHeaders(self): - #parse header - header = {"code": self.req.code} + def get_last_headers(self): + #: Parse header + header = {'code': self.req.code} for line in self.req.http.header.splitlines(): line = line.strip() if not line or ":" not in line: @@ -128,7 +124,7 @@ class DlFreeFr(SimpleHoster): value = value.strip() if key in header: - if type(header[key]) == list: + if type(header[key]) is list: header[key].append(value) else: header[key] = [header[key], value] diff --git a/module/plugins/hoster/DodanePl.py b/module/plugins/hoster/DodanePl.py index 46f748cc4..3a2c732d8 100644 --- a/module/plugins/hoster/DodanePl.py +++ b/module/plugins/hoster/DodanePl.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class DodanePl(DeadHoster): __name__ = "DodanePl" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?dodane\.pl/file/\d+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/DropboxCom.py b/module/plugins/hoster/DropboxCom.py index eec968f5a..7c4e952df 100644 --- a/module/plugins/hoster/DropboxCom.py +++ b/module/plugins/hoster/DropboxCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DropboxCom(SimpleHoster): __name__ = "DropboxCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?dropbox\.com/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -28,11 +29,11 @@ class DropboxCom(SimpleHoster): def setup(self): self.multiDL = True - self.chunkLimit = 1 - self.resumeDownload = True + self.chunk_limit = 1 + self.resume_download = True - def handleFree(self, pyfile): + def handle_free(self, pyfile): self.download(pyfile.url, get={'dl': "1"}) diff --git a/module/plugins/hoster/DuploadOrg.py b/module/plugins/hoster/DuploadOrg.py index 076171544..124919d91 100644 --- a/module/plugins/hoster/DuploadOrg.py +++ b/module/plugins/hoster/DuploadOrg.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class DuploadOrg(DeadHoster): __name__ = "DuploadOrg" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?dupload\.org/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/EasybytezCom.py b/module/plugins/hoster/EasybytezCom.py index 693910c1b..81b524a20 100644 --- a/module/plugins/hoster/EasybytezCom.py +++ b/module/plugins/hoster/EasybytezCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class EasybytezCom(XFSHoster): __name__ = "EasybytezCom" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.24" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?easybytez\.com/\w{12}' diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index b8485001e..3204ec9ad 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class EdiskCz(SimpleHoster): __name__ = "EdiskCz" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.24" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?edisk\.(cz|sk|eu)/(stahni|sk/stahni|en/download)/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -32,20 +33,20 @@ class EdiskCz(SimpleHoster): def process(self, pyfile): url = re.sub("/(stahni|sk/stahni)/", "/en/download/", pyfile.url) - self.logDebug("URL:" + url) + self.log_debug("URL:" + url) m = re.search(self.ACTION_PATTERN, url) if m is None: self.error(_("ACTION_PATTERN not found")) action = m.group(1) - self.html = self.load(url, decode=True) - self.getFileInfo() + self.html = self.load(url) + self.get_fileInfo() self.html = self.load(re.sub("/en/download/", "/en/download-slow/", url)) url = self.load(re.sub("/en/download/", "/x-download/", url), post={ - "action": action + 'action': action }) if not re.match(self.LINK_FREE_PATTERN, url): diff --git a/module/plugins/hoster/EgoFilesCom.py b/module/plugins/hoster/EgoFilesCom.py index 78108962f..d91c70fdc 100644 --- a/module/plugins/hoster/EgoFilesCom.py +++ b/module/plugins/hoster/EgoFilesCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class EgoFilesCom(DeadHoster): __name__ = "EgoFilesCom" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?egofiles\.com/\w+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/EnteruploadCom.py b/module/plugins/hoster/EnteruploadCom.py index 8ef994e1e..bc7d2415a 100644 --- a/module/plugins/hoster/EnteruploadCom.py +++ b/module/plugins/hoster/EnteruploadCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class EnteruploadCom(DeadHoster): __name__ = "EnteruploadCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?enterupload\.com/\w+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/EpicShareNet.py b/module/plugins/hoster/EpicShareNet.py index 7e3c8ba0e..498a43395 100644 --- a/module/plugins/hoster/EpicShareNet.py +++ b/module/plugins/hoster/EpicShareNet.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class EpicShareNet(DeadHoster): __name__ = "EpicShareNet" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?epicshare\.net/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 842e0cb87..53ac9ff06 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class EuroshareEu(SimpleHoster): __name__ = "EuroshareEu" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.30" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -23,33 +24,33 @@ class EuroshareEu(SimpleHoster): LINK_FREE_PATTERN = r'<a href="(/file/\d+/[^/]*/download/)"><div class="downloadButton"' - ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>|<p>Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' - ERR_NOT_LOGGED_IN_PATTERN = r'href="/customer-zone/login/"' + DL_LIMIT_PATTERN = r'<h2>Prebieha s.ahovanie</h2>|<p>Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' + ERROR_PATTERN = r'href="/customer-zone/login/"' URL_REPLACEMENTS = [(r"(http://[^/]*\.)(sk|cz|hu|pl)/", r"\1eu/")] - def handlePremium(self, pyfile): - if self.ERR_NOT_LOGGED_IN_PATTERN in self.html: + 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.link = pyfile.url.rstrip('/') + "/download/" - check = self.checkDownload({"login": re.compile(self.ERR_NOT_LOGGED_IN_PATTERN), - "json" : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) + check = self.check_download({'login': re.compile(self.ERROR_PATTERN), + 'json' : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) - if check == "login" or (check == "json" and self.lastCheck.group(1) == "Access token expired"): + 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")) elif check == "json": - self.fail(self.lastCheck.group(1)) + self.fail(self.last_check.group(1)) - def handleFree(self, pyfile): - if re.search(self.ERR_PARDL_PATTERN, self.html): - self.longWait(5 * 60, 12) + def handle_free(self, pyfile): + if re.search(self.DL_LIMIT_PATTERN, self.html): + self.wait(5 * 60, 12, _("Download limit reached")) m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: @@ -58,11 +59,4 @@ class EuroshareEu(SimpleHoster): self.link = "http://euroshare.eu%s" % m.group(1) - def checkFile(self, rules={}): - if self.checkDownload({"multi-dl": re.compile(self.ERR_PARDL_PATTERN)}) - self.longWait(5 * 60, 12) - - return super(EuroshareEu, self).checkFile(rules) - - getInfo = create_getInfo(EuroshareEu) diff --git a/module/plugins/hoster/ExashareCom.py b/module/plugins/hoster/ExashareCom.py index d70ca6d3a..19cd1b46c 100644 --- a/module/plugins/hoster/ExashareCom.py +++ b/module/plugins/hoster/ExashareCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class ExashareCom(XFSHoster): __name__ = "ExashareCom" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?exashare\.com/\w{12}' @@ -22,11 +23,11 @@ class ExashareCom(XFSHoster): def setup(self): self.multiDL = True - self.chunkLimit = 1 - self.resumeDownload = self.premium + self.chunk_limit = 1 + self.resume_download = self.premium - def handleFree(self, pyfile): + 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")) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index ead2e1e53..3442e7d27 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -4,14 +4,15 @@ import re from module.common.json_layer import json_loads -from module.plugins.internal.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, secondsToMidnight +from module.plugins.captcha.ReCaptcha import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, seconds_to_midnight class ExtabitCom(SimpleHoster): __name__ = "ExtabitCom" __type__ = "hoster" - __version__ = "0.66" + __version__ = "0.67" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -29,7 +30,7 @@ class ExtabitCom(SimpleHoster): LINK_FREE_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/\w+/.*?)[\'"]' - def handleFree(self, pyfile): + def handle_free(self, pyfile): if r">Only premium users can download this file" in self.html: self.fail(_("Only premium users can download this file")) @@ -37,10 +38,10 @@ class ExtabitCom(SimpleHoster): if m: self.wait(int(m.group(1)) * 60, True) elif "The daily downloads limit from your IP is exceeded" in self.html: - self.logWarning(_("You have reached your daily downloads limit for today")) - self.wait(secondsToMidnight(gmt=2), True) + self.log_warning(_("You have reached your daily downloads limit for today")) + self.wait(seconds_to_midnight(gmt=2), True) - self.logDebug("URL: " + self.req.http.lastEffectiveURL) + 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'] @@ -50,14 +51,14 @@ class ExtabitCom(SimpleHoster): captcha_key = m.group(1) for _i in xrange(5): - get_data = {"type": "recaptcha"} + 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.correctCaptcha() + self.captcha.correct() break else: - self.invalidCaptcha() + self.captcha.invalid() else: self.fail(_("Invalid captcha")) else: diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index cc50f4229..0019cf3c2 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -10,10 +10,12 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.13" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Fastix multi-hoster plugin""" __license__ = "GPLv3" @@ -21,11 +23,11 @@ class FastixRu(MultiHoster): def setup(self): - self.chunkLimit = 3 + self.chunk_limit = 3 - def handlePremium(self, pyfile): - api_key = self.account.getAccountData(self.user) + 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/", @@ -33,7 +35,7 @@ class FastixRu(MultiHoster): data = json_loads(self.html) - self.logDebug("Json data", data) + self.log_debug("Json data", data) if "error\":true" in self.html: self.offline() diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 330a6e3b9..485d69d15 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -9,7 +9,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FastshareCz(SimpleHoster): __name__ = "FastshareCz" __type__ = "hoster" - __version__ = "0.29" + __version__ = "0.32" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -33,20 +34,20 @@ class FastshareCz(SimpleHoster): CREDIT_ERROR = " credit for " - def checkErrors(self): + def check_errors(self): if self.SLOT_ERROR in self.html: errmsg = self.info['error'] = _("No free slots") self.retry(12, 60, errmsg) if self.CREDIT_ERROR in self.html: errmsg = self.info['error'] = _("Not enough traffic left") - self.logWarning(errmsg) - self.resetAccount() + self.log_warning(errmsg) + self.restart(nopremium=True) self.info.pop('error', None) - def handleFree(self, pyfile): + def handle_free(self, pyfile): m = re.search(self.FREE_URL_PATTERN, self.html) if m: action, captcha_src = m.groups() @@ -54,12 +55,12 @@ class FastshareCz(SimpleHoster): self.error(_("FREE_URL_PATTERN not found")) baseurl = "http://www.fastshare.cz" - captcha = self.decryptCaptcha(urlparse.urljoin(baseurl, captcha_src)) + captcha = self.captcha.decrypt(urlparse.urljoin(baseurl, captcha_src)) self.download(urlparse.urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18}) - def checkFile(self, rules={}): - check = self.checkDownload({ + def check_file(self): + check = self.check_download({ '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) @@ -72,9 +73,9 @@ class FastshareCz(SimpleHoster): self.retry(max_tries=5, reason=_("Wrong captcha")) elif check == "credit": - self.resetAccount() + self.restart(nopremium=True) - return super(FastshareCz, self).checkFile(rules) + return super(FastshareCz, self).check_file() getInfo = create_getInfo(FastshareCz) diff --git a/module/plugins/hoster/FileApeCom.py b/module/plugins/hoster/FileApeCom.py index 79157539b..c91024824 100644 --- a/module/plugins/hoster/FileApeCom.py +++ b/module/plugins/hoster/FileApeCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class FileApeCom(DeadHoster): __name__ = "FileApeCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?fileape\.com/(index\.php\?act=download\&id=|dl/)\w+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index de030be9c..62a7a553f 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -9,7 +9,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileSharkPl(SimpleHoster): __name__ = "FileSharkPl" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.13" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d+/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -20,7 +21,7 @@ class FileSharkPl(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] - NAME_PATTERN = r'<h2 class="name-file">(?P<N>.+)</h2>' + NAME_PATTERN = r'<h2 class="name-file">(?P<N>.+?)</h2>' SIZE_PATTERN = r'<p class="size-file">(.*?)<strong>(?P<S>\d+\.?\d*)\s(?P<U>\w+)</strong></p>' OFFLINE_PATTERN = r'(P|p)lik zosta. (usuni.ty|przeniesiony)' @@ -37,7 +38,7 @@ class FileSharkPl(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True if self.premium: self.multiDL = True @@ -46,8 +47,8 @@ class FileSharkPl(SimpleHoster): self.multiDL = False - def checkErrors(self): - # check if file is now available for download (-> file name can be found in html body) + 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: errmsg = self.info['error'] = _("Another download already run") @@ -62,7 +63,7 @@ class FileSharkPl(SimpleHoster): elif re.match(self.SLOT_ERROR_PATTERN, alert): errmsg = self.info['error'] = _("No free download slots available") - self.logWarning(errmsg) + self.log_warning(errmsg) self.retry(10, 30 * 60, _("Still no free download slots available")) else: @@ -72,7 +73,7 @@ class FileSharkPl(SimpleHoster): self.info.pop('error', None) - def handleFree(self, pyfile): + def handle_free(self, pyfile): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Download url not found")) @@ -84,10 +85,10 @@ class FileSharkPl(SimpleHoster): m = re.search(self.WAIT_PATTERN, self.html) if m: seconds = int(m.group(1)) - self.logDebug("Wait %s seconds" % seconds) + self.log_debug("Wait %s seconds" % seconds) self.wait(seconds) - action, inputs = self.parseHtmlForm('action=""') + action, inputs = self.parse_html_form('action=""') m = re.search(self.TOKEN_PATTERN, self.html) if m is None: @@ -99,19 +100,10 @@ class FileSharkPl(SimpleHoster): if m is None: self.retry(reason=_("Captcha image not found")) - tmp_load = self.load - self.load = self._decode64 #: work-around: injects decode64 inside decryptCaptcha - - inputs['form[captcha]'] = self.decryptCaptcha(m.group(1), imgtype='jpeg') + inputs['form[captcha]'] = self.captcha._decrypt(m.group(1).decode('base64'), input_type='jpeg') inputs['form[start]'] = "" - self.load = tmp_load - self.download(link, post=inputs, disposition=True) - def _decode64(self, data, *args, **kwargs): - return data.decode('base64') - - getInfo = create_getInfo(FileSharkPl) diff --git a/module/plugins/hoster/FileStoreTo.py b/module/plugins/hoster/FileStoreTo.py index 3262b73ad..96c1456cb 100644 --- a/module/plugins/hoster/FileStoreTo.py +++ b/module/plugins/hoster/FileStoreTo.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileStoreTo(SimpleHoster): __name__ = "FileStoreTo" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?filestore\.to/\?d=(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -25,11 +26,11 @@ class FileStoreTo(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - def handleFree(self, pyfile): + def handle_free(self, pyfile): self.wait(10) self.link = self.load("http://filestore.to/ajax/download.php", get={'D': re.search(r'"D=(\w+)', self.html).group(1)}) diff --git a/module/plugins/hoster/FilebeerInfo.py b/module/plugins/hoster/FilebeerInfo.py index 244131dc7..9db53fe19 100644 --- a/module/plugins/hoster/FilebeerInfo.py +++ b/module/plugins/hoster/FilebeerInfo.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class FilebeerInfo(DeadHoster): __name__ = "FilebeerInfo" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?filebeer\.info/(?!\d*~f)(?P<ID>\w+)' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/FileboomMe.py b/module/plugins/hoster/FileboomMe.py index 9cdeebe3d..2798d9eda 100644 --- a/module/plugins/hoster/FileboomMe.py +++ b/module/plugins/hoster/FileboomMe.py @@ -10,7 +10,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileboomMe(SimpleHoster): __name__ = "FileboomMe" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'https?://f(?:ile)?boom\.me/file/(?P<ID>\w+)' @@ -30,12 +31,12 @@ class FileboomMe(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = False - self.chunkLimit = 1 + self.chunk_limit = 1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): post_url = urljoin(pyfile.url, "/file/" + self.info['pattern']['ID']) m = re.search(r'data-slow-id="(\w+)"', self.html) @@ -55,7 +56,7 @@ class FileboomMe(SimpleHoster): m = re.search(self.CAPTCHA_PATTERN, self.html) if m: - captcha = self.decryptCaptcha(urljoin(pyfile.url, m.group(1))) + captcha = self.captcha.decrypt(urljoin(pyfile.url, m.group(1))) self.html = self.load(post_url, post={'CaptchaForm[code]' : captcha, @@ -64,10 +65,10 @@ class FileboomMe(SimpleHoster): 'uniqueId' : uniqueId}) if 'The verification code is incorrect' in self.html: - self.invalidCaptcha() + self.captcha.invalid() else: - self.checkErrors() + self.check_errors() self.html = self.load(post_url, post={'free' : 1, @@ -78,7 +79,7 @@ class FileboomMe(SimpleHoster): self.link = urljoin(pyfile.url, m.group(0)) else: - self.invalidCaptcha() + self.captcha.invalid() break diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 346e9c444..21654fee3 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -3,14 +3,15 @@ import re from module.common.json_layer import json_loads -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -29,7 +30,7 @@ class FilecloudIo(SimpleHoster): TEMP_OFFLINE_PATTERN = r'l10n\.FILES__WARNING' UKEY_PATTERN = r'\'ukey\'\s*:\'(\w+)' - AB1_PATTERN = r'if\( __ab1 == \'(\w+)\' \)' + AB1_PATTERN = r'if\( __ab1 is \'(\w+)\' \)' ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);' @@ -39,13 +40,13 @@ class FilecloudIo(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - self.chunkLimit = 1 + self.chunk_limit = 1 - def handleFree(self, pyfile): - data = {"ukey": self.info['pattern']['ID']} + def handle_free(self, pyfile): + data = {'ukey': self.info['pattern']['ID']} m = re.search(self.AB1_PATTERN, self.html) if m is None: @@ -61,20 +62,20 @@ class FilecloudIo(SimpleHoster): self.error(_("ReCaptcha key not found")) response, challenge = recaptcha.challenge(captcha_key) - self.account.form_data = {"recaptcha_challenge_field": challenge, - "recaptcha_response_field" : response} + self.account.form_data = {'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response} self.account.relogin(self.user) self.retry(2) json_url = "http://filecloud.io/download-request.json" res = self.load(json_url, post=data) - self.logDebug(res) + self.log_debug(res) res = json_loads(res) if "error" in res and res['error']: self.fail(res) - self.logDebug(res) + self.log_debug(res) if res['captcha']: data['ctype'] = "recaptcha" @@ -83,13 +84,13 @@ class FilecloudIo(SimpleHoster): json_url = "http://filecloud.io/download-request.json" res = self.load(json_url, post=data) - self.logDebug(res) + self.log_debug(res) res = json_loads(res) if "retry" in res and res['retry']: - self.invalidCaptcha() + self.captcha.invalid() else: - self.correctCaptcha() + self.captcha.correct() break else: self.fail(_("Incorrect captcha")) @@ -102,22 +103,22 @@ class FilecloudIo(SimpleHoster): self.error(_("LINK_FREE_PATTERN not found")) if "size" in self.info and self.info['size']: - self.check_data = {"size": int(self.info['size'])} + self.check_data = {'size': int(self.info['size'])} self.link = m.group(1) else: self.fail(_("Unexpected server response")) - def handlePremium(self, pyfile): - akey = self.account.getAccountData(self.user)['akey'] + def handle_premium(self, pyfile): + akey = self.account.get_data(self.user)['akey'] ukey = self.info['pattern']['ID'] - self.logDebug("Akey: %s | Ukey: %s" % (akey, ukey)) + self.log_debug("Akey: %s | Ukey: %s" % (akey, ukey)) rep = self.load("http://api.filecloud.io/api-fetch_download_url.api", - post={"akey": akey, "ukey": ukey}) - self.logDebug("FetchDownloadUrl: " + rep) + post={'akey': akey, 'ukey': ukey}) + self.log_debug("FetchDownloadUrl: " + rep) rep = json_loads(rep) - if rep['status'] == 'ok': + if rep['status'] == "ok": self.link = rep['download_url'] else: self.fail(rep['message']) diff --git a/module/plugins/hoster/FiledropperCom.py b/module/plugins/hoster/FiledropperCom.py new file mode 100644 index 000000000..3f5e2b761 --- /dev/null +++ b/module/plugins/hoster/FiledropperCom.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- + +import re +import urlparse + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class FiledropperCom(SimpleHoster): + __name__ = "FiledropperCom" + __type__ = "hoster" + __version__ = "0.02" + __status__ = "testing" + + __pattern__ = r'https?://(?:www\.)?filedropper\.com/\w+' + + __description__ = """Filedropper.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'Filename: (?P<N>.+?) <' + SIZE_PATTERN = r'Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+),' #@NOTE: Website says always 0 KB + OFFLINE_PATTERN = r'value="a\.swf"' + + + def setup(self): + self.multiDL = False + self.chunk_limit = 1 + + + def handle_free(self, pyfile): + m = re.search(r'img id="img" src="(.+?)"', self.html) + if m is None: + 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}) + + +getInfo = create_getInfo(FiledropperCom) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index ea1a38b7a..325b4bb27 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -3,24 +3,25 @@ import re import urlparse -from module.network.RequestFactory import getURL -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo +from module.network.RequestFactory import getURL as get_url +from module.plugins.internal.SimpleHoster import SimpleHoster, parse_fileInfo -def getInfo(urls): +def get_info(urls): for url in urls: - h = getURL(url, just_header=True) + h = get_url(url, just_header=True) m = re.search(r'Location: (.+)\r\n', h) if m and not re.match(m.group(1), FilefactoryCom.__pattern__): #: It's a direct link! Skipping yield (url, 0, 3, url) else: #: It's a standard html page - yield parseFileInfo(FilefactoryCom, url, getURL(url)) + yield parse_fileInfo(FilefactoryCom, url, get_url(url)) class FilefactoryCom(SimpleHoster): __name__ = "FilefactoryCom" __type__ = "hoster" - __version__ = "0.55" + __version__ = "0.57" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?filefactory\.com/(file|trafficshare/\w+)/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -42,7 +43,7 @@ class FilefactoryCom(SimpleHoster): COOKIES = [("filefactory.com", "locale", "en_US.utf8")] - def handleFree(self, pyfile): + def handle_free(self, pyfile): if "Currently only Premium Members can download files larger than" in self.html: self.fail(_("File too large for free download")) elif "All free download slots on this server are currently in use" in self.html: @@ -59,22 +60,22 @@ class FilefactoryCom(SimpleHoster): self.wait(m.group(1)) - def checkFile(self, rules={}): - check = self.checkDownload({'multiple': "You are currently downloading too many files at once.", + def check_file(self): + check = self.check_download({'multiple': "You are currently downloading too many files at once.", 'error' : '<div id="errorMessage">'}) if check == "multiple": - self.logDebug("Parallel downloads detected; waiting 15 minutes") + self.log_debug("Parallel downloads detected; waiting 15 minutes") self.retry(wait_time=15 * 60, reason=_("Parallel downloads")) elif check == "error": self.error(_("Unknown error")) - return super(FilefactoryCom, self).checkFile(rules) + return super(FilefactoryCom, self).check_file() - def handlePremium(self, pyfile): - self.link = self.directLink(self.load(pyfile.url, just_header=True)) + 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) diff --git a/module/plugins/hoster/FilejungleCom.py b/module/plugins/hoster/FilejungleCom.py index 236603c6e..1a2a7d344 100644 --- a/module/plugins/hoster/FilejungleCom.py +++ b/module/plugins/hoster/FilejungleCom.py @@ -1,13 +1,14 @@ # -*- coding: utf-8 -*- -from module.plugins.hoster.FileserveCom import FileserveCom, checkFile -from module.plugins.Plugin import chunks +from module.plugins.hoster.FileserveCom import FileserveCom, check_file +from module.plugins.internal.Plugin import chunks class FilejungleCom(FileserveCom): __name__ = "FilejungleCom" __type__ = "hoster" - __version__ = "0.51" + __version__ = "0.53" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?filejungle\.com/f/(?P<ID>[^/]+)' @@ -24,6 +25,6 @@ class FilejungleCom(FileserveCom): LONG_WAIT_PATTERN = r'<h1>Please wait for (\d+) (\w+)\s*to download the next file\.</h1>' -def getInfo(urls): +def get_info(urls): for chunk in chunks(urls, 100): - yield checkFile(FilejungleCom, chunk) + yield check_file(FilejungleCom, chunk) diff --git a/module/plugins/hoster/FileomCom.py b/module/plugins/hoster/FileomCom.py index 306953b84..0d54b6b6c 100644 --- a/module/plugins/hoster/FileomCom.py +++ b/module/plugins/hoster/FileomCom.py @@ -9,7 +9,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class FileomCom(XFSHoster): __name__ = "FileomCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?fileom\.com/\w{12}' @@ -26,8 +27,8 @@ class FileomCom(XFSHoster): def setup(self): self.multiDL = True - self.chunkLimit = 1 - self.resumeDownload = self.premium + self.chunk_limit = 1 + self.resume_download = self.premium getInfo = create_getInfo(FileomCom) diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 1f3de6717..d8c626ef2 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -4,14 +4,15 @@ import re import time from module.common.json_layer import json_loads -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" - __version__ = "0.34" + __version__ = "0.35" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/(?P<ID>[^/]+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -29,7 +30,7 @@ class FilepostCom(SimpleHoster): FLP_TOKEN_PATTERN = r'set_store_options\({token: \'(.+?)\'' - def handleFree(self, pyfile): + def handle_free(self, pyfile): m = re.search(self.FLP_TOKEN_PATTERN, self.html) if m is None: self.error(_("Token")) @@ -40,27 +41,27 @@ class FilepostCom(SimpleHoster): self.error(_("Captcha key")) captcha_key = m.group(1) - # Get wait time + #: Get wait time get_dict = {'SID': self.req.cj.getCookie('SID'), 'JsHttpRequest': str(int(time.time() * 10000)) + '-xml'} post_dict = {'action': 'set_download', 'token': flp_token, 'code': self.info['pattern']['ID']} - wait_time = int(self.getJsonResponse(get_dict, post_dict, 'wait_time')) + wait_time = int(self.get_json_response(get_dict, post_dict, 'wait_time')) if wait_time > 0: self.wait(wait_time) - post_dict = {"token": flp_token, "code": self.info['pattern']['ID'], "file_pass": ''} + post_dict = {'token': flp_token, 'code': self.info['pattern']['ID'], 'file_pass': ''} if 'var is_pass_exists = true;' in self.html: - # Solve password - password = self.getPassword() + #: Solve password + password = self.get_password() if password: - self.logInfo(_("Password protected link, trying ") + file_pass) + self.log_info(_("Password protected link, trying ") + file_pass) get_dict['JsHttpRequest'] = str(int(time.time() * 10000)) + '-xml' post_dict['file_pass'] = file_pass - self.link = self.getJsonResponse(get_dict, post_dict, 'link') + self.link = self.get_json_response(get_dict, post_dict, 'link') if not self.link: self.fail(_("Incorrect password")) @@ -68,7 +69,7 @@ class FilepostCom(SimpleHoster): self.fail(_("No password found")) else: - # Solve recaptcha + #: Solve recaptcha recaptcha = ReCaptcha(self) for i in xrange(5): @@ -76,32 +77,32 @@ class FilepostCom(SimpleHoster): if i: post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = recaptcha.challenge( captcha_key) - self.logDebug(u"RECAPTCHA: %s : %s : %s" % ( + self.log_debug(u"RECAPTCHA: %s : %s : %s" % ( captcha_key, post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'])) - self.link = self.getJsonResponse(get_dict, post_dict, 'link') + self.link = self.get_json_response(get_dict, post_dict, 'link') else: self.fail(_("Invalid captcha")) - def getJsonResponse(self, get_dict, post_dict, field): + 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)) - self.logDebug(res) + self.log_debug(res) if not 'js' in res: self.error(_("JSON %s 1") % field) - # i changed js_answer to res['js'] since js_answer is nowhere set. - # i don't know the JSON-HTTP specs in detail, but the previous author - # accessed res['js']['error'] as well as js_answer['error']. - # see the two lines commented out with "# ~?". + #: I changed js_answer to res['js'] since js_answer is nowhere set. + #: I don't know the JSON-HTTP specs in detail, but the previous author + #: Accessed res['js']['error'] as well as js_answer['error']. + #: See the two lines commented out with "# ~?". if 'error' in res['js']: - if res['js']['error'] == 'download_delay': + 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_time=js_answer['params']['next_download']) elif 'Wrong file password' in res['js']['error'] \ or 'You entered a wrong CAPTCHA code' in res['js']['error'] \ @@ -109,7 +110,7 @@ class FilepostCom(SimpleHoster): return None elif 'CAPTCHA' in res['js']['error']: - self.logDebug("Error response is unknown, but mentions CAPTCHA") + self.log_debug("Error response is unknown, but mentions CAPTCHA") return None else: diff --git a/module/plugins/hoster/FilepupNet.py b/module/plugins/hoster/FilepupNet.py index 874fde3c8..8bb23adb1 100644 --- a/module/plugins/hoster/FilepupNet.py +++ b/module/plugins/hoster/FilepupNet.py @@ -12,7 +12,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepupNet(SimpleHoster): __name__ = "FilepupNet" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?filepup\.net/files/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -33,10 +34,10 @@ class FilepupNet(SimpleHoster): def setup(self): self.multiDL = False - self.chunkLimit = 1 + self.chunk_limit = 1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Download link not found")) diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index 3b876ed48..f8c41f4d1 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -8,14 +8,15 @@ import pycurl import re import urlparse -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilerNet(SimpleHoster): __name__ = "FilerNet" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?filer\.net/get/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -34,14 +35,14 @@ class FilerNet(SimpleHoster): LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'href="([^"]+)">Get download</a>' - def handleFree(self, pyfile): - inputs = self.parseHtmlForm(input_names={'token': re.compile(r'.+')})[1] + def handle_free(self, pyfile): + inputs = self.parse_html_form(input_names={'token': re.compile(r'.+')})[1] if 'token' not in inputs: self.error(_("Unable to detect token")) - self.html = self.load(pyfile.url, post={'token': inputs['token']}, decode=True) + self.html = self.load(pyfile.url, post={'token': inputs['token']}) - inputs = self.parseHtmlForm(input_names={'hash': re.compile(r'.+')})[1] + inputs = self.parse_html_form(input_names={'hash': re.compile(r'.+')})[1] if 'hash' not in inputs: self.error(_("Unable to detect hash")) @@ -58,9 +59,9 @@ class FilerNet(SimpleHoster): if 'location' in self.req.http.header.lower(): self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1) - self.correctCaptcha() + self.captcha.correct() else: - self.invalidCaptcha() + self.captcha.invalid() getInfo = create_getInfo(FilerNet) diff --git a/module/plugins/hoster/FilerioCom.py b/module/plugins/hoster/FilerioCom.py index c6ebbd444..c65c07a42 100644 --- a/module/plugins/hoster/FilerioCom.py +++ b/module/plugins/hoster/FilerioCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class FilerioCom(XFSHoster): __name__ = "FilerioCom" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?(filerio\.(in|com)|filekeen\.com)/\w{12}' diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index 7bd099282..a6dd56152 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -2,16 +2,16 @@ import re -from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster -from module.plugins.Plugin import chunks +from module.network.RequestFactory import getURL as get_url +from module.plugins.internal.Hoster import Hoster +from module.plugins.internal.Plugin import chunks -def getInfo(urls): +def get_info(urls): result = [] for chunk in chunks(urls, 10): for url in chunk: - html = getURL(url) + html = get_url(url) if r'<div class="errorMessage mb10">' in html: result.append((url, 0, 1, url)) elif r'Page cannot be displayed' in html: @@ -24,15 +24,16 @@ def getInfo(urls): except Exception: pass - # status 1=OFFLINE, 2=OK, 3=UNKNOWN - # result.append((#name,#size,#status,#url)) + #: status 1=OFFLINE, 2=OK, 3=UNKNOWN + #: result.append((#name,#size,#status,#url)) yield result class FilesMailRu(Hoster): __name__ = "FilesMailRu" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.34" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?files\.mail\.ru/.+' @@ -49,57 +50,62 @@ class FilesMailRu(Hoster): self.html = self.load(pyfile.url) self.url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' - #marks the file as "offline" when the pattern was found on the html-page''' + #: Marks the file as "offline" when the pattern was found on the html-page''' if r'<div class="errorMessage mb10">' in self.html: self.offline() elif r'Page cannot be displayed' in self.html: self.offline() - #the filename that will be showed in the list (e.g. test.part1.rar)''' - pyfile.name = self.getFileName() + #: The filename that will be showed in the list (e.g. test.part1.rar)''' + pyfile.name = self.get_file_name() - #prepare and download''' + #: Prepare and download''' if not self.account: self.prepare() - self.download(self.getFileUrl()) - self.myPostProcess() + self.download(self.get_file_url()) + self.my_post_process() else: - self.download(self.getFileUrl()) - self.myPostProcess() + self.download(self.get_file_url()) + self.my_post_process() def prepare(self): - """You have to wait some seconds. Otherwise you will get a 40Byte HTML Page instead of the file you expected""" - self.setWait(10) - self.wait() + """ + You have to wait some seconds. Otherwise you will get a 40Byte HTML Page instead of the file you expected + """ + self.wait(10) return True - def getFileUrl(self): - """gives you the URL to the file. Extracted from the Files.mail.ru HTML-page stored in self.html""" + def get_file_url(self): + """ + Gives you the URL to the file. Extracted from the Files.mail.ru HTML-page stored in self.html + """ return re.search(self.url_pattern, self.html).group(0).split('<a href="')[1].split('" onclick="return Act')[0] - def getFileName(self): - """gives you the Name for each file. Also extracted from the HTML-Page""" + def get_file_name(self): + """ + Gives you the Name for each file. Also extracted from the HTML-Page + """ return re.search(self.url_pattern, self.html).group(0).split(', event)">')[1].split('</a>')[0] - def myPostProcess(self): - # searches the file for HTMl-Code. Sometimes the Redirect - # doesn't work (maybe a curl Problem) and you get only a small - # HTML file and the Download is marked as "finished" - # then the download will be restarted. It's only bad for these - # who want download a HTML-File (it's one in a million ;-) ) + def my_post_process(self): + #: Searches the file for HTMl-Code. Sometimes the Redirect + #: doesn't work (maybe a curl Problem) and you get only a small + #: HTML file and the Download is marked as "finished" + #: then the download will be restarted. It's only bad for these + #: who want download a HTML-File (it's one in a million ;-) ) # - # The maximum UploadSize allowed on files.mail.ru at the moment is 100MB - # 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.checkDownload({"html": "<meta name="}, read_size=50000) + #: The maximum UploadSize allowed on files.mail.ru at the moment == 100MB + #: 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) if check == "html": - self.logInfo(_( + self.log_info(_( "There was HTML Code in the Downloaded File (%s)...redirect error? The Download will be restarted." % self.pyfile.name)) self.retry() diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index f8cf652b9..a74589cff 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -3,16 +3,16 @@ import re from module.common.json_layer import json_loads -from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster -from module.plugins.Plugin import chunks -from module.plugins.internal.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import secondsToMidnight -from module.utils import parseFileSize +from module.network.RequestFactory import getURL as get_url +from module.plugins.internal.Hoster import Hoster +from module.plugins.internal.Plugin import chunks +from module.plugins.captcha.ReCaptcha import ReCaptcha +from module.plugins.internal.SimpleHoster import seconds_to_midnight +from module.utils import parseFileSize as parse_size -def checkFile(plugin, urls): - html = getURL(plugin.URLS[1], post={"urls": "\n".join(urls)}, decode=True) +def check_file(plugin, urls): + html = get_url(plugin.URLS[1], post={'urls': "\n".join(urls)}) file_info = [] for li in re.finditer(plugin.LINKCHECK_TR, html, re.S): @@ -21,7 +21,7 @@ def checkFile(plugin, urls): if cols: file_info.append(( cols[1] if cols[1] != '--' else cols[0], - parseFileSize(cols[2]) if cols[2] != '--' else 0, + parse_size(cols[2]) if cols[2] != '--' else 0, 2 if cols[3].startswith('Available') else 1, cols[0])) except Exception, e: @@ -33,65 +33,67 @@ def checkFile(plugin, urls): class FileserveCom(Hoster): __name__ = "FileserveCom" __type__ = "hoster" - __version__ = "0.55" + __version__ = "0.58" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<ID>[^/]+)' __description__ = """Fileserve.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("jeix", "jeix@hasnomail.de"), - ("mkaay", "mkaay@mkaay.de"), - ("Paul King", None), - ("zoidberg", "zoidberg@mujmail.cz")] + __authors__ = [("jeix" , "jeix@hasnomail.de" ), + ("mkaay" , "mkaay@mkaay.de" ), + ("Paul King", None ), + ("zoidberg" , "zoidberg@mujmail.cz")] - URLS = ["http://www.fileserve.com/file/", "http://www.fileserve.com/link-checker.php", + URLS = ["http://www.fileserve.com/file/", + "http://www.fileserve.com/link-checker.php", "http://www.fileserve.com/checkReCaptcha.php"] + LINKCHECK_TR = r'<tr>\s*(<td>http://www\.fileserve\.com/file/.*?)</tr>' LINKCHECK_TD = r'<td>(?:<.*?>| )*([^<]*)' - CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(.+?)\'' - LONG_WAIT_PATTERN = r'<li class="title">You need to wait (\d+) (\w+) to start another download\.</li>' - LINK_EXPIRED_PATTERN = r'Your download link has expired' - DAILY_LIMIT_PATTERN = r'Your daily download limit has been reached' + CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(.+?)\'' + LONG_WAIT_PATTERN = r'<li class="title">You need to wait (\d+) (\w+) to start another download\.</li>' + LINK_EXPIRED_PATTERN = r'Your download link has expired' + DL_LIMIT_PATTERN = r'Your daily download limit has been reached' NOT_LOGGED_IN_PATTERN = r'<form (name="loginDialogBoxForm"|id="login_form")|<li><a href="/login\.php">Login</a></li>' def setup(self): - self.resumeDownload = self.multiDL = self.premium + self.resume_download = self.multiDL = self.premium self.file_id = re.match(self.__pattern__, self.pyfile.url).group('ID') self.url = "%s%s" % (self.URLS[0], self.file_id) - self.logDebug("File ID: %s URL: %s" % (self.file_id, self.url)) + self.log_debug("File ID: %s URL: %s" % (self.file_id, self.url)) def process(self, pyfile): - pyfile.name, pyfile.size, status, self.url = checkFile(self, [self.url])[0] + pyfile.name, pyfile.size, status, self.url = check_file(self, [self.url])[0] if status != 2: self.offline() - self.logDebug("File Name: %s Size: %d" % (pyfile.name, pyfile.size)) + self.log_debug("File Name: %s Size: %d" % (pyfile.name, pyfile.size)) if self.premium: - self.handlePremium() + self.handle_premium() else: - self.handleFree() + self.handle_free() - def handleFree(self): + def handle_free(self): self.html = self.load(self.url) - action = self.load(self.url, post={"checkDownload": "check"}, decode=True) + action = self.load(self.url, post={'checkDownload': "check"}) action = json_loads(action) - self.logDebug(action) + self.log_debug(action) if "fail" in action: if action['fail'] == "timeLimit": - self.html = self.load(self.url, post={"checkDownload": "showError", "errorType": "timeLimit"}, - decode=True) + self.html = self.load(self.url, post={'checkDownload': "showError", 'errorType': "timeLimit"}) - self.doLongWait(re.search(self.LONG_WAIT_PATTERN, self.html)) + self.do_long_wait(re.search(self.LONG_WAIT_PATTERN, self.html)) elif action['fail'] == "parallelDownload": - self.logWarning(_("Parallel download error, now waiting 60s")) + self.log_warning(_("Parallel download error, now waiting 60s")) self.retry(wait_time=60, reason=_("parallelDownload")) else: @@ -99,47 +101,46 @@ class FileserveCom(Hoster): elif "success" in action: if action['success'] == "showCaptcha": - self.doCaptcha() - self.doTimmer() + self.do_captcha() + self.do_timmer() elif action['success'] == "showTimmer": - self.doTimmer() + self.do_timmer() else: self.error(_("Unknown server response")) - # show download link - res = self.load(self.url, post={"downloadLink": "show"}, decode=True) - self.logDebug("Show downloadLink response: %s" % res) + #: Show download link + res = self.load(self.url, post={'downloadLink': "show"}) + self.log_debug("Show downloadLink response: %s" % res) if "fail" in res: self.error(_("Couldn't retrieve download url")) - # this may either download our file or forward us to an error page - self.download(self.url, post={"download": "normal"}) - self.logDebug(self.req.http.lastEffectiveURL) + #: This may either download our file or forward us to an error page + self.download(self.url, post={'download': "normal"}) + self.log_debug(self.req.http.lastEffectiveURL) - check = self.checkDownload({"expired": self.LINK_EXPIRED_PATTERN, - "wait" : re.compile(self.LONG_WAIT_PATTERN), - "limit" : self.DAILY_LIMIT_PATTERN}) + check = self.check_download({'expired': self.LINK_EXPIRED_PATTERN, + 'wait' : re.compile(self.LONG_WAIT_PATTERN), + 'limit' : self.DL_LIMIT_PATTERN}) if check == "expired": - self.logDebug("Download link was expired") + self.log_debug("Download link was expired") self.retry() elif check == "wait": - self.doLongWait(self.lastCheck) + self.do_long_wait(self.last_check) elif check == "limit": - self.logWarning(_("Download limited reached for today")) - self.setWait(secondsToMidnight(gmt=2), True) - self.wait() + self.log_warning(_("Download limited reached for today")) + self.wait(seconds_to_midnight(gmt=2), True) self.retry() - self.thread.m.reconnecting.wait(3) # Ease issue with later downloads appearing to be in parallel + self.thread.m.reconnecting.wait(3) #: Ease issue with later downloads appearing to be in parallel - def doTimmer(self): - res = self.load(self.url, post={"downloadLink": "wait"}, decode=True) - self.logDebug("Wait response: %s" % res[:80]) + def do_timmer(self): + res = self.load(self.url, post={'downloadLink': "wait"}) + self.log_debug("Wait response: %s" % res[:80]) if "fail" in res: self.fail(_("Failed getting wait time")) @@ -152,11 +153,10 @@ class FileserveCom(Hoster): else: wait_time = int(res) + 3 - self.setWait(wait_time) - self.wait() + self.wait(wait_time) - def doCaptcha(self): + def do_captcha(self): captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1) recaptcha = ReCaptcha(self) @@ -167,50 +167,48 @@ class FileserveCom(Hoster): 'recaptcha_response_field' : response, 'recaptcha_shortencode_field': self.file_id})) if not res['success']: - self.invalidCaptcha() + self.captcha.invalid() else: - self.correctCaptcha() + self.captcha.correct() break else: self.fail(_("Invalid captcha")) - def doLongWait(self, m): + def do_long_wait(self, m): wait_time = (int(m.group(1)) * {'seconds': 1, 'minutes': 60, 'hours': 3600}[m.group(2)]) if m else 12 * 60 - self.setWait(wait_time, True) - self.wait() + self.wait(wait_time, True) self.retry() - def handlePremium(self): + def handle_premium(self): premium_url = None if self.__name__ == "FileserveCom": - #try api download + #: Try api download res = self.load("http://app.fileserve.com/api/download/premium/", - post={"username": self.user, - "password": self.account.getAccountData(self.user)['password'], - "shorten": self.file_id}, - decode=True) + post={'username': self.user, + 'password': self.account.get_info(self.user)['login']['password'], + 'shorten': self.file_id}) if res: res = json_loads(res) if res['error_code'] == "302": premium_url = res['next'] elif res['error_code'] in ["305", "500"]: - self.tempOffline() + self.temp_offline() elif res['error_code'] in ["403", "605"]: - self.resetAccount() + self.restart(nopremium=True) elif res['error_code'] in ["606", "607", "608"]: self.offline() else: - self.logError(res['error_code'], res['error_message']) + self.log_error(res['error_code'], res['error_message']) self.download(premium_url or self.pyfile.url) - if not premium_url and self.checkDownload({"login": re.compile(self.NOT_LOGGED_IN_PATTERN)}): + 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")) -def getInfo(urls): +def get_info(urls): for chunk in chunks(urls, 100): - yield checkFile(FileserveCom, chunk) + yield check_file(FileserveCom, chunk) diff --git a/module/plugins/hoster/FileshareInUa.py b/module/plugins/hoster/FileshareInUa.py index aa1785f19..3fb181348 100644 --- a/module/plugins/hoster/FileshareInUa.py +++ b/module/plugins/hoster/FileshareInUa.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class FileshareInUa(DeadHoster): __name__ = "FileshareInUa" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?fileshare\.in\.ua/\w{7}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/FilesonicCom.py b/module/plugins/hoster/FilesonicCom.py index 5254a6f9b..59c0ea246 100644 --- a/module/plugins/hoster/FilesonicCom.py +++ b/module/plugins/hoster/FilesonicCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class FilesonicCom(DeadHoster): __name__ = "FilesonicCom" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.36" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?filesonic\.com/file/\w+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/FileuploadNet.py b/module/plugins/hoster/FileuploadNet.py new file mode 100644 index 000000000..c7f541687 --- /dev/null +++ b/module/plugins/hoster/FileuploadNet.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class FileuploadNet(SimpleHoster): + __name__ = "FileuploadNet" + __type__ = "hoster" + __version__ = "0.03" + __status__ = "testing" + + __pattern__ = r'https?://(?:www\.)?(en\.)?file-upload\.net/download-\d+/.+' + + __description__ = """File-upload.net hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'<title>File-Upload.net - (?P<N>.+?)<' + SIZE_PATTERN = r'</label><span>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'Datei existiert nicht' + + LINK_FREE_PATTERN = r"<a href='(.+?)' title='download' onclick" + + + def setup(self): + self.multiDL = True + self.chunk_limit = 1 + + +getInfo = create_getInfo(FileuploadNet) diff --git a/module/plugins/hoster/FilezyNet.py b/module/plugins/hoster/FilezyNet.py index 9f442c846..249548d13 100644 --- a/module/plugins/hoster/FilezyNet.py +++ b/module/plugins/hoster/FilezyNet.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class FilezyNet(DeadHoster): __name__ = "FilezyNet" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?filezy\.net/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/FiredriveCom.py b/module/plugins/hoster/FiredriveCom.py index 8faee5b52..cc530a3c5 100644 --- a/module/plugins/hoster/FiredriveCom.py +++ b/module/plugins/hoster/FiredriveCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class FiredriveCom(DeadHoster): __name__ = "FiredriveCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(firedrive|putlocker)\.com/(mobile/)?(file|embed)/(?P<ID>\w+)' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py index 689eb3c66..ca2f7f270 100644 --- a/module/plugins/hoster/FlyFilesNet.py +++ b/module/plugins/hoster/FlyFilesNet.py @@ -3,14 +3,14 @@ import re import urllib -from module.network.RequestFactory import getURL from module.plugins.internal.SimpleHoster import SimpleHoster class FlyFilesNet(SimpleHoster): __name__ = "FlyFilesNet" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.11" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?flyfiles\.net/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -31,12 +31,12 @@ class FlyFilesNet(SimpleHoster): url = "http://flyfiles.net" - # get download URL - parsed_url = getURL(url, post={"getDownLink": session}) - self.logDebug("Parsed URL: %s" % parsed_url) + #: Get download URL + parsed_url = self.load(url, post={'getDownLink': session}) + self.log_debug("Parsed URL: %s" % parsed_url) - if parsed_url == '#downlink|' or parsed_url == "#downlink|#": - self.logWarning(_("Could not get the download URL. Please wait 10 minutes")) + if parsed_url == "#downlink|" or parsed_url == "#downlink|#": + self.log_warning(_("Could not get the download URL. Please wait 10 minutes")) self.wait(10 * 60, True) self.retry() diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index 79eb1fb83..e5b309dc1 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FourSharedCom(SimpleHoster): __name__ = "FourSharedCom" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?4shared(\-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|mp3|office|rar|zip|archive|music)/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -35,7 +36,7 @@ class FourSharedCom(SimpleHoster): ID_PATTERN = r'name="d3fid" value="(.*?)"' - def handleFree(self, pyfile): + def handle_free(self, pyfile): m = re.search(self.LINK_BTN_PATTERN, self.html) if m: link = m.group(1) @@ -53,7 +54,7 @@ class FourSharedCom(SimpleHoster): try: m = re.search(self.ID_PATTERN, self.html) res = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1)) - self.logDebug(res) + self.log_debug(res) except Exception: pass diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index d005443d9..4564ee03e 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -2,15 +2,16 @@ import re -from module.plugins.Hoster import Hoster -from module.plugins.internal.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import secondsToMidnight +from module.plugins.internal.Hoster import Hoster +from module.plugins.captcha.ReCaptcha import ReCaptcha +from module.plugins.internal.SimpleHoster import seconds_to_midnight class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" - __version__ = "0.41" + __version__ = "0.43" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?freakshare\.(net|com)/files/\S*?/' @@ -43,25 +44,24 @@ class FreakshareCom(Hoster): self.download(pyfile.url, post=self.req_opts) - check = self.checkDownload({"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!", - "downloadserver": "No Downloadserver. Please try again later!"}) + check = self.check_download({'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!", + 'downloadserver': "No Downloadserver. Please try again later!"}) if check == "bad": self.fail(_("Bad Try")) elif check == "paralell": - self.setWait(300, True) - self.wait() + self.wait(300, True) self.retry() elif check == "empty": self.fail(_("File not downloadable")) elif check == "wrong_captcha": - self.invalidCaptcha() + self.captcha.invalid() self.retry() elif check == "downloadserver": @@ -76,7 +76,7 @@ class FreakshareCom(Hoster): if not self.file_exists(): self.offline() - self.setWait(self.get_waiting_time()) + self.set_wait(self.get_waiting_time()) pyfile.name = self.get_file_name() pyfile.size = self.get_file_size() @@ -87,19 +87,20 @@ class FreakshareCom(Hoster): def download_html(self): - self.load("http://freakshare.com/index.php", {"language": "EN"}) # Set english language in server session + self.load("http://freakshare.com/index.php", {'language': "EN"}) #: Set english language in server session self.html = self.load(self.pyfile.url) def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() if not self.wantReconnect: - self.req_opts = self.get_download_options() # get the Post options for the Request - #file_url = self.pyfile.url - #return file_url + self.req_opts = self.get_download_options() #: Get the Post options for the Request + # file_url = self.pyfile.url + # return file_url else: self.offline() @@ -141,7 +142,7 @@ class FreakshareCom(Hoster): if "Your Traffic is used up for today" in self.html: self.wantReconnect = True - return secondsToMidnight(gmt=2) + return seconds_to_midnight(gmt=2) timestring = re.search('\s*var\s(?:downloadWait|time)\s=\s(\d*)[\d.]*;', self.html) if timestring: @@ -151,7 +152,8 @@ class FreakshareCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() @@ -163,11 +165,11 @@ class FreakshareCom(Hoster): def get_download_options(self): re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>", - self.html).group(0) # get the whole request + self.html).group(0) #: Get the whole request to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope) request_options = dict((n, v) for (v, n) in to_sort) - herewego = self.load(self.pyfile.url, None, request_options) # the actual download-Page + herewego = self.load(self.pyfile.url, None, request_options) #: The actual download-Page to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego) request_options = dict((n, v) for (v, n) in to_sort) diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py index 1cca24c3b..ed7c4bf7f 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -6,10 +6,12 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FreeWayMe(MultiHoster): __name__ = "FreeWayMe" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.19" + __status__ = "testing" - __pattern__ = r'https://(?:www\.)?free-way\.me/.+' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __pattern__ = r'https?://(?:www\.)?free-way\.(bz|me)/.+' + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """FreeWayMe multi-hoster plugin""" __license__ = "GPLv3" @@ -17,36 +19,36 @@ class FreeWayMe(MultiHoster): def setup(self): - self.resumeDownload = False + self.resume_download = False self.multiDL = self.premium - self.chunkLimit = 1 + self.chunk_limit = 1 - def handlePremium(self, pyfile): - user, data = self.account.selectAccount() + def handle_premium(self, pyfile): + user, data = self.account.select() for _i in xrange(5): - # try it five times - header = self.load("https://www.free-way.me/load.php", + #: Try it five times + header = self.load("http://www.free-way.bz/load.php", #@TODO: Revert to `https` in 0.4.10 get={'multiget': 7, 'url' : pyfile.url, 'user' : user, - 'pw' : self.account.getAccountData(user)['password'], + 'pw' : self.account.get_info(self.user)['login']['password'], 'json' : ""}, just_header=True) if 'location' in header: headers = self.load(header['location'], just_header=True) if headers['code'] == 500: - # error on 2nd stage - self.logError(_("Error [stage2]")) + #: Error on 2nd stage + self.log_error(_("Error [stage2]")) else: - # seems to work.. + #: Seems to work.. self.download(header['location']) break else: - # error page first stage - self.logError(_("Error [stage1]")) + #: Error page first stage + self.log_error(_("Error [stage1]")) #@TODO: handle errors diff --git a/module/plugins/hoster/FreevideoCz.py b/module/plugins/hoster/FreevideoCz.py index 49f02a28b..ec8734b6a 100644 --- a/module/plugins/hoster/FreevideoCz.py +++ b/module/plugins/hoster/FreevideoCz.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class FreevideoCz(DeadHoster): __name__ = "FreevideoCz" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.31" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?freevideo\.cz/vase-videa/.+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 50128db10..a5aac222c 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -4,27 +4,27 @@ import re import time import urlparse -from module.network.RequestFactory import getURL -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo +from module.network.RequestFactory import getURL as get_url +from module.plugins.internal.SimpleHoster import SimpleHoster, parse_fileInfo -def getInfo(urls): +def get_info(urls): for url in urls: - html = getURL("http://www.fshare.vn/check_link.php", - post={'action': "check_link", 'arrlinks': url}, - decode=True) + html = get_url("http://www.fshare.vn/check_link.php", + post={'action': "check_link", 'arrlinks': url}) - yield parseFileInfo(FshareVn, url, html) + yield parse_fileInfo(FshareVn, url, html) -def doubleDecode(m): +def double_decode(m): return m.group(1).decode('raw_unicode_escape') class FshareVn(SimpleHoster): __name__ = "FshareVn" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -45,31 +45,27 @@ class FshareVn(SimpleHoster): def preload(self): self.html = self.load("http://www.fshare.vn/check_link.php", - post={'action': "check_link", 'arrlinks': pyfile.url}, - decode=True) + post={'action': "check_link", 'arrlinks': pyfile.url}) - if isinstance(self.TEXT_ENCODING, basestring): - self.html = unicode(self.html, self.TEXT_ENCODING) + def handle_free(self, pyfile): + self.html = self.load(pyfile.url) - def handleFree(self, pyfile): - self.html = self.load(pyfile.url, decode=True) + self.check_errors() - self.checkErrors() - - action, inputs = self.parseHtmlForm('frm_download') + action, inputs = self.parse_html_form('frm_download') url = urlparse.urljoin(pyfile.url, action) if not inputs: self.error(_("No FORM")) elif 'link_file_pwd_dl' in inputs: - password = self.getPassword() + password = self.get_password() if password: - self.logInfo(_("Password protected link, trying ") + password) + self.log_info(_("Password protected link, trying ") + password) inputs['link_file_pwd_dl'] = password - self.html = self.load(url, post=inputs, decode=True) + self.html = self.load(url, post=inputs) if 'name="link_file_pwd_dl"' in self.html: self.fail(_("Incorrect password")) @@ -77,12 +73,12 @@ class FshareVn(SimpleHoster): self.fail(_("No password found")) else: - self.html = self.load(url, post=inputs, decode=True) + self.html = self.load(url, post=inputs) - self.checkErrors() + self.check_errors() m = re.search(r'var count = (\d+)', self.html) - self.setWait(int(m.group(1)) if m else 30) + self.set_wait(int(m.group(1)) if m else 30) m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: @@ -92,19 +88,19 @@ class FshareVn(SimpleHoster): self.wait() - def checkErrors(self): + def check_errors(self): if '/error.php?' in self.req.lastEffectiveURL or u"Liên kết bạn chá»n khÃŽng tá»n" in self.html: self.offline() m = re.search(self.WAIT_PATTERN, self.html) if m: - self.logInfo(_("Wait until %s ICT") % m.group(1)) + 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) self.retry() elif '<ul class="message-error">' in self.html: msg = "Unknown error occured or wait time not parsed" - self.logError(msg) + self.log_error(msg) self.retry(30, 2 * 60, msg) self.info.pop('error', None) diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 295955cbe..25eb44604 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -5,13 +5,14 @@ import re import urllib import urlparse -from module.plugins.Hoster import Hoster +from module.plugins.internal.Hoster import Hoster class Ftp(Hoster): __name__ = "Ftp" __type__ = "hoster" - __version__ = "0.52" + __version__ = "0.54" + __status__ = "testing" __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' @@ -23,8 +24,8 @@ class Ftp(Hoster): def setup(self): - self.chunkLimit = -1 - self.resumeDownload = True + self.chunk_limit = -1 + self.resume_download = True def process(self, pyfile): @@ -41,10 +42,10 @@ class Ftp(Hoster): servers = [x['login'] for x in self.account.getAllAccounts()] if self.account else [] if netloc in servers: - self.logDebug("Logging on to %s" % netloc) - self.req.addAuth(self.account.getAccountInfo(netloc)['password']) + self.log_debug("Logging on to %s" % netloc) + self.req.addAuth(self.account.get_info(netloc)['login']['password']) else: - pwd = self.getPassword() + pwd = self.get_password() if ':' in pwd: self.req.addAuth(pwd) @@ -56,22 +57,22 @@ class Ftp(Hoster): self.fail(_("Error %d: %s") % e.args) self.req.http.c.setopt(pycurl.NOBODY, 0) - self.logDebug(self.req.http.header) + self.log_debug(self.req.http.header) m = re.search(r"Content-Length:\s*(\d+)", res) if m: pyfile.size = int(m.group(1)) self.download(pyfile.url) else: - #Naive ftp directory listing + #: 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 + self.req.http.c.setopt(48, 1) #: CURLOPT_DIRLISTONLY res = self.load(pyfile.url, decode=False) - links = [pyfile.url + urllib.quote(x) for x in res.splitlines()] - self.logDebug("LINKS", links) - self.core.api.addPackage(pkgname, links) + 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/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index c68866f87..fb3b98f5e 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -1,90 +1,37 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster -from module.utils import parseFileSize - -class GamefrontCom(Hoster): +class GamefrontCom(SimpleHoster): __name__ = "GamefrontCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.09" + __status__ = "testing" - __pattern__ = r'http://(?:www\.)?gamefront\.com/files/\w+' + __pattern__ = r'http://(?:www\.)?gamefront\.com/files/(?P<ID>\d+)' __description__ = """Gamefront.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("fwannmacher", "felipe@warhammerproject.com")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + NAME_PATTERN = r'<title>(?P<N>.+?) \| Game Front</title>' + SIZE_PATTERN = r'>File Size:</dt>\s*<dd>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'<p>File not found' - PATTERN_FILENAME = r'<title>(.*?) | Game Front' - PATTERN_FILESIZE = r'<dt>File Size:</dt>[\n\s]*<dd>(.*?)</dd>' - PATTERN_OFFLINE = r'This file doesn\'t exist, or has been removed.' + LINK_FREE_PATTERN = r"downloadUrl = '(.+?)'" def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - self.chunkLimit = -1 - - - def process(self, pyfile): - self.pyfile = pyfile - self.html = self.load(pyfile.url, decode=True) - - if not self._checkOnline(): - self.offline() - - pyfile.name = self._getName() - - link = self._getLink() - - if not link.startswith('http://'): - link = "http://www.gamefront.com/" + link - - self.download(link) - - - def _checkOnline(self): - if re.search(self.PATTERN_OFFLINE, self.html): - return False - else: - return True - - - def _getName(self): - name = re.search(self.PATTERN_FILENAME, self.html) - if name is None: - self.fail(_("Plugin broken") - - return name.group(1) - - - def _getLink(self): - self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=\w+)", - self.html).group(1)) - return re.search("<a href=\"(http://media\d+\.gamefront.com/.*)\">click here</a>", self.html2).group(1).replace("&", "&") - - -def getInfo(urls): - result = [] - for url in urls: - html = getURL(url) - if re.search(GamefrontCom.PATTERN_OFFLINE, html): - result.append((url, 0, 1, url)) - else: - name = re.search(GamefrontCom.PATTERN_FILENAME, html) - if name is None: - result.append((url, 0, 1, url)) - else: - name = name.group(1) - size = re.search(GamefrontCom.PATTERN_FILESIZE, html) - size = parseFileSize(size.group(1)) + def handle_free(self, pyfile): + self.html = self.load("http://www.gamefront.com/files/service/thankyou", + get={'id': self.info['pattern']['ID']}) + return super(GamefrontCom, self).handle_free(pyfile) - result.append((name, size, 3, url)) - yield result +getInfo = create_getInfo(GamefrontCom) diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index c2feeb6f8..381c39a21 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -10,7 +10,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class GigapetaCom(SimpleHoster): __name__ = "GigapetaCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?gigapeta\.com/dl/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -29,27 +30,27 @@ class GigapetaCom(SimpleHoster): COOKIES = [("gigapeta.com", "lang", "us")] - def handleFree(self, pyfile): + def handle_free(self, pyfile): captcha_key = str(random.randint(1, 100000000)) captcha_url = "http://gigapeta.com/img/captcha.gif?x=%s" % captcha_key self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) for _i in xrange(5): - self.checkErrors() + self.check_errors() - captcha = self.decryptCaptcha(captcha_url) + captcha = self.captcha.decrypt(captcha_url) self.html = self.load(pyfile.url, post={ - "captcha_key": captcha_key, - "captcha": captcha, - "download": "Download"}) + '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.invalidCaptcha() + self.captcha.invalid() else: self.fail(_("No valid captcha code entered")) diff --git a/module/plugins/hoster/GooIm.py b/module/plugins/hoster/GooIm.py index 4b27e6cc8..2c2f4aa9e 100644 --- a/module/plugins/hoster/GooIm.py +++ b/module/plugins/hoster/GooIm.py @@ -11,7 +11,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class GooIm(SimpleHoster): __name__ = "GooIm" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?goo\.im/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -26,11 +27,11 @@ class GooIm(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - def handleFree(self, pyfile): + def handle_free(self, pyfile): self.wait(10) self.link = pyfile.url diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 1c33a1e4e..903b5361e 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -13,7 +13,8 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.14" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(drive|docs)\.google\.com/(file/d/\w+|uc\?.*id=)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -23,8 +24,6 @@ class GoogledriveCom(SimpleHoster): __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - DISPOSITION = False #: Remove in 0.4.10 - NAME_PATTERN = r'(?:<title>|class="uc-name-size".*>)(?P<N>.+?)(?: - Google Drive</title>|</a> \()' OFFLINE_PATTERN = r'align="center"><p class="errorMessage"' @@ -33,11 +32,11 @@ class GoogledriveCom(SimpleHoster): def setup(self): self.multiDL = True - self.resumeDownload = True - self.chunkLimit = 1 + self.resume_download = True + self.chunk_limit = 1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): for _i in xrange(2): m = re.search(self.LINK_FREE_PATTERN, self.html) @@ -49,9 +48,9 @@ class GoogledriveCom(SimpleHoster): if not urlparse.urlparse(link).scheme: link = urlparse.urljoin("https://docs.google.com/", link) - direct_link = self.directLink(link, False) + direct_link = self.direct_link(link, False) if not direct_link: - self.html = self.load(link, decode=True) + self.html = self.load(link) else: self.link = direct_link break diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index ac0043b37..eab819ad9 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class HellshareCz(SimpleHoster): __name__ = "HellshareCz" __type__ = "hoster" - __version__ = "0.85" + __version__ = "0.86" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -29,8 +30,8 @@ class HellshareCz(SimpleHoster): def setup(self): - self.resumeDownload = self.multiDL = bool(self.account) - self.chunkLimit = 1 + self.resume_download = self.multiDL = bool(self.account) + self.chunk_limit = 1 getInfo = create_getInfo(HellshareCz) diff --git a/module/plugins/hoster/HellspyCz.py b/module/plugins/hoster/HellspyCz.py index 9b10760bd..499a94413 100644 --- a/module/plugins/hoster/HellspyCz.py +++ b/module/plugins/hoster/HellspyCz.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class HellspyCz(DeadHoster): __name__ = "HellspyCz" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.29" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?(?:hellspy\.(?:cz|com|sk|hu|pl)|sciagaj\.pl)(/\S+/\d+)' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/HighWayMe.py b/module/plugins/hoster/HighWayMe.py new file mode 100644 index 000000000..119ddb70e --- /dev/null +++ b/module/plugins/hoster/HighWayMe.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.plugins.internal.SimpleHoster import seconds_to_midnight + + +class HighWayMe(MultiHoster): + __name__ = "HighWayMe" + __type__ = "hoster" + __version__ = "0.13" + __status__ = "testing" + + __pattern__ = r'https?://.+high-way\.my' + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] + + __description__ = """High-Way.me multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("EvolutionClip", "evolutionclip@live.de")] + + + def setup(self): + self.chunk_limit = 4 + + + 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.retry() + + elif "<code>9</code>" in self.html: + self.offline() + + elif "downloadlimit" in self.html: + self.log_warning(_("Reached maximum connctions")) + self.retry(5, 60, _("Reached maximum connctions")) + + 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") + + elif "<code>8</code>" in self.html: + self.log_warning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) + self.retry(5, 60, _("Hoster is temporarily unavailable")) + + + def handle_premium(self, pyfile): + for _i in xrange(5): + self.html = self.load("https://high-way.me/load.php", + get={'link': self.pyfile.url}) + + if self.html: + self.log_debug("JSON data: " + self.html) + break + else: + self.log_info(_("Unable to get API data, waiting 1 minute and retry")) + self.retry(5, 60, _("Unable to get API data")) + + self.check_errors() + + try: + self.pyfile.name = re.search(r'<name>([^<]+)</name>', self.html).group(1) + + except AttributeError: + self.pyfile.name = "" + + try: + self.pyfile.size = re.search(r'<size>(\d+)</size>', self.html).group(1) + + except AttributeError: + self.pyfile.size = 0 + + self.link = re.search(r'<download>([^<]+)</download>', self.html).group(1) + + +getInfo = create_getInfo(HighWayMe) diff --git a/module/plugins/hoster/HostujeNet.py b/module/plugins/hoster/HostujeNet.py index ec91e50b9..4dbf550b3 100644 --- a/module/plugins/hoster/HostujeNet.py +++ b/module/plugins/hoster/HostujeNet.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class HostujeNet(SimpleHoster): __name__ = "HostujeNet" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?hostuje\.net/\w+' @@ -24,10 +25,10 @@ class HostujeNet(SimpleHoster): def setup(self): self.multiDL = True - self.chunkLimit = 1 + self.chunk_limit = 1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): m = re.search(r'<script src="([\w^_]+.php)"></script>', self.html) if m: jscript = self.load("http://hostuje.net/" + m.group(1)) @@ -39,7 +40,7 @@ class HostujeNet(SimpleHoster): else: self.error(_("script not found")) - action, inputs = self.parseHtmlForm(pyfile.url.replace(".", "\.").replace( "?", "\?")) + action, inputs = self.parse_html_form(pyfile.url.replace(".", "\.").replace( "?", "\?")) if not action: self.error(_("form not found")) diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py index 082415c6b..032bd350e 100644 --- a/module/plugins/hoster/HotfileCom.py +++ b/module/plugins/hoster/HotfileCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class HotfileCom(DeadHoster): __name__ = "HotfileCom" __type__ = "hoster" - __version__ = "0.37" + __version__ = "0.38" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?hotfile\.com/dl/\d+/\w+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/HugefilesNet.py b/module/plugins/hoster/HugefilesNet.py index 3fdcca1ba..582d17756 100644 --- a/module/plugins/hoster/HugefilesNet.py +++ b/module/plugins/hoster/HugefilesNet.py @@ -8,7 +8,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class HugefilesNet(XFSHoster): __name__ = "HugefilesNet" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?hugefiles\.net/\w{12}' diff --git a/module/plugins/hoster/HundredEightyUploadCom.py b/module/plugins/hoster/HundredEightyUploadCom.py index 2a35a008f..9b3550922 100644 --- a/module/plugins/hoster/HundredEightyUploadCom.py +++ b/module/plugins/hoster/HundredEightyUploadCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class HundredEightyUploadCom(XFSHoster): __name__ = "HundredEightyUploadCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?180upload\.com/\w{12}' diff --git a/module/plugins/hoster/IFileWs.py b/module/plugins/hoster/IFileWs.py index ff263d43a..2444846d7 100644 --- a/module/plugins/hoster/IFileWs.py +++ b/module/plugins/hoster/IFileWs.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class IFileWs(DeadHoster): __name__ = "IFileWs" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?ifile\.ws/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/IcyFilesCom.py b/module/plugins/hoster/IcyFilesCom.py index f81381c66..975e6bfc0 100644 --- a/module/plugins/hoster/IcyFilesCom.py +++ b/module/plugins/hoster/IcyFilesCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class IcyFilesCom(DeadHoster): __name__ = "IcyFilesCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?icyfiles\.com/(.+)' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py index ef267b505..a0c435762 100644 --- a/module/plugins/hoster/IfileIt.py +++ b/module/plugins/hoster/IfileIt.py @@ -6,12 +6,13 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class IfileIt(DeadHoster): __name__ = "IfileIt" __type__ = "hoster" - __version__ = "0.29" + __version__ = "0.30" + __status__ = "testing" __pattern__ = r'^unmatchable$' __config__ = [] #@TODO: Remove in 0.4.10 - __description__ = """Ifile.it""" + __description__ = """Ifile.it hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index 0f09731e4..85d03489d 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class IfolderRu(SimpleHoster): __name__ = "IfolderRu" __type__ = "hoster" - __version__ = "0.39" + __version__ = "0.40" + __status__ = "testing" __pattern__ = r'http://(?:www)?(files\.)?(ifolder\.ru|metalarea\.org|rusfolder\.(com|net|ru))/(files/)?(?P<ID>\d+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -34,27 +35,27 @@ class IfolderRu(SimpleHoster): def setup(self): - self.resumeDownload = self.multiDL = bool(self.account) - self.chunkLimit = 1 + self.resume_download = self.multiDL = bool(self.account) + self.chunk_limit = 1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): url = "http://rusfolder.com/%s" % self.info['pattern']['ID'] - self.html = self.load("http://rusfolder.com/%s" % self.info['pattern']['ID'], decode=True) - self.getFileInfo() + self.html = self.load("http://rusfolder.com/%s" % self.info['pattern']['ID']) + 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.parseHtmlForm('id="download-step-one-form"') - inputs['confirmed_number'] = self.decryptCaptcha(captcha_url, cookies=True) + 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.logDebug(inputs) + self.log_debug(inputs) - self.html = self.load(url, decode=True, post=inputs) + self.html = self.load(url, post=inputs) if self.WRONG_CAPTCHA_PATTERN in self.html: - self.invalidCaptcha() + self.captcha.invalid() else: break else: diff --git a/module/plugins/hoster/JumbofilesCom.py b/module/plugins/hoster/JumbofilesCom.py index a9bf14c6d..e9c084c95 100644 --- a/module/plugins/hoster/JumbofilesCom.py +++ b/module/plugins/hoster/JumbofilesCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class JumbofilesCom(SimpleHoster): __name__ = "JumbofilesCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?jumbofiles\.com/(?P<ID>\w{12})' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -24,13 +25,13 @@ class JumbofilesCom(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - def handleFree(self, pyfile): - post_data = {"id": self.info['pattern']['ID'], "op": "download3", "rand": ""} - html = self.load(self.pyfile.url, post=post_data, decode=True) + def handle_free(self, pyfile): + post_data = {'id': self.info['pattern']['ID'], 'op': "download3", 'rand': ""} + html = self.load(self.pyfile.url, post=post_data) self.link = re.search(self.LINK_FREE_PATTERN, html).group(1) diff --git a/module/plugins/hoster/JunocloudMe.py b/module/plugins/hoster/JunocloudMe.py index 415d5e2d0..4483ccd5d 100644 --- a/module/plugins/hoster/JunocloudMe.py +++ b/module/plugins/hoster/JunocloudMe.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class JunocloudMe(XFSHoster): __name__ = "JunocloudMe" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'http://(?:\w+\.)?junocloud\.me/\w{12}' diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index fb94d12c4..bf4b157cb 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -3,14 +3,15 @@ import re import urlparse -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2ShareCc(SimpleHoster): __name__ = "Keep2ShareCc" __type__ = "hoster" - __version__ = "0.22" + __version__ = "0.24" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -23,7 +24,7 @@ class Keep2ShareCc(SimpleHoster): URL_REPLACEMENTS = [(__pattern__ + ".*", "http://keep2s.cc/file/\g<ID>")] - NAME_PATTERN = r'File: <span>(?P<N>.+)</span>' + NAME_PATTERN = r'File: <span>(?P<N>.+?)</span>' SIZE_PATTERN = r'Size: (?P<S>[^<]+)</div>' OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' @@ -39,7 +40,7 @@ class Keep2ShareCc(SimpleHoster): ERROR_PATTERN = r'>\s*(Free user can\'t download large files|You no can access to this file|This download available only for premium users|This is private file)' - def checkErrors(self): + def check_errors(self): m = re.search(self.TEMP_ERROR_PATTERN, self.html) if m: self.info['error'] = m.group(1) @@ -53,9 +54,9 @@ class Keep2ShareCc(SimpleHoster): m = re.search(self.WAIT_PATTERN, self.html) if m: - self.logDebug("Hoster told us to wait for %s" % m.group(1)) + self.log_debug("Hoster told us to wait for %s" % m.group(1)) - # string to time convert courtesy of https://stackoverflow.com/questions/10663720 + #: String to time convert courtesy of https://stackoverflow.com/questions/10663720 ftr = [3600, 60, 1] wait_time = sum(a * b for a, b in zip(ftr, map(int, m.group(1).split(':')))) @@ -65,18 +66,18 @@ class Keep2ShareCc(SimpleHoster): self.info.pop('error', None) - def handleFree(self, pyfile): + def handle_free(self, pyfile): self.fid = re.search(r'<input type="hidden" name="slow_id" value="(.+?)">', self.html).group(1) self.html = self.load(pyfile.url, post={'yt0': '', 'slow_id': self.fid}) - # self.logDebug(self.fid) - # self.logDebug(pyfile.url) + # self.log_debug(self.fid) + # self.log_debug(pyfile.url) - self.checkErrors() + self.check_errors() m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.handleCaptcha() + self.handle_captcha() self.wait(31) self.html = self.load(pyfile.url) @@ -87,20 +88,20 @@ class Keep2ShareCc(SimpleHoster): self.link = m.group(1) - def handleCaptcha(self): + def handle_captcha(self): post_data = {'free' : 1, 'freeDownloadRequest': 1, 'uniqueId' : self.fid, 'yt0' : ''} m = re.search(r'id="(captcha\-form)"', self.html) - self.logDebug("captcha-form found %s" % m) + self.log_debug("captcha-form found %s" % m) m = re.search(self.CAPTCHA_PATTERN, self.html) - self.logDebug("CAPTCHA_PATTERN found %s" % m) + self.log_debug("CAPTCHA_PATTERN found %s" % m) if m: captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1)) - post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url) + post_data['CaptchaForm[code]'] = self.captcha.decrypt(captcha_url) else: recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() @@ -110,9 +111,9 @@ class Keep2ShareCc(SimpleHoster): self.html = self.load(self.pyfile.url, post=post_data) if 'verification code is incorrect' not in self.html: - self.correctCaptcha() + self.captcha.correct() else: - self.invalidCaptcha() + self.captcha.invalid() getInfo = create_getInfo(Keep2ShareCc) diff --git a/module/plugins/hoster/KickloadCom.py b/module/plugins/hoster/KickloadCom.py index 7690c85c8..2b23b1616 100644 --- a/module/plugins/hoster/KickloadCom.py +++ b/module/plugins/hoster/KickloadCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class KickloadCom(DeadHoster): __name__ = "KickloadCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?kickload\.com/get/.+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py index 42547d658..98f74ad0d 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -2,14 +2,15 @@ import re -from module.plugins.internal.SolveMedia import SolveMedia +from module.plugins.captcha.SolveMedia import SolveMedia from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class KingfilesNet(SimpleHoster): __name__ = "KingfilesNet" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?kingfiles\.net/(?P<ID>\w{12})' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -31,12 +32,12 @@ class KingfilesNet(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - def handleFree(self, pyfile): - # Click the free user button + def handle_free(self, pyfile): + #: Click the free user button post_data = {'op' : "download1", 'usr_login' : "", 'id' : self.info['pattern']['ID'], @@ -44,18 +45,18 @@ class KingfilesNet(SimpleHoster): 'referer' : "", 'method_free': "+"} - self.html = self.load(pyfile.url, post=post_data, decode=True) + self.html = self.load(pyfile.url, post=post_data) solvemedia = SolveMedia(self) response, challenge = solvemedia.challenge() - # Make the downloadlink appear and load the file + #: Make the downloadlink appear and load the file m = re.search(self.RAND_ID_PATTERN, self.html) if m is None: self.error(_("Random key not found")) rand = m.group(1) - self.logDebug("rand = ", rand) + self.log_debug("rand = ", rand) post_data = {'op' : "download2", 'id' : self.info['pattern']['ID'], @@ -67,7 +68,7 @@ class KingfilesNet(SimpleHoster): 'adcopy_challenge': challenge, 'down_direct' : "1"} - self.html = self.load(pyfile.url, post=post_data, decode=True) + self.html = self.load(pyfile.url, post=post_data) m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: diff --git a/module/plugins/hoster/LemUploadsCom.py b/module/plugins/hoster/LemUploadsCom.py index 098867c8b..1f4f96a1f 100644 --- a/module/plugins/hoster/LemUploadsCom.py +++ b/module/plugins/hoster/LemUploadsCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class LemUploadsCom(DeadHoster): __name__ = "LemUploadsCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?lemuploads\.com/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 62afb6c7c..e93b60460 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -10,22 +10,22 @@ import re import urlparse from module.common.json_layer import json_loads, json_dumps -from module.network.RequestFactory import getURL -from module.plugins.internal.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, secondsToMidnight +from module.network.RequestFactory import getURL as get_url +from module.plugins.captcha.ReCaptcha import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, seconds_to_midnight def api_response(url): - json_data = ["yw7XQy2v9", ["download/info", {"link": url}]] - api_rep = getURL("http://api.letitbit.net/json", - post={'r': json_dumps(json_data)}) + json_data = ["yw7XQy2v9", ["download/info", {'link': url}]] + api_rep = get_url("http://api.letitbit.net/json", + post={'r': json_dumps(json_data)}) return json_loads(api_rep) -def getInfo(urls): +def get_info(urls): for url in urls: api_rep = api_response(url) - if api_rep['status'] == 'OK': + if api_rep['status'] == "OK": info = api_rep['data'][0] yield (info['name'], info['size'], 2, url) else: @@ -35,7 +35,8 @@ def getInfo(urls): class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -53,16 +54,16 @@ class LetitbitNet(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True - def handleFree(self, pyfile): - action, inputs = self.parseHtmlForm('id="ifree_form"') + def handle_free(self, pyfile): + action, inputs = self.parse_html_form('id="ifree_form"') if not action: self.error(_("ifree_form")) pyfile.size = float(inputs['sssize']) - self.logDebug(action, inputs) + self.log_debug(action, inputs) inputs['desc'] = "" self.html = self.load(urlparse.urljoin("http://letitbit.net/", action), post=inputs) @@ -70,12 +71,12 @@ class LetitbitNet(SimpleHoster): m = re.search(self.SECONDS_PATTERN, self.html) seconds = int(m.group(1)) if m else 60 - self.logDebug("Seconds found", seconds) + self.log_debug("Seconds found", seconds) m = re.search(self.CAPTCHA_CONTROL_FIELD, self.html) recaptcha_control_field = m.group(1) - self.logDebug("ReCaptcha control field found", recaptcha_control_field) + self.log_debug("ReCaptcha control field found", recaptcha_control_field) self.wait(seconds) @@ -83,30 +84,30 @@ class LetitbitNet(SimpleHoster): if res != '1': self.error(_("Unknown response - ajax_check_url")) - self.logDebug(res) + self.log_debug(res) recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() - post_data = {"recaptcha_challenge_field": challenge, - "recaptcha_response_field": response, - "recaptcha_control_field": recaptcha_control_field} + post_data = {'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': response, + 'recaptcha_control_field': recaptcha_control_field} - self.logDebug("Post data to send", post_data) + self.log_debug("Post data to send", post_data) res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data) - self.logDebug(res) + self.log_debug(res) if not res: - self.invalidCaptcha() + self.captcha.invalid() if res == "error_free_download_blocked": - self.logWarning(_("Daily limit reached")) - self.wait(secondsToMidnight(gmt=2), True) + self.log_warning(_("Daily limit reached")) + self.wait(seconds_to_midnight(gmt=2), True) if res == "error_wrong_captcha": - self.invalidCaptcha() + self.captcha.invalid() self.retry() elif res.startswith('['): @@ -121,16 +122,16 @@ class LetitbitNet(SimpleHoster): self.link = urls[0] - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): api_key = self.user - premium_key = self.account.getAccountData(self.user)['password'] + premium_key = self.account.get_info(self.user)['login']['password'] - json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]] + json_data = [api_key, ["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.logDebug("API Data: " + api_rep) + self.log_debug("API Data: " + api_rep) api_rep = json_loads(api_rep) - if api_rep['status'] == 'FAIL': + if api_rep['status'] == "FAIL": self.fail(api_rep['data']) self.link = api_rep['data'][0][0] diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 9c3af4ae3..1c3f86d4a 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -10,30 +10,29 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class LinksnappyCom(MultiHoster): __name__ = "LinksnappyCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.11" + __status__ = "testing" __pattern__ = r'https?://(?:[^/]+\.)?linksnappy\.com' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Linksnappy.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - SINGLE_CHUNK_HOSTERS = ["easybytez.com"] - - - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): host = self._get_host(pyfile.url) json_params = json_dumps({'link' : pyfile.url, 'type' : host, 'username': self.user, - 'password': self.account.getAccountData(self.user)['password']}) + 'password': self.account.get_info(self.user)['login']['password']}) - r = self.load("http://gen.linksnappy.com/genAPI.php", + r = self.load("http://linksnappy.com/api/linkgen", post={'genLinks': json_params}) - self.logDebug("JSON data: " + r) + self.log_debug("JSON data: " + r) j = json_loads(r)['links'][0] @@ -43,11 +42,6 @@ class LinksnappyCom(MultiHoster): pyfile.name = j['filename'] self.link = j['generated'] - if host in self.SINGLE_CHUNK_HOSTERS: - self.chunkLimit = 1 - else: - self.setup() - @staticmethod def _get_host(url): diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py index d2b25f0db..7a42e0360 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -6,25 +6,26 @@ import re -from module.plugins.internal.SolveMedia import SolveMedia +from module.plugins.captcha.SolveMedia import SolveMedia from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LoadTo(SimpleHoster): __name__ = "LoadTo" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.25" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?load\.to/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """ Load.to hoster plugin """ + __description__ = """Load.to hoster plugin""" __license__ = "GPLv3" __authors__ = [("halfman", "Pulpan3@gmail.com"), ("stickell", "l.stickell@yahoo.it")] - NAME_PATTERN = r'<h1>(?P<N>.+)</h1>' + NAME_PATTERN = r'<h1>(?P<N>.+?)</h1>' SIZE_PATTERN = r'Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>Can\'t find file' @@ -36,23 +37,23 @@ class LoadTo(SimpleHoster): def setup(self): self.multiDL = True - self.chunkLimit = 1 + self.chunk_limit = 1 - def handleFree(self, pyfile): - # Search for Download URL + def handle_free(self, pyfile): + #: Search for Download URL m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("LINK_FREE_PATTERN not found")) self.link = m.group(1) - # Set Timer - may be obsolete + #: Set Timer - may be obsolete m = re.search(self.WAIT_PATTERN, self.html) if m: self.wait(m.group(1)) - # Load.to is using solvemedia captchas since ~july 2014: + #: Load.to is using solvemedia captchas since ~july 2014: solvemedia = SolveMedia(self) captcha_key = solvemedia.detect_key() diff --git a/module/plugins/hoster/LolabitsEs.py b/module/plugins/hoster/LolabitsEs.py index 61df5f0bb..766f9d5b8 100644 --- a/module/plugins/hoster/LolabitsEs.py +++ b/module/plugins/hoster/LolabitsEs.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -* -import HTMLParser import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.utils import html_unescape class LolabitsEs(SimpleHoster): __name__ = "LolabitsEs" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?lolabits\.es/.+' @@ -28,21 +29,22 @@ class LolabitsEs(SimpleHoster): def setup(self): - self.chunkLimit = 1 + self.chunk_limit = 1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): fileid = re.search(self.FILEID_PATTERN, self.html).group(1) - self.logDebug("FileID: " + fileid) + self.log_debug("FileID: " + fileid) token = re.search(self.TOKEN_PATTERN, self.html).group(1) - self.logDebug("Token: " + token) + self.log_debug("Token: " + token) self.html = self.load("http://lolabits.es/action/License/Download", post={'fileId' : fileid, - '__RequestVerificationToken' : token}).decode('unicode-escape') + '__RequestVerificationToken' : token}, + decode="unicode-escape") - self.link = HTMLParser.HTMLParser().unescape(re.search(self.LINK_PATTERN, self.html).group(1)) + self.link = html_unescape(re.search(self.LINK_PATTERN, self.html).group(1)) getInfo = create_getInfo(LolabitsEs) diff --git a/module/plugins/hoster/LomafileCom.py b/module/plugins/hoster/LomafileCom.py index ef05cd1ea..9e625a1eb 100644 --- a/module/plugins/hoster/LomafileCom.py +++ b/module/plugins/hoster/LomafileCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class LomafileCom(DeadHoster): __name__ = "LomafileCom" __type__ = "hoster" - __version__ = "0.52" + __version__ = "0.53" + __status__ = "testing" __pattern__ = r'http://lomafile\.com/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index f4932d93d..788c1aca8 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -2,16 +2,16 @@ import re -from bottle import json_loads - -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.common.json_layer import json_loads +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LuckyShareNet(SimpleHoster): __name__ = "LuckyShareNet" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?luckyshare\.net/(?P<ID>\d{10,})' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -25,13 +25,13 @@ class LuckyShareNet(SimpleHoster): OFFLINE_PATTERN = r'There is no such file available' - def parseJson(self, rep): + def parse_json(self, rep): if 'AJAX Error' in rep: - html = self.load(self.pyfile.url, decode=True) + html = self.load(self.pyfile.url) m = re.search(r"waitingtime = (\d+);", html) if m: seconds = int(m.group(1)) - self.logDebug("You have to wait %d seconds between free downloads" % seconds) + self.log_debug("You have to wait %d seconds between free downloads" % seconds) self.retry(wait_time=seconds) else: self.error(_("Unable to detect wait time between free downloads")) @@ -40,14 +40,14 @@ class LuckyShareNet(SimpleHoster): return json_loads(rep) - # TODO: There should be a filesize limit for free downloads - # TODO: Some files could not be downloaded in free mode - def handleFree(self, pyfile): - rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + self.info['pattern']['ID'], decode=True) + #@TODO: There should be a filesize limit for free downloads + #: Some files could not be downloaded in free mode + def handle_free(self, pyfile): + rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + self.info['pattern']['ID']) - self.logDebug("JSON: " + rep) + self.log_debug("JSON: " + rep) - json = self.parseJson(rep) + json = self.parse_json(rep) self.wait(json['time']) recaptcha = ReCaptcha(self) @@ -55,14 +55,14 @@ class LuckyShareNet(SimpleHoster): 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']), decode=True) - self.logDebug("JSON: " + rep) + (challenge, response, json['hash'])) + self.log_debug("JSON: " + rep) if 'link' in rep: - json.update(self.parseJson(rep)) - self.correctCaptcha() + json.update(self.parse_json(rep)) + self.captcha.correct() break elif 'Verification failed' in rep: - self.invalidCaptcha() + self.captcha.invalid() else: self.error(_("Unable to get downlaod link")) diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 09eb4705d..3ba191160 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -1,14 +1,15 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.ReCaptcha import ReCaptcha -from module.plugins.internal.SolveMedia import SolveMedia +from module.plugins.captcha.ReCaptcha import ReCaptcha +from module.plugins.captcha.SolveMedia import SolveMedia from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MediafireCom(SimpleHoster): __name__ = "MediafireCom" __type__ = "hoster" - __version__ = "0.89" + __version__ = "0.90" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?mediafire\.com/(file/|view/\??|download(\.php\?|/)|\?)(?P<ID>\w{15})' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -31,11 +32,11 @@ class MediafireCom(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - def handleCaptcha(self): + def handle_captcha(self): solvemedia = SolveMedia(self) captcha_key = solvemedia.detect_key() @@ -43,8 +44,7 @@ class MediafireCom(SimpleHoster): response, challenge = solvemedia.challenge(captcha_key) self.html = self.load("http://www.mediafire.com/?" + self.info['pattern']['ID'], post={'adcopy_challenge': challenge, - 'adcopy_response' : response}, - decode=True) + 'adcopy_response' : response}) return recaptcha = ReCaptcha(self) @@ -53,26 +53,25 @@ class MediafireCom(SimpleHoster): if captcha_key: response, challenge = recaptcha.challenge(captcha_key) self.html = self.load(self.pyfile.url, - post={'g-recaptcha-response': response}, - decode=True) + post={'g-recaptcha-response': response}) - def handleFree(self, pyfile): - self.handleCaptcha() + def handle_free(self, pyfile): + self.handle_captcha() if self.PASSWORD_PATTERN in self.html: - password = self.getPassword() + password = self.get_password() if not password: self.fail(_("No password found")) else: - self.logInfo(_("Password protected link, trying: ") + password) + self.log_info(_("Password protected link, trying: ") + password) self.html = self.load(self.link, post={'downloadp': password}) if self.PASSWORD_PATTERN in self.html: self.fail(_("Incorrect password")) - return super(MediafireCom, self).handleFree(pyfile) + return super(MediafireCom, self).handle_free(pyfile) getInfo = create_getInfo(MediafireCom) diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index aa7755af4..d8a29817c 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -12,7 +12,7 @@ from Crypto.Cipher import AES from Crypto.Util import Counter from module.common.json_layer import json_loads, json_dumps -from module.plugins.Hoster import Hoster +from module.plugins.internal.Hoster import Hoster from module.utils import decode, fs_decode, fs_encode @@ -48,9 +48,10 @@ from module.utils import decode, fs_decode, fs_encode class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.31" + __status__ = "testing" - __pattern__ = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w,-]+)' + __pattern__ = r'(https?://(?:www\.)?mega(\.co)?\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w,-]+)' __description__ = """Mega.co.nz hoster plugin""" __license__ = "GPLv3" @@ -67,8 +68,10 @@ class MegaCoNz(Hoster): return standard_b64decode(data + '=' * (-len(data) % 4)) - def getCipherKey(self, key): - """ Construct the cipher key from the given data """ + def get_cipher_key(self, key): + """ + Construct the cipher key from the given data + """ a = array.array("I", self.b64_decode(key)) k = array.array("I", (a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7])) @@ -79,44 +82,46 @@ class MegaCoNz(Hoster): def api_response(self, **kwargs): - """ Dispatch a call to the api, see https://mega.co.nz/#developers """ - - # generate a session id, no idea where to obtain elsewhere - uid = random.random.randint(10 << 9, 10 ** 10) + """ + Dispatch a call to the api, see https://mega.co.nz/#developers + """ + #: Generate a session id, no idea where to obtain elsewhere + uid = random.randint(10 << 9, 10 ** 10) res = self.load(self.API_URL, get={'id': uid}, post=json_dumps([kwargs])) - self.logDebug("Api Response: " + res) + self.log_debug("Api Response: " + res) return json_loads(res) - def decryptAttr(self, data, key): - k, iv, meta_mac = self.getCipherKey(key) + def decrypt_attr(self, data, key): + k, iv, meta_mac = self.get_cipher_key(key) cbc = AES.new(k, AES.MODE_CBC, "\0" * 16) attr = decode(cbc.decrypt(self.b64_decode(data))) - self.logDebug("Decrypted Attr: %s" % attr) + self.log_debug("Decrypted Attr: %s" % attr) if not attr.startswith("MEGA"): self.fail(_("Decryption failed")) - # Data is padded, 0-bytes must be stripped + #: Data is padded, 0-bytes must be stripped return json_loads(re.search(r'{.+?}', attr).group(0)) - def decryptFile(self, key): - """ Decrypts the file at lastDownload` """ - - # upper 64 bit of counter start + def decrypt_file(self, key): + """ + Decrypts the file at last_download` + """ + #: Upper 64 bit of counter start n = self.b64_decode(key)[16:24] - # convert counter to long and shift bytes - k, iv, meta_mac = self.getCipherKey(key) + #: Convert counter to long and shift bytes + k, iv, meta_mac = self.get_cipher_key(key) ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) cipher = AES.new(k, AES.MODE_CTR, counter=ctr) self.pyfile.setStatus("decrypting") self.pyfile.setProgress(0) - file_crypted = fs_encode(self.lastDownload) + file_crypted = fs_encode(self.last_download) file_decrypted = file_crypted.rsplit(self.FILE_SUFFIX)[0] try: @@ -126,7 +131,7 @@ class MegaCoNz(Hoster): except IOError, e: self.fail(e) - chunk_size = 2 ** 15 # buffer size, 32k + chunk_size = 2 ** 15 #: Buffer size, 32k # file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum chunks = os.path.getsize(file_crypted) / chunk_size + 1 @@ -158,22 +163,22 @@ class MegaCoNz(Hoster): f.close() df.close() - # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac: + # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] is not meta_mac: # os.remove(file_decrypted) # self.fail(_("Checksum mismatch")) os.remove(file_crypted) - self.lastDownload = fs_decode(file_decrypted) + self.last_download = fs_decode(file_decrypted) - def checkError(self, code): + def check_error(self, code): ecode = abs(code) if ecode in (9, 16, 21): self.offline() elif ecode in (3, 13, 17, 18, 19): - self.tempOffline() + self.temp_offline() elif ecode in (1, 4, 6, 10, 15, 21): self.retry(5, 30, _("Error code: [%s]") % -ecode) @@ -186,23 +191,23 @@ class MegaCoNz(Hoster): pattern = re.match(self.__pattern__, pyfile.url).groupdict() id = pattern['ID'] key = pattern['KEY'] - public = pattern['TYPE'] == '' + public = pattern['TYPE'] == "" - self.logDebug("ID: %s" % id, "Key: %s" % key, "Type: %s" % ("public" if public else "node")) + self.log_debug("ID: %s" % id, "Key: %s" % key, "Type: %s" % ("public" if public else "node")) - # g is for requesting a download url - # this is similar to the calls in the mega js app, documentation is very bad + #: G is for requesting a download url + #: This is similar to the calls in the mega js app, documentation is very bad if public: mega = self.api_response(a="g", g=1, p=id, ssl=1)[0] else: mega = self.api_response(a="g", g=1, n=id, ssl=1)[0] if isinstance(mega, int): - self.checkError(mega) + self.check_error(mega) elif "e" in mega: - self.checkError(mega['e']) + self.check_error(mega['e']) - attr = self.decryptAttr(mega['at'], key) + attr = self.decrypt_attr(mega['at'], key) pyfile.name = attr['n'] + self.FILE_SUFFIX pyfile.size = mega['s'] @@ -211,7 +216,7 @@ class MegaCoNz(Hoster): self.download(mega['g']) - self.decryptFile(key) + self.decrypt_file(key) - # Everything is finished and final name can be set + #: Everything is finished and final name can be set pyfile.name = attr['n'] diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 9c8cc2a90..4afba0a3a 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -10,12 +10,14 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class MegaDebridEu(MultiHoster): __name__ = "MegaDebridEu" __type__ = "hoster" - __version__ = "0.47" + __version__ = "0.50" + __status__ = "testing" __pattern__ = r'http://((?:www\d+\.|s\d+\.)?mega-debrid\.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[\w^_]+' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] - __description__ = """mega-debrid.eu multi-hoster plugin""" + __description__ = """Mega-debrid.eu multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] @@ -28,9 +30,9 @@ class MegaDebridEu(MultiHoster): Connexion to the mega-debrid API Return True if succeed """ - user, data = self.account.selectAccount() + user, info = self.account.select() jsonResponse = self.load(self.API_URL, - get={'action': 'connectUser', 'login': user, 'password': data['password']}) + get={'action': 'connectUser', 'login': user, 'password': info['login']['password']}) res = json_loads(jsonResponse) if res['response_code'] == "ok": @@ -40,7 +42,7 @@ class MegaDebridEu(MultiHoster): return False - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): """ Debrid a link Return The debrided link if succeed or original link if fail diff --git a/module/plugins/hoster/MegaFilesSe.py b/module/plugins/hoster/MegaFilesSe.py index 249eff952..03c684751 100644 --- a/module/plugins/hoster/MegaFilesSe.py +++ b/module/plugins/hoster/MegaFilesSe.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class MegaFilesSe(DeadHoster): __name__ = "MegaFilesSe" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?megafiles\.se/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index e17dd4730..13f462585 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -4,25 +4,26 @@ import pycurl import re from module.network.HTTPRequest import BadHeader -from module.network.RequestFactory import getRequest -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo +from module.network.RequestFactory import getRequest as get_request +from module.plugins.internal.SimpleHoster import SimpleHoster, parse_fileInfo -def getInfo(urls): - h = getRequest() +def get_info(urls): + h = get_request() h.c.setopt(pycurl.HTTPHEADER, ["Accept: text/html", "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"]) for url in urls: - html = h.load(url, decode=True) - yield parseFileInfo(MegaRapidCz, url, html) + html = h.load(url) + yield parse_fileInfo(MegaRapidCz, url, html) class MegaRapidCz(SimpleHoster): __name__ = "MegaRapidCz" __type__ = "hoster" - __version__ = "0.56" + __version__ = "0.57" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -48,10 +49,10 @@ class MegaRapidCz(SimpleHoster): def setup(self): - self.chunkLimit = 1 + self.chunk_limit = 1 - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): m = re.search(self.LINK_PREMIUM_PATTERN, self.html) if m: self.link = m.group(1) diff --git a/module/plugins/hoster/MegaRapidoNet.py b/module/plugins/hoster/MegaRapidoNet.py index a3b4c72ba..6676a565d 100644 --- a/module/plugins/hoster/MegaRapidoNet.py +++ b/module/plugins/hoster/MegaRapidoNet.py @@ -5,10 +5,10 @@ import random from module.plugins.internal.MultiHoster import MultiHoster -def random_with_N_digits(n): +def random_with_n_digits(n): rand = "0." not_zero = 0 - for i in range(1, n + 1): + for i in xrange(1, n + 1): r = random.randint(0, 9) if(r > 0): not_zero += 1 @@ -23,10 +23,12 @@ def random_with_N_digits(n): class MegaRapidoNet(MultiHoster): __name__ = "MegaRapidoNet" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?\w+\.megarapido\.net/\?file=\w+' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """MegaRapido.net multi-hoster plugin""" __license__ = "GPLv3" @@ -38,17 +40,17 @@ class MegaRapidoNet(MultiHoster): ERROR_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?["\']?alert-message error.*?>([^<]*)' - def handlePremium(self, pyfile): + 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.getAccountInfo(self.user).get('sid', None), + 'user' : self.account.get_data(self.user).get('sid', None), 'autoreset': ""}) if "desloga e loga novamente para gerar seus links" in self.html.lower(): self.error("You have logged in at another place") - return super(MegaRapidoNet, self).handlePremium(pyfile) + return super(MegaRapidoNet, self).handle_premium(pyfile) diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index 10a2eb025..a67dca5da 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -10,7 +10,8 @@ from module.plugins.hoster.MegaCoNz import MegaCoNz class MegacrypterCom(MegaCoNz): __name__ = "MegacrypterCom" __type__ = "hoster" - __version__ = "0.22" + __version__ = "0.23" + __status__ = "testing" __pattern__ = r'https?://\w{0,10}\.?megacrypter\.com/[\w!-]+' @@ -24,26 +25,28 @@ class MegacrypterCom(MegaCoNz): def api_response(self, **kwargs): - """ Dispatch a call to the api, see megacrypter.com/api_doc """ - self.logDebug("JSON request: " + json_dumps(kwargs)) + """ + Dispatch a call to the api, see megacrypter.com/api_doc + """ + self.log_debug("JSON request: " + json_dumps(kwargs)) res = self.load(self.API_URL, post=json_dumps(kwargs)) - self.logDebug("API Response: " + res) + self.log_debug("API Response: " + res) return json_loads(res) def process(self, pyfile): - # match is guaranteed because plugin was chosen to handle url + #: Match is guaranteed because plugin was chosen to handle url node = re.match(self.__pattern__, pyfile.url).group(0) - # get Mega.co.nz link info + #: get Mega.co.nz link info info = self.api_response(link=node, m="info") - # get crypted file URL + #: Get crypted file URL dl = self.api_response(link=node, m="dl") - # TODO: map error codes, implement password protection + #@TODO: map error codes, implement password protection # if info['pass'] is True: - # crypted_file_key, md5_file_key = info['key'].split("#") + # crypted_file_key, md5_file_key = info['key'].split("#") key = self.b64_decode(info['key']) @@ -51,7 +54,7 @@ class MegacrypterCom(MegaCoNz): self.download(dl['url']) - self.decryptFile(key) + self.decrypt_file(key) - # Everything is finished and final name can be set + #: Everything is finished and final name can be set pyfile.name = info['name'] diff --git a/module/plugins/hoster/MegareleaseOrg.py b/module/plugins/hoster/MegareleaseOrg.py index 6349144ec..ab9a864c9 100644 --- a/module/plugins/hoster/MegareleaseOrg.py +++ b/module/plugins/hoster/MegareleaseOrg.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class MegareleaseOrg(DeadHoster): __name__ = "MegareleaseOrg" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?megarelease\.org/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index ed2363fe3..b6692263f 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -9,7 +9,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.29" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -35,15 +36,15 @@ class MegasharesCom(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = self.premium - def handlePremium(self, pyfile): - self.handleDownload(True) + def handle_premium(self, pyfile): + self.handle_download(True) - def handleFree(self, pyfile): + def handle_free(self, pyfile): if self.NO_SLOTS_PATTERN in self.html: self.retry(wait_time=5 * 60) @@ -55,10 +56,10 @@ class MegasharesCom(SimpleHoster): for _i in xrange(5): random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1) - verifyinput = self.decryptCaptcha("http://d01.megashares.com/index.php", + verifyinput = self.captcha.decrypt("http://d01.megashares.com/index.php", get={'secgfx': "gfx", 'random_num': random_num}) - self.logInfo(_("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", @@ -69,10 +70,10 @@ class MegasharesCom(SimpleHoster): 'rsrnd[]' : str(int(time.time() * 1000))}) if 'Thank you for reactivating your passport.' in res: - self.correctCaptcha() + self.captcha.correct() self.retry() else: - self.invalidCaptcha() + self.captcha.invalid() else: self.fail(_("Failed to reactivate passport")) @@ -80,33 +81,33 @@ class MegasharesCom(SimpleHoster): if m: time = [int(x) for x in m.groups()] renew = time[0] + (time[1] * 60) + (time[2] * 60) - self.logDebug("Waiting %d seconds for a new passport" % renew) + self.log_debug("Waiting %d seconds for a new passport" % renew) self.retry(wait_time=renew, reason=_("Passport renewal")) - # Check traffic left on passport + #: Check traffic left on passport m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S) if m is None: self.fail(_("Passport not found")) - self.logInfo(_("Download passport: %s") % m.group(1)) + self.log_info(_("Download passport: %s") % m.group(1)) data_left = float(m.group(2)) * 1024 ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] - self.logInfo(_("Data left: %s %s (%d MB needed)") % (m.group(2), m.group(3), self.pyfile.size / 1048576)) + 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.handleDownload(False) + self.handle_download(False) - def handleDownload(self, premium=False): - # Find download link; + 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: self.error(msg) self.link = m.group(1) - self.logDebug("%s: %s" % (msg, self.link)) + self.log_debug("%s: %s" % (msg, self.link)) getInfo = create_getInfo(MegasharesCom) diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index 590819f7f..468734c35 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class MegauploadCom(DeadHoster): __name__ = "MegauploadCom" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?megaupload\.com/\?.*&?(d|v)=\w+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/MegavideoCom.py b/module/plugins/hoster/MegavideoCom.py index accd079fc..a3339a932 100644 --- a/module/plugins/hoster/MegavideoCom.py +++ b/module/plugins/hoster/MegavideoCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class MegavideoCom(DeadHoster): __name__ = "MegavideoCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?megavideo\.com/\?.*&?(d|v)=\w+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/MovReelCom.py b/module/plugins/hoster/MovReelCom.py index 2fe5184ae..dd70ce009 100644 --- a/module/plugins/hoster/MovReelCom.py +++ b/module/plugins/hoster/MovReelCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class MovReelCom(XFSHoster): __name__ = "MovReelCom" __type__ = "hoster" - __version__ = "1.24" + __version__ = "1.25" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?movreel\.com/\w{12}' diff --git a/module/plugins/hoster/MultihostersCom.py b/module/plugins/hoster/MultihostersCom.py index bcd7c6237..11c6c4379 100644 --- a/module/plugins/hoster/MultihostersCom.py +++ b/module/plugins/hoster/MultihostersCom.py @@ -6,7 +6,8 @@ from module.plugins.hoster.ZeveraCom import ZeveraCom class MultihostersCom(ZeveraCom): __name__ = "MultihostersCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)multihosters\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index bbb77f525..6b69fa9c2 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -9,7 +9,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MultishareCz(SimpleHoster): __name__ = "MultishareCz" __type__ = "hoster" - __version__ = "0.40" + __version__ = "0.42" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -22,26 +23,26 @@ class MultishareCz(SimpleHoster): SIZE_REPLACEMENTS = [(' ', '')] CHECK_TRAFFIC = True - MULTI_HOSTER = True + LEECH_HOSTER = True INFO_PATTERN = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>' OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>PoÅŸadovanÃœ soubor neexistuje.</strong></p>' - def handleFree(self, pyfile): + def handle_free(self, pyfile): self.download("http://www.multishare.cz/html/download_free.php", get={'ID': self.info['pattern']['ID']}) - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): self.download("http://www.multishare.cz/html/download_premium.php", get={'ID': self.info['pattern']['ID']}) - def handleMulti(self, pyfile): - self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": pyfile.url}, decode=True) + def handle_multi(self, pyfile): + self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={'link': pyfile.url}) - self.checkInfo() + self.check_info() - if not self.checkTrafficLeft(): + if not self.check_traffic_left(): 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 662638843..bbd678ba0 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -9,10 +9,12 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class MyfastfileCom(MultiHoster): __name__ = "MyfastfileCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.10" + __status__ = "testing" __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Myfastfile.com multi-hoster plugin""" __license__ = "GPLv3" @@ -20,14 +22,14 @@ class MyfastfileCom(MultiHoster): def setup(self): - self.chunkLimit = -1 + self.chunk_limit = -1 - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): self.html = self.load('http://myfastfile.com/api.php', - get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'], + get={'user': self.user, 'pass': self.account.get_info(self.user)['login']['password'], 'link': pyfile.url}) - self.logDebug("JSON data: " + self.html) + self.log_debug("JSON data: " + self.html) self.html = json_loads(self.html) if self.html['status'] != 'ok': diff --git a/module/plugins/hoster/MystoreTo.py b/module/plugins/hoster/MystoreTo.py index 531368134..e4432f491 100644 --- a/module/plugins/hoster/MystoreTo.py +++ b/module/plugins/hoster/MystoreTo.py @@ -11,7 +11,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MystoreTo(SimpleHoster): __name__ = "MystoreTo" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?mystore\.to/dl/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -27,12 +28,12 @@ class MystoreTo(SimpleHoster): def setup(self): - self.chunkLimit = 1 - self.resumeDownload = True + self.chunk_limit = 1 + self.resume_download = True self.multiDL = True - def handleFree(self, pyfile): + def handle_free(self, pyfile): try: fid = re.search(r'wert="(.+?)"', self.html).group(1) diff --git a/module/plugins/hoster/MyvideoDe.py b/module/plugins/hoster/MyvideoDe.py index 8af4a9a61..9abb0abe9 100644 --- a/module/plugins/hoster/MyvideoDe.py +++ b/module/plugins/hoster/MyvideoDe.py @@ -2,14 +2,15 @@ import re -from module.plugins.Hoster import Hoster -from module.unescape import unescape +from module.plugins.internal.Hoster import Hoster +from module.utils import html_unescape class MyvideoDe(Hoster): __name__ = "MyvideoDe" __type__ = "hoster" - __version__ = "0.90" + __version__ = "0.92" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?myvideo\.de/watch/' @@ -38,7 +39,7 @@ class MyvideoDe(Hoster): def get_file_name(self): file_name_pattern = r'<h1 class=\'globalHd\'>(.*)</h1>' - return unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv') + return html_unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv') def file_exists(self): diff --git a/module/plugins/hoster/NahrajCz.py b/module/plugins/hoster/NahrajCz.py index cf708be09..0d710c9b0 100644 --- a/module/plugins/hoster/NahrajCz.py +++ b/module/plugins/hoster/NahrajCz.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class NahrajCz(DeadHoster): __name__ = "NahrajCz" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?nahraj\.cz/content/download/.+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index c201ac250..b0d4a4960 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -10,7 +10,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class NarodRu(SimpleHoster): __name__ = "NarodRu" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?narod(\.yandex)?\.ru/(disk|start/\d+\.\w+-narod\.yandex\.ru)/(?P<ID>\d+)/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -32,7 +33,7 @@ class NarodRu(SimpleHoster): LINK_FREE_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">' - def handleFree(self, pyfile): + 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)) @@ -40,20 +41,20 @@ class NarodRu(SimpleHoster): if m is None: self.error(_("Captcha")) - post_data = {"action": "sendcapcha"} + post_data = {'action': "sendcapcha"} captcha_url, post_data['key'] = m.groups() - post_data['rep'] = self.decryptCaptcha(captcha_url) + post_data['rep'] = self.captcha.decrypt(captcha_url) - self.html = self.load(pyfile.url, post=post_data, decode=True) + 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.correctCaptcha() + self.captcha.correct() break elif u'<b class="error-msg"><strong>ÐÑОблОÑÑ?</strong>' in self.html: - self.invalidCaptcha() + self.captcha.invalid() else: self.error(_("Download link")) diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 82f5c22fb..ff9e75c72 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class NetloadIn(DeadHoster): __name__ = "NetloadIn" __type__ = "hoster" - __version__ = "0.50" + __version__ = "0.51" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?netload\.(in|me)/(?P<PATH>datei|index\.php\?id=10&file_id=)(?P<ID>\w+)' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py index a86d1af24..ad0573960 100644 --- a/module/plugins/hoster/NitroflareCom.py +++ b/module/plugins/hoster/NitroflareCom.py @@ -2,30 +2,29 @@ import re -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster class NitroflareCom(SimpleHoster): __name__ = "NitroflareCom" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.15" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?nitroflare\.com/view/(?P<ID>[\w^_]+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Nitroflare.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("sahil", "sahilshekhawat01@gmail.com"), - ("Walter Purcaro", "vuolter@gmail.com"), - ("Stickell", "l.stickell@yahoo.it")] - - # URL_REPLACEMENTS = [("http://", "https://")] + __authors__ = [("sahil" , "sahilshekhawat01@gmail.com"), + ("Walter Purcaro", "vuolter@gmail.com" ), + ("Stickell" , "l.stickell@yahoo.it" )] INFO_PATTERN = r'title="(?P<N>.+?)".+>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>File doesn\'t exist' - LINK_FREE_PATTERN = r'(https?://[\w\-]+\.nitroflare\.com/.+?)"' + LINK_PREMIUM_PATTERN = LINK_FREE_PATTERN = r'(https?://[\w\-]+\.nitroflare\.com/.+?)"' RECAPTCHA_KEY = "6Lenx_USAAAAAF5L1pmTWvWcH73dipAEzNnmNLgy" PREMIUM_ONLY_PATTERN = r'This file is available with Premium only' @@ -33,15 +32,15 @@ class NitroflareCom(SimpleHoster): # ERROR_PATTERN = r'downloading is not possible' - def handleFree(self, pyfile): - # used here to load the cookies which will be required later + def handle_free(self, pyfile): + #: Used here to load the cookies which will be required later self.load(pyfile.url, post={'goToFreePage': ""}) self.load("http://nitroflare.com/ajax/setCookie.php", post={'fileId': self.info['pattern']['ID']}) self.html = self.load("http://nitroflare.com/ajax/freeDownload.php", post={'method': "startTimer", 'fileId': self.info['pattern']['ID']}) - self.checkErrors() + self.check_errors() try: js_file = self.load("http://nitroflare.com/js/downloadFree.js?v=1.0.1") @@ -61,12 +60,4 @@ class NitroflareCom(SimpleHoster): 'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) - if "The captcha wasn't entered correctly" in self.html: - self.logWarning("The captcha wasn't entered correctly") - return - - if "You have to fill the captcha" in self.html: - self.logWarning("Captcha unfilled") - return - - return super(NitroflareCom, self).handleFree(pyfile) + return super(NitroflareCom, self).handle_free(pyfile) diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index c3313c525..9e2a5a93c 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -7,10 +7,12 @@ from module.plugins.internal.MultiHoster import MultiHoster class NoPremiumPl(MultiHoster): __name__ = "NoPremiumPl" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'https?://direct\.nopremium\.pl.+' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """NoPremium.pl multi-hoster plugin""" __license__ = "GPLv3" @@ -37,68 +39,68 @@ class NoPremiumPl(MultiHoster): def prepare(self): super(NoPremiumPl, self).prepare() - data = self.account.getAccountData(self.user) + data = self.account.get_data(self.user) self.usr = data['usr'] self.pwd = data['pwd'] - def runFileQuery(self, url, mode=None): + def run_file_query(self, url, mode=None): query = self.API_QUERY.copy() - query["username"] = self.usr - query["password"] = self.pwd - query["url"] = url + query['username'] = self.usr + query['password'] = self.pwd + query['url'] = url if mode == "fileinfo": query['check'] = 2 query['loc'] = 1 - self.logDebug(query) + self.log_debug(query) return self.load(self.API_URL, post=query) - def handleFree(self, pyfile): + def handle_free(self, pyfile): try: - data = self.runFileQuery(pyfile.url, 'fileinfo') + data = self.run_file_query(pyfile.url, 'fileinfo') except Exception: - self.logDebug("runFileQuery error") - self.tempOffline() + self.log_debug("runFileQuery error") + self.temp_offline() try: parsed = json_loads(data) except Exception: - self.logDebug("loads error") - self.tempOffline() + self.log_debug("loads error") + self.temp_offline() - self.logDebug(parsed) + self.log_debug(parsed) if "errno" in parsed.keys(): - if parsed["errno"] in self.ERROR_CODES: - # error code in known - self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name__) + if parsed['errno'] in self.ERROR_CODES: + #: Error code in known + self.fail(self.ERROR_CODES[parsed['errno']] % self.__name__) else: - # error code isn't yet added to plugin + #: Error code isn't yet added to plugin self.fail( - parsed["errstring"] - or _("Unknown error (code: %s)") % parsed["errno"] + parsed['errstring'] + or _("Unknown error (code: %s)") % parsed['errno'] ) if "sdownload" in parsed: - if parsed["sdownload"] == "1": + if parsed['sdownload'] == "1": self.fail( _("Download from %s is possible only using NoPremium.pl website \ - directly") % parsed["hosting"]) + directly") % parsed['hosting']) - pyfile.name = parsed["filename"] - pyfile.size = parsed["filesize"] + pyfile.name = parsed['filename'] + pyfile.size = parsed['filesize'] try: - self.link = self.runFileQuery(pyfile.url, 'filedownload') + self.link = self.run_file_query(pyfile.url, 'filedownload') except Exception: - self.logDebug("runFileQuery error #2") - self.tempOffline() + self.log_debug("runFileQuery error #2") + self.temp_offline() diff --git a/module/plugins/hoster/NosuploadCom.py b/module/plugins/hoster/NosuploadCom.py index 241ee3a29..7de26f3fb 100644 --- a/module/plugins/hoster/NosuploadCom.py +++ b/module/plugins/hoster/NosuploadCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class NosuploadCom(XFSHoster): __name__ = "NosuploadCom" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?nosupload\.com/\?d=\w{12}' @@ -23,19 +24,19 @@ class NosuploadCom(XFSHoster): WAIT_PATTERN = r'Please wait.*?>(\d+)</span>' - def getDownloadLink(self): - # stage1: press the "Free Download" button - data = self.getPostParameters() - self.html = self.load(self.pyfile.url, post=data, decode=True) + def get_download_link(self): + #: 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 - data = self.getPostParameters() + #: 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.logDebug("Hoster told us to wait %s seconds" % wait_time) + 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, decode=True) + 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/NovafileCom.py b/module/plugins/hoster/NovafileCom.py index b00f71635..9ae73b1a8 100644 --- a/module/plugins/hoster/NovafileCom.py +++ b/module/plugins/hoster/NovafileCom.py @@ -10,7 +10,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class NovafileCom(XFSHoster): __name__ = "NovafileCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?novafile\.com/\w{12}' diff --git a/module/plugins/hoster/NowDownloadSx.py b/module/plugins/hoster/NowDownloadSx.py index a1cf9baf7..876a7bcb5 100644 --- a/module/plugins/hoster/NowDownloadSx.py +++ b/module/plugins/hoster/NowDownloadSx.py @@ -9,7 +9,8 @@ from module.utils import fixup class NowDownloadSx(SimpleHoster): __name__ = "NowDownloadSx" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.11" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?(nowdownload\.[a-zA-Z]{2,}/(dl/|download\.php.+?id=|mobile/(#/files/|.+?id=))|likeupload\.org/)\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -26,18 +27,18 @@ class NowDownloadSx(SimpleHoster): TOKEN_PATTERN = r'"(/api/token\.php\?token=\w+)"' CONTINUE_PATTERN = r'"(/dl2/\w+/\w+)"' WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),' - LINK_FREE_PATTERN = r'(http://s\d+\.coolcdn\.info/nowdownload/.+?)["\']' + LINK_FREE_PATTERN = r'(http://s\d+(?:\.coolcdn\.info|\.mighycdndelivery\.com)/nowdownload/.+?)["\']' NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<.*?>', '')] def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - self.chunkLimit = -1 + self.chunk_limit = -1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): tokenlink = re.search(self.TOKEN_PATTERN, self.html) continuelink = re.search(self.CONTINUE_PATTERN, self.html) if tokenlink is None or continuelink is None: @@ -49,7 +50,7 @@ class NowDownloadSx(SimpleHoster): else: wait = 60 - baseurl = "http://www.nowdownload.at" + baseurl = "http://www.nowdownload.ch" self.html = self.load(baseurl + str(tokenlink.group(1))) self.wait(wait) diff --git a/module/plugins/hoster/NowVideoSx.py b/module/plugins/hoster/NowVideoSx.py index 477379597..c1f369f2a 100644 --- a/module/plugins/hoster/NowVideoSx.py +++ b/module/plugins/hoster/NowVideoSx.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class NowVideoSx(SimpleHoster): __name__ = "NowVideoSx" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?nowvideo\.[a-zA-Z]{2,}/(video/|mobile/(#/videos/|.+?id=))(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -28,11 +29,11 @@ class NowVideoSx(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - def handleFree(self, pyfile): + def handle_free(self, pyfile): 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) diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index b50e2fb42..8420c6f02 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -6,18 +6,19 @@ import re from module.common.json_layer import json_loads -from module.plugins.Hoster import Hoster -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.internal.Hoster import Hoster +from module.plugins.captcha.ReCaptcha import ReCaptcha class OboomCom(Hoster): __name__ = "OboomCom" __type__ = "hoster" - __version__ = "0.33" + __version__ = "0.36" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?oboom\.com/(?:#(?:id=|/)?)?(?P<ID>\w{8})' - __description__ = """oboom.com hoster plugin""" + __description__ = """Oboom.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("stanley", "stanley.foerster@gmail.com")] @@ -26,120 +27,119 @@ class OboomCom(Hoster): def setup(self): - self.chunkLimit = 1 - self.multiDL = self.resumeDownload = self.premium + self.chunk_limit = 1 + self.multiDL = self.resume_download = self.premium def process(self, pyfile): self.pyfile.url.replace(".com/#id=", ".com/#") self.pyfile.url.replace(".com/#/", ".com/#") self.html = self.load(pyfile.url) - self.getFileId(self.pyfile.url) - self.getSessionToken() - self.getFileInfo(self.sessionToken, self.fileId) - self.pyfile.name = self.fileName - self.pyfile.size = self.fileSize + self.get_file_id(self.pyfile.url) + self.get_session_token() + self.get_fileInfo(self.session_token, self.file_id) + self.pyfile.name = self.file_name + self.pyfile.size = self.file_size if not self.premium: - self.solveCaptcha() - self.getDownloadTicket() - self.download("https://%s/1.0/dlh" % self.downloadDomain, get={"ticket": self.downloadTicket, "http_errors": 0}) + self.solve_captcha() + self.get_download_ticket() + self.download("http://%s/1.0/dlh" % self.download_domain, get={'ticket': self.download_ticket, 'http_errors': 0}) - def loadUrl(self, url, get=None): + def load_url(self, url, get=None): if get is None: - get = dict() - return json_loads(self.load(url, get, decode=True)) + get = {} + return json_loads(self.load(url, get)) - def getFileId(self, url): - self.fileId = re.match(OboomCom.__pattern__, url).group('ID') + def get_file_id(self, url): + self.file_id = re.match(OboomCom.__pattern__, url).group('ID') - def getSessionToken(self): + def get_session_token(self): if self.premium: - accountInfo = self.account.getAccountInfo(self.user, True) + accountInfo = self.account.get_data(self.user, True) if "session" in accountInfo: - self.sessionToken = accountInfo['session'] + self.session_token = accountInfo['session'] else: self.fail(_("Could not retrieve premium session")) else: - apiUrl = "https://www.oboom.com/1.0/guestsession" - result = self.loadUrl(apiUrl) + apiUrl = "http://www.oboom.com/1.0/guestsession" + result = self.load_url(apiUrl) if result[0] == 200: - self.sessionToken = result[1] + self.session_token = result[1] else: self.fail(_("Could not retrieve token for guest session. Error code: %s") % result[0]) - def solveCaptcha(self): + def solve_captcha(self): recaptcha = ReCaptcha(self) for _i in xrange(5): response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) - apiUrl = "https://www.oboom.com/1.0/download/ticket" - params = {"recaptcha_challenge_field": challenge, - "recaptcha_response_field": response, - "download_id": self.fileId, - "token": self.sessionToken} - result = self.loadUrl(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} + result = self.load_url(apiUrl, params) if result[0] == 200: - self.downloadToken = result[1] - self.downloadAuth = result[2] - self.correctCaptcha() - self.setWait(30) - self.wait() + 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.invalidCaptcha() + self.captcha.invalid() elif result[1] == "captcha-timeout": - self.invalidCaptcha() + self.captcha.invalid() elif result[1] == "forbidden": self.retry(5, 15 * 60, _("Service unavailable")) elif result[0] == 403: - if result[1] == -1: # another download is running - self.setWait(15 * 60) + if result[1] == -1: #: Another download is running + self.set_wait(15 * 60) else: - self.setWait(result[1], True) + self.set_wait(result[1], True) self.wait() self.retry(5) else: - self.invalidCaptcha() + self.captcha.invalid() self.fail(_("Received invalid captcha 5 times")) - def getFileInfo(self, token, fileId): - apiUrl = "https://api.oboom.com/1.0/info" - params = {"token": token, "items": fileId, "http_errors": 0} + def get_fileInfo(self, token, fileId): + apiUrl = "http://api.oboom.com/1.0/info" + params = {'token': token, 'items': fileId, 'http_errors': 0} - result = self.loadUrl(apiUrl, params) + result = self.load_url(apiUrl, params) if result[0] == 200: item = result[1][0] if item['state'] == "online": - self.fileSize = item['size'] - self.fileName = item['name'] + self.file_size = item['size'] + self.file_name = item['name'] else: self.offline() else: self.fail(_("Could not retrieve file info. Error code %s: %s") % (result[0], result[1])) - def getDownloadTicket(self): - apiUrl = "https://api.oboom.com/1/dl" - params = {"item": self.fileId, "http_errors": 0} + def get_download_ticket(self): + apiUrl = "http://api.oboom.com/1/dl" + params = {'item': self.file_id, 'http_errors': 0} if self.premium: - params['token'] = self.sessionToken + params['token'] = self.session_token else: - params['token'] = self.downloadToken - params['auth'] = self.downloadAuth + params['token'] = self.download_token + params['auth'] = self.download_auth - result = self.loadUrl(apiUrl, params) + result = self.load_url(apiUrl, params) if result[0] == 200: - self.downloadDomain = result[1] - self.downloadTicket = result[2] + 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")) else: diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 4b947c554..c564dc677 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.84" + __version__ = "0.86" + __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+))?' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -26,7 +27,6 @@ class OneFichierCom(SimpleHoster): COOKIES = [("1fichier.com", "LG", "en")] - DISPOSITION = False #: Remove in 0.4.10 NAME_PATTERN = r'>FileName :</td>\s*<td.*>(?P<N>.+?)<' SIZE_PATTERN = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' @@ -37,25 +37,25 @@ class OneFichierCom(SimpleHoster): def setup(self): self.multiDL = self.premium - self.resumeDownload = True + self.resume_download = True - def handleFree(self, pyfile): + def handle_free(self, pyfile): id = self.info['pattern']['ID1'] or self.info['pattern']['ID2'] - url, inputs = self.parseHtmlForm('action="https://1fichier.com/\?%s' % id) + url, inputs = self.parse_html_form('action="https://1fichier.com/\?%s' % id) if not url: self.fail(_("Download link not found")) if "pass" in inputs: - inputs['pass'] = self.getPassword() + inputs['pass'] = self.get_password() inputs['submit'] = "Download" self.download(url, post=inputs) - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): self.download(pyfile.url, post={'dl': "Download", 'did': 0}) diff --git a/module/plugins/hoster/OpenloadIo.py b/module/plugins/hoster/OpenloadIo.py index c31b5b997..c46462344 100644 --- a/module/plugins/hoster/OpenloadIo.py +++ b/module/plugins/hoster/OpenloadIo.py @@ -6,21 +6,26 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OpenloadIo(SimpleHoster): __name__ = "OpenloadIo" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.04" + __status__ = "testing" - __pattern__ = r'https?://(?:www\.)?openload\.io/f/\w{11}' + __pattern__ = r'https?://(?:www\.)?openload\.io/f/[\w_-]{11}' __description__ = """Openload.io 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^_]+)<' + + 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)" - LINK_FREE_PATTERN = r'id="realdownload"><a href="(https?://[\w\.]+\.openload\.io/dl/.*?)"' + LINK_FREE_PATTERN = r'id="real\w*download"><a href="(https?://[\w\.]+\.openload\.io/dl/.*?)"' + def setup(self): self.multiDL = True - self.chunkLimit = 1 + self.chunk_limit = 1 + getInfo = create_getInfo(OpenloadIo) diff --git a/module/plugins/hoster/OronCom.py b/module/plugins/hoster/OronCom.py index 2e4961704..e1887ce76 100644 --- a/module/plugins/hoster/OronCom.py +++ b/module/plugins/hoster/OronCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class OronCom(DeadHoster): __name__ = "OronCom" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?oron\.com/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index d06baa0f5..0b5bab6a5 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -5,16 +5,18 @@ import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.utils import parseFileSize +from module.utils import parseFileSize as parse_size class OverLoadMe(MultiHoster): __name__ = "OverLoadMe" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.13" + __status__ = "testing" __pattern__ = r'https?://.*overload\.me/.+' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Over-Load.me multi-hoster plugin""" __license__ = "GPLv3" @@ -22,30 +24,27 @@ class OverLoadMe(MultiHoster): def setup(self): - self.chunkLimit = 5 + self.chunk_limit = 5 - def handlePremium(self, pyfile): - https = "https" if self.getConfig('ssl') else "http" - data = self.account.getAccountData(self.user) - page = self.load(https + "://api.over-load.me/getdownload.php", + def handle_premium(self, pyfile): + data = self.account.get_data(self.user) + page = self.load("https://api.over-load.me/getdownload.php", get={'auth': data['password'], 'link': pyfile.url}) data = json_loads(page) - self.logDebug(data) + self.log_debug(data) if data['error'] == 1: - self.logWarning(data['msg']) - self.tempOffline() + self.log_warning(data['msg']) + self.temp_offline() else: + self.link = data['downloadlink'] if pyfile.name and pyfile.name.endswith('.tmp') and data['filename']: pyfile.name = data['filename'] - pyfile.size = parseFileSize(data['filesize']) - - http_repl = ["http://", "https://"] - self.link = data['downloadlink'].replace(*http_repl if self.getConfig('ssl') else *http_repl[::-1]) + pyfile.size = parse_size(data['filesize']) getInfo = create_getInfo(OverLoadMe) diff --git a/module/plugins/hoster/PandaplaNet.py b/module/plugins/hoster/PandaplaNet.py index ae8406d82..4efe20b5a 100644 --- a/module/plugins/hoster/PandaplaNet.py +++ b/module/plugins/hoster/PandaplaNet.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class PandaplaNet(DeadHoster): __name__ = "PandaplaNet" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?pandapla\.net/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/PornhostCom.py b/module/plugins/hoster/PornhostCom.py index 0c3b84a9d..8b0a80c7f 100644 --- a/module/plugins/hoster/PornhostCom.py +++ b/module/plugins/hoster/PornhostCom.py @@ -2,13 +2,14 @@ import re -from module.plugins.Hoster import Hoster +from module.plugins.internal.Hoster import Hoster class PornhostCom(Hoster): __name__ = "PornhostCom" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.22" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?pornhost\.com/(\d+/\d+\.html|\d+)' @@ -26,14 +27,15 @@ class PornhostCom(Hoster): self.download(self.get_file_url()) - # Old interface + #: Old interface def download_html(self): url = self.pyfile.url self.html = self.load(url) def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() @@ -45,7 +47,7 @@ class PornhostCom(Hoster): url = re.search(r'width: 894px; height: 675px">.*?<img src="(.*?)"', self.html) if url is None: url = re.search(r'"http://file\d+\.pornhost\.com/\d+/.*?"', - self.html) # TODO: fix this one since it doesn't match + self.html) #@TODO: fix this one since it doesn't match return url.group(1).strip() @@ -68,7 +70,8 @@ class PornhostCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index 16ce36ea9..5345566a1 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -2,13 +2,14 @@ import re -from module.plugins.Hoster import Hoster +from module.plugins.internal.Hoster import Hoster class PornhubCom(Hoster): __name__ = "PornhubCom" __type__ = "hoster" - __version__ = "0.50" + __version__ = "0.52" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?pornhub\.com/view_video\.php\?viewkey=\w+' @@ -32,14 +33,15 @@ class PornhubCom(Hoster): def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() url = "http://www.pornhub.com//gateway.php" video_id = self.pyfile.url.split('=')[-1] - # thanks to jD team for this one v + #: Thanks to jD team for this one v post_data = "\x00\x03\x00\x00\x00\x01\x00\x0c\x70\x6c\x61\x79\x65\x72\x43\x6f\x6e\x66\x69\x67\x00\x02\x2f\x31\x00\x00\x00\x44\x0a\x00\x00\x00\x03\x02\x00" post_data += chr(len(video_id)) post_data += video_id @@ -78,7 +80,8 @@ class PornhubCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/PotloadCom.py b/module/plugins/hoster/PotloadCom.py index 5a41f7d3c..8279412e4 100644 --- a/module/plugins/hoster/PotloadCom.py +++ b/module/plugins/hoster/PotloadCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class PotloadCom(DeadHoster): __name__ = "PotloadCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?potload\.com/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index ab5016673..ec02bb12d 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -11,10 +11,12 @@ from module.utils import fs_encode class PremiumTo(MultiHoster): __name__ = "PremiumTo" __type__ = "hoster" - __version__ = "0.22" + __version__ = "0.25" + __status__ = "testing" __pattern__ = r'^unmatchable$' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Premium.to multi-hoster plugin""" __license__ = "GPLv3" @@ -26,8 +28,8 @@ class PremiumTo(MultiHoster): CHECK_TRAFFIC = True - def handlePremium(self, pyfile): - #raise timeout to 2min + def handle_premium(self, pyfile): + #: Raise timeout to 2 min self.download("http://premium.to/api/getfile.php", get={'username': self.account.username, 'password': self.account.password, @@ -35,14 +37,14 @@ class PremiumTo(MultiHoster): disposition=True) - def checkFile(self, rules={}): - if self.checkDownload({'nopremium': "No premium account available"}): + def check_file(self): + if self.check_download({'nopremium': "No premium account available"}): self.retry(60, 5 * 60, "No premium account available") - err = '' - if self.req.http.code == '420': - # Custom error code send - fail - file = fs_encode(self.lastDownload) + err = "" + if self.req.http.code == "420": + #: Custom error code send - fail + file = fs_encode(self.last_download) with open(file, "rb") as f: err = f.read(256).strip() os.remove(file) @@ -50,7 +52,7 @@ class PremiumTo(MultiHoster): if err: self.fail(err) - return super(PremiumTo, self).checkFile(rules) + return super(PremiumTo, self).check_file() getInfo = create_getInfo(PremiumTo) diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py index 3227fb001..d968eccec 100644 --- a/module/plugins/hoster/PremiumizeMe.py +++ b/module/plugins/hoster/PremiumizeMe.py @@ -7,38 +7,40 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class PremiumizeMe(MultiHoster): __name__ = "PremiumizeMe" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.20" + __status__ = "testing" - __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Premiumize.me multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] - def handlePremium(self, pyfile): - # In some cases hostsers do not supply us with a filename at download, so we - # are going to set a fall back filename (e.g. for freakshare or xfileshare) - pyfile.name = pyfile.name.split('/').pop() # Remove everthing before last slash + def handle_premium(self, pyfile): + #: In some cases hostsers do not supply us with a filename at download, so we + #: Are going to set a fall back filename (e.g. for freakshare or xfileshare) + pyfile.name = pyfile.name.split('/').pop() #: Remove everthing before last slash - # Correction for automatic assigned filename: Removing html at end if needed + #: Correction for automatic assigned filename: Removing html at end if needed suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"] temp = pyfile.name.split('.') if temp.pop() in suffix_to_remove: pyfile.name = ".".join(temp) - # Get account data - user, data = self.account.selectAccount() + #: Get account data + user, info = self.account.select() - # Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api) - data = json_loads(self.load("https://api.premiumize.me/pm-api/v1.php", + #: Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api) + data = json_loads(self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10 get={'method' : "directdownloadlink", 'params[login]': user, - 'params[pass]' : data['password'], + 'params[pass]' : info['login']['password'], 'params[link]' : pyfile.url})) - # Check status and decide what to do + #: Check status and decide what to do status = data['status'] if status == 200: @@ -52,7 +54,7 @@ class PremiumizeMe(MultiHoster): self.offline() elif status >= 500: - self.tempOffline() + self.temp_offline() else: self.fail(data['statusmessage']) diff --git a/module/plugins/hoster/PromptfileCom.py b/module/plugins/hoster/PromptfileCom.py index 3815a1a24..5f7510123 100644 --- a/module/plugins/hoster/PromptfileCom.py +++ b/module/plugins/hoster/PromptfileCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class PromptfileCom(SimpleHoster): __name__ = "PromptfileCom" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?promptfile\.com/' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -18,29 +19,27 @@ class PromptfileCom(SimpleHoster): __authors__ = [("igel", "igelkun@myopera.com")] - INFO_PATTERN = r'<span style=".+?" title=".+?">(?P<N>.*?) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</span>' + INFO_PATTERN = r'<span style=".+?" title=".+?">(?P<N>.*?) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</span>' OFFLINE_PATTERN = r'<span style=".+?" title="File Not Found">File Not Found</span>' - CHASH_PATTERN = r'<input type="hidden" name="chash" value="(.+?)" />' + CHASH_PATTERN = r'<input type="hidden" name="chash" value="(.+?)" />' LINK_FREE_PATTERN = r'<a href=\"(.+)\" target=\"_blank\" class=\"view_dl_link\">Download File</a>' - def handleFree(self, pyfile): - # STAGE 1: get link to continue + def handle_free(self, pyfile): + #: STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: self.error(_("CHASH_PATTERN not found")) + chash = m.group(1) - self.logDebug("Read chash %s" % chash) - # continue to stage2 - self.html = self.load(pyfile.url, decode=True, post={'chash': chash}) + self.log_debug("Read chash %s" % chash) - # STAGE 2: get the direct link - m = re.search(self.LINK_FREE_PATTERN, self.html) - if m is None: - self.error(_("LINK_FREE_PATTERN not found")) + #: Continue to stage2 + self.html = self.load(pyfile.url, post={'chash': chash}) - self.link = m.group(1) + #: STAGE 2: get the direct link + return super(PromptfileCom, self).handle_free(pyfile) getInfo = create_getInfo(PromptfileCom) diff --git a/module/plugins/hoster/PrzeklejPl.py b/module/plugins/hoster/PrzeklejPl.py index e984d0033..b066444da 100644 --- a/module/plugins/hoster/PrzeklejPl.py +++ b/module/plugins/hoster/PrzeklejPl.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class PrzeklejPl(DeadHoster): __name__ = "PrzeklejPl" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?przeklej\.pl/plik/.+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/PutdriveCom.py b/module/plugins/hoster/PutdriveCom.py index 7f4b7b6cc..e924fbcfc 100644 --- a/module/plugins/hoster/PutdriveCom.py +++ b/module/plugins/hoster/PutdriveCom.py @@ -6,7 +6,8 @@ from module.plugins.hoster.ZeveraCom import ZeveraCom class PutdriveCom(ZeveraCom): __name__ = "PutdriveCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)putdrive\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 1e0750b88..4311a82aa 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -9,7 +9,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class QuickshareCz(SimpleHoster): __name__ = "QuickshareCz" __type__ = "hoster" - __version__ = "0.56" + __version__ = "0.57" + __status__ = "testing" __pattern__ = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -25,39 +26,39 @@ class QuickshareCz(SimpleHoster): def process(self, pyfile): - self.html = self.load(pyfile.url, decode=True) - self.getFileInfo() + self.html = self.load(pyfile.url) + self.get_fileInfo() - # parse js variables + #: Parse js variables self.jsvars = dict((x, y.strip("'")) for x, y in re.findall(r"var (\w+) = ([\d.]+|'.+?')", self.html)) - self.logDebug(self.jsvars) + self.log_debug(self.jsvars) pyfile.name = self.jsvars['ID3'] - # determine download type - free or premium + #: Determine download type - free or premium if self.premium: if 'UU_prihlasen' in self.jsvars: - if self.jsvars['UU_prihlasen'] == '0': - self.logWarning(_("User not logged in")) + if self.jsvars['UU_prihlasen'] == "0": + self.log_warning(_("User not logged in")) self.relogin(self.user) self.retry() elif float(self.jsvars['UU_kredit']) < float(self.jsvars['kredit_odecet']): - self.logWarning(_("Not enough credit left")) + self.log_warning(_("Not enough credit left")) self.premium = False if self.premium: - self.handlePremium(pyfile) + self.handle_premium(pyfile) else: - self.handleFree(pyfile) + self.handle_free(pyfile) - if self.checkDownload({"error": re.compile(r"\AChyba!")}, max_size=100): + if self.check_download({'error': re.compile(r"\AChyba!")}, max_size=100): self.fail(_("File not m or plugin defect")) - def handleFree(self, pyfile): - # get download url + def handle_free(self, pyfile): + #: Get download url download_url = '%s/download.php' % self.jsvars['server'] data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID3", "ID4")) - self.logDebug("FREE URL1:" + download_url, data) + self.log_debug("FREE URL1:" + download_url, data) self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) self.load(download_url, post=data) @@ -69,20 +70,20 @@ class QuickshareCz(SimpleHoster): self.fail(_("File not found")) self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 - self.logDebug("FREE URL2:" + self.link) + self.log_debug("FREE URL2:" + self.link) - # check errors + #: Check errors m = re.search(r'/chyba/(\d+)', self.link) if m: - if m.group(1) == '1': + if m.group(1) == "1": self.retry(60, 2 * 60, "This IP is already downloading") - elif m.group(1) == '2': + elif m.group(1) == "2": self.retry(60, 60, "No free slots available") else: self.fail(_("Error %d") % m.group(1)) - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): download_url = '%s/download_premium.php' % self.jsvars['server'] data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID4", "ID5")) self.download(download_url, get=data) diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index 710faf25c..62e6bee4e 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -9,10 +9,12 @@ from module.common.json_layer import json_loads class RPNetBiz(MultiHoster): __name__ = "RPNetBiz" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.17" + __status__ = "testing" __pattern__ = r'https?://.+rpnet\.biz' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """RPNet.biz multi-hoster plugin""" __license__ = "GPLv3" @@ -20,53 +22,51 @@ class RPNetBiz(MultiHoster): def setup(self): - self.chunkLimit = -1 + self.chunk_limit = -1 - def handlePremium(self, pyfile): - user, data = self.account.selectAccount() + def handle_premium(self, pyfile): + user, info = self.account.select() - # Get the download link + #: Get the download link res = self.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, - "password": data['password'], - "action" : "generate", - "links" : pyfile.url}) + get={'username': user, + 'password': info['login']['password'], + 'action' : "generate", + 'links' : pyfile.url}) - self.logDebug("JSON data: %s" % res) - link_status = json_loads(res)['links'][0] # get the first link... since we only queried one + self.log_debug("JSON data: %s" % res) + link_status = json_loads(res)['links'][0] #: Get the first link... since we only queried one - # Check if we only have an id as a HDD link + #: Check if we only have an id as a HDD link if 'id' in link_status: - self.logDebug("Need to wait at least 30 seconds before requery") - self.setWait(30) # wait for 30 seconds - self.wait() - # Lets query the server again asking for the status on the link, - # we need to keep doing this until we reach 100 + self.log_debug("Need to wait at least 30 seconds before requery") + 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 my_try = 0 while (my_try <= max_tries): - self.logDebug("Try: %d ; Max Tries: %d" % (my_try, max_tries)) + self.log_debug("Try: %d ; Max Tries: %d" % (my_try, max_tries)) res = self.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, - "password": data['password'], - "action": "downloadInformation", - "id": link_status['id']}) - self.logDebug("JSON data hdd query: %s" % res) + get={'username': user, + 'password': info['login']['password'], + 'action' : "downloadInformation", + 'id' : link_status['id']}) + self.log_debug("JSON data hdd query: %s" % res) download_status = json_loads(res)['download'] - if download_status['status'] == '100': + if download_status['status'] == "100": link_status['generated'] = download_status['rpnet_link'] - self.logDebug("Successfully downloaded to rpnet HDD: %s" % link_status['generated']) + self.log_debug("Successfully downloaded to rpnet HDD: %s" % link_status['generated']) break else: - self.logDebug("At %s%% for the file download" % download_status['status']) + self.log_debug("At %s%% for the file download" % download_status['status']) - self.setWait(30) - self.wait() + self.wait(30) my_try += 1 - if my_try > max_tries: # We went over the limit! + if my_try > max_tries: #: 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 50804e8cd..e1a0d278f 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -7,10 +7,12 @@ from module.plugins.internal.MultiHoster import MultiHoster class RapideoPl(MultiHoster): __name__ = "RapideoPl" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'^unmatchable$' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Rapideo.pl multi-hoster plugin""" __license__ = "GPLv3" @@ -37,68 +39,68 @@ class RapideoPl(MultiHoster): def prepare(self): super(RapideoPl, self).prepare() - data = self.account.getAccountData(self.user) + data = self.account.get_data(self.user) self.usr = data['usr'] self.pwd = data['pwd'] - def runFileQuery(self, url, mode=None): + def run_file_query(self, url, mode=None): query = self.API_QUERY.copy() - query["username"] = self.usr - query["password"] = self.pwd - query["url"] = url + query['username'] = self.usr + query['password'] = self.pwd + query['url'] = url if mode == "fileinfo": query['check'] = 2 query['loc'] = 1 - self.logDebug(query) + self.log_debug(query) return self.load(self.API_URL, post=query) - def handleFree(self, pyfile): + def handle_free(self, pyfile): try: - data = self.runFileQuery(pyfile.url, 'fileinfo') + data = self.run_file_query(pyfile.url, 'fileinfo') except Exception: - self.logDebug("RunFileQuery error") - self.tempOffline() + self.log_debug("RunFileQuery error") + self.temp_offline() try: parsed = json_loads(data) except Exception: - self.logDebug("Loads error") - self.tempOffline() + self.log_debug("Loads error") + self.temp_offline() - self.logDebug(parsed) + self.log_debug(parsed) if "errno" in parsed.keys(): - if parsed["errno"] in self.ERROR_CODES: - # error code in known - self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name__) + if parsed['errno'] in self.ERROR_CODES: + #: Error code in known + self.fail(self.ERROR_CODES[parsed['errno']] % self.__name__) else: - # error code isn't yet added to plugin + #: Error code isn't yet added to plugin self.fail( - parsed["errstring"] - or _("Unknown error (code: %s)") % parsed["errno"] + parsed['errstring'] + or _("Unknown error (code: %s)") % parsed['errno'] ) if "sdownload" in parsed: - if parsed["sdownload"] == "1": + if parsed['sdownload'] == "1": self.fail( _("Download from %s is possible only using Rapideo.pl website \ - directly") % parsed["hosting"]) + directly") % parsed['hosting']) - pyfile.name = parsed["filename"] - pyfile.size = parsed["filesize"] + pyfile.name = parsed['filename'] + pyfile.size = parsed['filesize'] try: - self.link = self.runFileQuery(pyfile.url, 'filedownload') + self.link = self.run_file_query(pyfile.url, 'filedownload') except Exception: - self.logDebug("runFileQuery error #2") - self.tempOffline() + self.log_debug("runFileQuery error #2") + self.temp_offline() diff --git a/module/plugins/hoster/RapidfileshareNet.py b/module/plugins/hoster/RapidfileshareNet.py index 0bbaed57f..5dd3ba82d 100644 --- a/module/plugins/hoster/RapidfileshareNet.py +++ b/module/plugins/hoster/RapidfileshareNet.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class RapidfileshareNet(XFSHoster): __name__ = "RapidfileshareNet" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?rapidfileshare\.net/\w{12}' diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index bd6bb8582..636ea1bcc 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -5,16 +5,17 @@ import re from module.common.json_layer import json_loads from module.network.HTTPRequest import BadHeader -from module.plugins.internal.AdsCaptcha import AdsCaptcha -from module.plugins.internal.ReCaptcha import ReCaptcha -from module.plugins.internal.SolveMedia import SolveMedia +from module.plugins.captcha.AdsCaptcha import AdsCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha +from module.plugins.captcha.SolveMedia import SolveMedia from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" - __version__ = "0.34" + __version__ = "0.35" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -50,29 +51,29 @@ class RapidgatorNet(SimpleHoster): def setup(self): if self.account: - self.sid = self.account.getAccountInfo(self.user).get('sid', None) + self.sid = self.account.get_data(self.user).get('sid', None) else: self.sid = None if self.sid: self.premium = True - self.resumeDownload = self.multiDL = self.premium - self.chunkLimit = 1 + self.resume_download = self.multiDL = self.premium + self.chunk_limit = 1 def api_response(self, cmd): try: json = self.load('%s/%s' % (self.API_URL, cmd), get={'sid': self.sid, - 'url': self.pyfile.url}, decode=True) - self.logDebug("API:%s" % cmd, json, "SID: %s" % self.sid) + 'url': self.pyfile.url}) + self.log_debug("API:%s" % cmd, json, "SID: %s" % self.sid) json = json_loads(json) status = json['response_status'] msg = json['response_details'] except BadHeader, e: - self.logError("API: %s" % cmd, e, "SID: %s" % self.sid) + self.log_error("API: %s" % cmd, e, "SID: %s" % self.sid) status = e.code msg = e @@ -88,7 +89,7 @@ class RapidgatorNet(SimpleHoster): self.retry(wait_time=60) - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): self.api_data = self.api_response('info') self.api_data['md5'] = self.api_data['hash'] @@ -98,22 +99,22 @@ class RapidgatorNet(SimpleHoster): self.link = self.api_response('download')['url'] - def handleFree(self, pyfile): + def handle_free(self, pyfile): jsvars = dict(re.findall(self.JSVARS_PATTERN, self.html)) - self.logDebug(jsvars) + self.log_debug(jsvars) self.req.http.lastURL = pyfile.url self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) url = "http://rapidgator.net%s?fid=%s" % ( jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars['fid']) - jsvars.update(self.getJsonResponse(url)) + jsvars.update(self.get_json_response(url)) self.wait(jsvars.get('secs', 45), False) url = "http://rapidgator.net%s?sid=%s" % ( jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars['sid']) - jsvars.update(self.getJsonResponse(url)) + jsvars.update(self.get_json_response(url)) self.req.http.lastURL = pyfile.url self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With:"]) @@ -127,7 +128,7 @@ class RapidgatorNet(SimpleHoster): self.link = m.group(1) break else: - captcha = self.handleCaptcha() + captcha = self.handle_captcha() if not captcha: self.error(_("Captcha pattern not found")) @@ -139,25 +140,25 @@ class RapidgatorNet(SimpleHoster): 'adcopy_response' : response}) if "The verification code is incorrect" in self.html: - self.invalidCaptcha() + self.captcha.invalid() else: - self.correctCaptcha() + self.captcha.correct() else: self.error(_("Download link")) - def handleCaptcha(self): + def handle_captcha(self): for klass in (AdsCaptcha, ReCaptcha, SolveMedia): inst = klass(self) if inst.detect_key(): return inst - def getJsonResponse(self, url): - res = self.load(url, decode=True) + def get_json_response(self, url): + res = self.load(url) if not res.startswith('{'): self.retry() - self.logDebug(url, res) + self.log_debug(url, res) return json_loads(res) diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py index da353ec70..267f41f36 100644 --- a/module/plugins/hoster/RapiduNet.py +++ b/module/plugins/hoster/RapiduNet.py @@ -5,14 +5,15 @@ import re import time from module.common.json_layer import json_loads -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RapiduNet(SimpleHoster): __name__ = "RapiduNet" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?rapidu\.net/(?P<ID>\d{10})' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -33,23 +34,22 @@ class RapiduNet(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = self.premium - def handleFree(self, pyfile): + def handle_free(self, pyfile): self.req.http.lastURL = pyfile.url self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", + jsvars = self.get_json_response("https://rapidu.net/ajax.php", get={'a': "getLoadTimeToDownload"}, - post={'_go': ""}, - decode=True) + post={'_go': ""}) - if str(jsvars['timeToDownload']) is "stop": + if str(jsvars['timeToDownload']) == "stop": t = (24 * 60 * 60) - (int(time.time()) % (24 * 60 * 60)) + time.altzone - self.logInfo("You've reach your daily download transfer") + self.log_info(_("You've reach your daily download transfer")) self.retry(10, 10 if t < 1 else None, _("Try tomorrow again")) #@NOTE: check t in case of not synchronised clock @@ -59,24 +59,23 @@ class RapiduNet(SimpleHoster): recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) - jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", + jsvars = self.get_json_response("https://rapidu.net/ajax.php", get={'a': "getCheckCaptcha"}, post={'_go' : "", 'captcha1': challenge, 'captcha2': response, - 'fileId' : self.info['pattern']['ID']}, - decode=True) + 'fileId' : self.info['pattern']['ID']}) - if jsvars['message'] == 'success': + if jsvars['message'] == "success": self.link = jsvars['url'] - def getJsonResponse(self, *args, **kwargs): + def get_json_response(self, *args, **kwargs): res = self.load(*args, **kwargs) if not res.startswith('{'): self.retry() - self.logDebug(res) + self.log_debug(res) return json_loads(res) diff --git a/module/plugins/hoster/RarefileNet.py b/module/plugins/hoster/RarefileNet.py index a45e4ed4d..7b19996dc 100644 --- a/module/plugins/hoster/RarefileNet.py +++ b/module/plugins/hoster/RarefileNet.py @@ -8,7 +8,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class RarefileNet(XFSHoster): __name__ = "RarefileNet" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?rarefile\.net/\w{12}' diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index 4500fcefc..6409701e4 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -6,16 +6,18 @@ import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.utils import parseFileSize +from module.utils import parseFileSize as parse_size class RealdebridCom(MultiHoster): __name__ = "RealdebridCom" __type__ = "hoster" - __version__ = "0.67" + __version__ = "0.69" + __status__ = "testing" __pattern__ = r'https?://((?:www\.|s\d+\.)?real-debrid\.com/dl/|[\w^_]\.rdb\.so/d/)[\w^_]+' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Real-Debrid.com multi-hoster plugin""" __license__ = "GPLv3" @@ -23,34 +25,29 @@ class RealdebridCom(MultiHoster): def setup(self): - self.chunkLimit = 3 + self.chunk_limit = 3 - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): data = json_loads(self.load("https://real-debrid.com/ajax/unrestrict.php", get={'lang' : "en", 'link' : pyfile.url, - 'password': self.getPassword(), + 'password': self.get_password(), 'time' : int(time.time() * 1000)})) - self.logDebug("Returned Data: %s" % data) + self.log_debug("Returned Data: %s" % data) if data['error'] != 0: if data['message'] == "Your file is unavailable on the hoster.": self.offline() else: - self.logWarning(data['message']) - self.tempOffline() + self.log_warning(data['message']) + self.temp_offline() else: if pyfile.name and pyfile.name.endswith('.tmp') and data['file_name']: pyfile.name = data['file_name'] - pyfile.size = parseFileSize(data['file_size']) + pyfile.size = parse_size(data['file_size']) self.link = data['generated_links'][0][-1] - if self.getConfig('ssl'): - self.link = self.link.replace("http://", "https://") - else: - self.link = self.link.replace("https://", "http://") - getInfo = create_getInfo(RealdebridCom) diff --git a/module/plugins/hoster/RedtubeCom.py b/module/plugins/hoster/RedtubeCom.py index 9051c498a..94a0ead20 100644 --- a/module/plugins/hoster/RedtubeCom.py +++ b/module/plugins/hoster/RedtubeCom.py @@ -2,14 +2,15 @@ import re -from module.plugins.Hoster import Hoster -from module.unescape import unescape +from module.plugins.internal.Hoster import Hoster +from module.utils import html_unescape class RedtubeCom(Hoster): __name__ = "RedtubeCom" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.22" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?redtube\.com/\d+' @@ -33,14 +34,13 @@ class RedtubeCom(Hoster): def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() - file_url = unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1)) - - return file_url + return html_unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1)) def get_file_name(self): @@ -51,7 +51,8 @@ class RedtubeCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index 9c07364ec..6f0645e9f 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -8,20 +8,22 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class RehostTo(MultiHoster): __name__ = "RehostTo" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.23" + __status__ = "testing" __pattern__ = r'https?://.*rehost\.to\..+' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Rehost.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org")] - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): self.download("http://rehost.to/process_download.php", get={'user': "cookie", - 'pass': self.account.getAccountInfo(self.user)['session'], + 'pass': self.account.get_data(self.user)['session'], 'dl' : pyfile.url}, disposition=True) diff --git a/module/plugins/hoster/RemixshareCom.py b/module/plugins/hoster/RemixshareCom.py index d60101aed..295362174 100644 --- a/module/plugins/hoster/RemixshareCom.py +++ b/module/plugins/hoster/RemixshareCom.py @@ -16,7 +16,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RemixshareCom(SimpleHoster): __name__ = "RemixshareCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'https?://remixshare\.com/(download|dl)/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -40,10 +41,10 @@ class RemixshareCom(SimpleHoster): def setup(self): self.multiDL = True - self.chunkLimit = 1 + self.chunk_limit = 1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): b = re.search(self.LINK_PATTERN, self.html) if not b: self.error(_("File url")) diff --git a/module/plugins/hoster/RgHostNet.py b/module/plugins/hoster/RgHostNet.py index 1a45def44..0aa4b7d73 100644 --- a/module/plugins/hoster/RgHostNet.py +++ b/module/plugins/hoster/RgHostNet.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RgHostNet(SimpleHoster): __name__ = "RgHostNet" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?rghost\.(net|ru)/[\d-]+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] diff --git a/module/plugins/hoster/SafesharingEu.py b/module/plugins/hoster/SafesharingEu.py index 08612e413..e7d53fe75 100644 --- a/module/plugins/hoster/SafesharingEu.py +++ b/module/plugins/hoster/SafesharingEu.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class SafesharingEu(XFSHoster): __name__ = "SafesharingEu" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?safesharing\.eu/\w{12}' diff --git a/module/plugins/hoster/SecureUploadEu.py b/module/plugins/hoster/SecureUploadEu.py index 6bfbce328..df2ac1627 100644 --- a/module/plugins/hoster/SecureUploadEu.py +++ b/module/plugins/hoster/SecureUploadEu.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class SecureUploadEu(XFSHoster): __name__ = "SecureUploadEu" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?secureupload\.eu/\w{12}' diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py index 0ab20949d..13dd20b7c 100644 --- a/module/plugins/hoster/SendspaceCom.py +++ b/module/plugins/hoster/SendspaceCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class SendspaceCom(SimpleHoster): __name__ = "SendspaceCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.18" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?sendspace\.com/file/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -28,30 +29,30 @@ class SendspaceCom(SimpleHoster): USER_CAPTCHA_PATTERN = r'<td><img src="/captchas/captcha\.php?user=(.+?))"></td>' - def handleFree(self, pyfile): + 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.correctCaptcha() + self.captcha.correct() self.link = m.group(1) break m = re.search(self.CAPTCHA_PATTERN, self.html) if m: if 'captcha_hash' in params: - self.invalidCaptcha() + self.captcha.invalid() captcha_url1 = "http://www.sendspace.com/" + m.group(1) m = re.search(self.USER_CAPTCHA_PATTERN, self.html) captcha_url2 = "http://www.sendspace.com/" + m.group(1) params = {'captcha_hash': m.group(2), 'captcha_submit': 'Verify', - 'captcha_answer': self.decryptCaptcha(captcha_url1) + " " + self.decryptCaptcha(captcha_url2)} + 'captcha_answer': self.captcha.decrypt(captcha_url1) + " " + self.captcha.decrypt(captcha_url2)} else: params = {'download': "Regular Download"} - self.logDebug(params) + self.log_debug(params) self.html = self.load(pyfile.url, post=params) else: self.fail(_("Download link not found")) diff --git a/module/plugins/hoster/Share4WebCom.py b/module/plugins/hoster/Share4WebCom.py index 7a276c1fe..3f128be5e 100644 --- a/module/plugins/hoster/Share4WebCom.py +++ b/module/plugins/hoster/Share4WebCom.py @@ -7,7 +7,8 @@ from module.plugins.internal.SimpleHoster import create_getInfo class Share4WebCom(UnibytesCom): __name__ = "Share4WebCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?share4web\.com/get/\w+' diff --git a/module/plugins/hoster/Share76Com.py b/module/plugins/hoster/Share76Com.py index 4a4af1672..863fb0a7e 100644 --- a/module/plugins/hoster/Share76Com.py +++ b/module/plugins/hoster/Share76Com.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class Share76Com(DeadHoster): __name__ = "Share76Com" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?share76\.com/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/ShareFilesCo.py b/module/plugins/hoster/ShareFilesCo.py index d9a71d786..a42ceb91c 100644 --- a/module/plugins/hoster/ShareFilesCo.py +++ b/module/plugins/hoster/ShareFilesCo.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class ShareFilesCo(DeadHoster): __name__ = "ShareFilesCo" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?sharefiles\.co/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/SharebeesCom.py b/module/plugins/hoster/SharebeesCom.py index 9387483cc..c987ac0f9 100644 --- a/module/plugins/hoster/SharebeesCom.py +++ b/module/plugins/hoster/SharebeesCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class SharebeesCom(DeadHoster): __name__ = "SharebeesCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?sharebees\.com/\w{12}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 33e37cbc7..b5af3ea35 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -5,15 +5,16 @@ import time import urllib import urlparse -from module.network.RequestFactory import getURL -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.network.RequestFactory import getURL as get_url +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.51" + __version__ = "0.55" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -36,70 +37,67 @@ class ShareonlineBiz(SimpleHoster): @classmethod - def apiInfo(cls, url): - info = super(ShareonlineBiz, cls).apiInfo(url) + def api_info(cls, url): + info = super(ShareonlineBiz, cls).api_info(url) - if url: - field = getURL("http://api.share-online.biz/linkcheck.php", - get={'md5' : "1", - 'links': re.match(cls.__pattern__, url).group("ID")}, - decode=True).split(";") + field = get_url("http://api.share-online.biz/linkcheck.php", + get={'md5' : "1", + 'links': re.match(cls.__pattern__, url).group("ID")}).split(";") - try: - if field[1] == "OK": - info['fileid'] = field[0] - info['status'] = 2 - info['name'] = field[2] - info['size'] = field[3] #: in bytes - info['md5'] = field[4].strip().lower().replace("\n\n", "") #: md5 + try: + if field[1] == "OK": + info['fileid'] = field[0] + info['status'] = 2 + info['name'] = field[2] + info['size'] = field[3] #: In bytes + info['md5'] = field[4].strip().lower().replace("\n\n", "") #: md5 - elif field[1] in ("DELETED", "NOT FOUND"): - info['status'] = 1 + elif field[1] in ("DELETED", "NOTFOUND"): + info['status'] = 1 - except IndexError: - pass + except IndexError: + pass return info def setup(self): - self.resumeDownload = self.premium + self.resume_download = self.premium self.multiDL = False - def handleCaptcha(self): + 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.setWait(int(m.group(1)) if m else 30) + 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.correctCaptcha() + if not res == "0": + self.captcha.correct() return res else: - self.invalidCaptcha() + self.captcha.invalid() else: - self.invalidCaptcha() + self.captcha.invalid() self.fail(_("No valid captcha solution received")) - def handleFree(self, pyfile): + def handle_free(self, pyfile): self.wait(3) self.html = self.load("%s/free/" % pyfile.url, - post={'dl_free': "1", 'choice': "free"}, - decode=True) + post={'dl_free': "1", 'choice': "free"}) - self.checkErrors() + self.check_errors() - res = self.handleCaptcha() + res = self.handle_captcha() self.link = res.decode('base64') if not self.link.startswith("http://"): @@ -108,25 +106,25 @@ class ShareonlineBiz(SimpleHoster): self.wait() - def checkFile(self, rules={}): - check = self.checkDownload({'cookie': re.compile(r'<div id="dl_failure"'), + def check_file(self): + check = self.check_download({'cookie': re.compile(r'<div id="dl_failure"'), 'fail' : re.compile(r"<title>Share-Online")}) if check == "cookie": - self.invalidCaptcha() + self.captcha.invalid() self.retry(5, 60, _("Cookie failure")) elif check == "fail": - self.invalidCaptcha() + self.captcha.invalid() self.retry(5, 5 * 60, _("Download failed")) - return super(ShareonlineBiz, self).checkFile(rules) + return super(ShareonlineBiz, self).check_file() - def handlePremium(self, pyfile): #: should be working better loading (account) api internally - html = self.load("http://api.share-online.biz/account.php", + 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.getAccountData(self.user)['password'], + 'password': self.account.get_info(self.user)['login']['password'], 'act' : "download", 'lid' : self.info['fileid']}) @@ -136,7 +134,7 @@ class ShareonlineBiz(SimpleHoster): key, value = line.split(": ") dlinfo[key.lower()] = value - self.logDebug(dlinfo) + self.log_debug(dlinfo) if not dlinfo['status'] == "online": self.offline() @@ -147,12 +145,12 @@ class ShareonlineBiz(SimpleHoster): self.link = dlinfo['url'] if self.link == "server_under_maintenance": - self.tempOffline() + self.temp_offline() else: self.multiDL = True - def checkErrors(self): + def check_errors(self): m = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL) if m is None: self.info.pop('error', None) @@ -161,11 +159,11 @@ class ShareonlineBiz(SimpleHoster): errmsg = m.group(1).lower() try: - self.logError(errmsg, re.search(self.ERROR_PATTERN, self.html).group(1)) + self.log_error(errmsg, re.search(self.ERROR_PATTERN, self.html).group(1)) except Exception: - self.logError("Unknown error occurred", errmsg) + self.log_error(_("Unknown error occurred"), errmsg) - if errmsg is "invalid": + if errmsg == "invalid": self.fail(_("File not available")) elif errmsg in ("freelimit", "size", "proxy"): @@ -174,6 +172,9 @@ class ShareonlineBiz(SimpleHoster): elif errmsg in ("expired", "server"): self.retry(wait_time=600, reason=errmsg) + elif errmsg == "full": + self.retry(10, 600, _("Server is full")) + elif 'slot' in errmsg: self.wantReconnect = True self.retry(24, 3600, errmsg) diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index babd0d1d4..11aef0c90 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -3,13 +3,14 @@ import re import urllib -from module.plugins.Hoster import Hoster +from module.plugins.internal.Hoster import Hoster class ShareplaceCom(Hoster): __name__ = "ShareplaceCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.14" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?shareplace\.(com|org)/\?\w+' @@ -30,16 +31,14 @@ class ShareplaceCom(Hoster): self.pyfile.name = self.get_file_name() - wait_time = self.get_waiting_time() - self.setWait(wait_time) - self.wait() + self.wait(self.get_waiting_time()) def get_waiting_time(self): if not self.html: self.download_html() - #var zzipitime = 15; + #: var zzipitime = 15 m = re.search(r'var zzipitime = (\d+);', self.html) if m: sec = int(m.group(1)) @@ -51,11 +50,12 @@ class ShareplaceCom(Hoster): def download_html(self): url = re.sub("shareplace.com\/\?", "shareplace.com//index1.php/?a=", self.pyfile.url) - self.html = self.load(url, decode=True) + self.html = self.load(url) def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ url = re.search(r"var beer = '(.*?)';", self.html) if url: @@ -63,7 +63,7 @@ class ShareplaceCom(Hoster): url = urllib.unquote( url.replace("http://http:/", "").replace("vvvvvvvvv", "").replace("lllllllll", "").replace( "teletubbies", "")) - self.logDebug("URL: %s" % url) + self.log_debug("URL: %s" % url) return url else: self.error(_("Absolute filepath not found")) @@ -77,7 +77,8 @@ class ShareplaceCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/SharingmatrixCom.py b/module/plugins/hoster/SharingmatrixCom.py index 3958ebbd6..e6d5d4ab8 100644 --- a/module/plugins/hoster/SharingmatrixCom.py +++ b/module/plugins/hoster/SharingmatrixCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class SharingmatrixCom(DeadHoster): __name__ = "SharingmatrixCom" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?sharingmatrix\.com/file/\w+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/ShragleCom.py b/module/plugins/hoster/ShragleCom.py index 689223322..1313ba0e0 100644 --- a/module/plugins/hoster/ShragleCom.py +++ b/module/plugins/hoster/ShragleCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class ShragleCom(DeadHoster): __name__ = "ShragleCom" __type__ = "hoster" - __version__ = "0.22" + __version__ = "0.23" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?(cloudnator|shragle)\.com/files/(?P<ID>.+?)/' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index b3f52bc8c..be1578bfb 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -3,16 +3,18 @@ import re from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.SimpleHoster import secondsToMidnight +from module.plugins.internal.SimpleHoster import seconds_to_midnight class SimplyPremiumCom(MultiHoster): __name__ = "SimplyPremiumCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.10" + __status__ = "testing" __pattern__ = r'https?://.+simply-premium\.com' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Simply-Premium.com multi-hoster plugin""" __license__ = "GPLv3" @@ -20,10 +22,10 @@ class SimplyPremiumCom(MultiHoster): def setup(self): - self.chunkLimit = 16 + self.chunk_limit = 16 - def checkErrors(self): + 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) @@ -33,30 +35,30 @@ class SimplyPremiumCom(MultiHoster): self.offline() elif "downloadlimit" in self.html: - self.logWarning(_("Reached maximum connctions")) + self.log_warning(_("Reached maximum connctions")) self.retry(5, 60, _("Reached maximum connctions")) elif "trafficlimit" in self.html: - self.logWarning(_("Reached daily limit for this host")) - self.retry(wait_time=secondsToMidnight(gmt=2), reason="Daily limit for this host reached") + 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") elif "hostererror" in self.html: - self.logWarning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) + self.log_warning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) self.retry(5, 60, _("Hoster is temporarily unavailable")) - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): for i in xrange(5): self.html = self.load("http://www.simply-premium.com/premium.php", get={'info': "", 'link': self.pyfile.url}) if self.html: - self.logDebug("JSON data: " + self.html) + self.log_debug("JSON data: " + self.html) break else: - self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) + self.log_info(_("Unable to get API data, waiting 1 minute and retry")) self.retry(5, 60, _("Unable to get API data")) - self.checkErrors() + self.check_errors() try: self.pyfile.name = re.search(r'<name>([^<]+)</name>', self.html).group(1) diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py index aae71d983..829609228 100644 --- a/module/plugins/hoster/SimplydebridCom.py +++ b/module/plugins/hoster/SimplydebridCom.py @@ -8,18 +8,20 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo, rep class SimplydebridCom(MultiHoster): __name__ = "SimplydebridCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.20" + __status__ = "testing" __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd\.php' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Simply-debrid.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - def handlePremium(self, pyfile): - #fix the links for simply-debrid.com! + def handle_premium(self, pyfile): + #: Fix the links for simply-debrid.com! self.link = replace_patterns(pyfile.url, [("clz.to", "cloudzer.net/file") ("http://share-online", "http://www.share-online") ("ul.to", "uploaded.net/file") @@ -39,11 +41,11 @@ class SimplydebridCom(MultiHoster): self.wait(5) - def checkFile(self, rules={}): - if self.checkDownload({"error": "No address associated with hostname"}): + def check_file(self): + if self.check_download({'error': "No address associated with hostname"}): self.retry(24, 3 * 60, _("Bad file downloaded")) - return super(SimplydebridCom, self).checkFile(rules) + return super(SimplydebridCom, self).check_file() getInfo = create_getInfo(SimplydebridCom) diff --git a/module/plugins/hoster/SizedriveCom.py b/module/plugins/hoster/SizedriveCom.py index 3b9748fb6..8bfe46e86 100644 --- a/module/plugins/hoster/SizedriveCom.py +++ b/module/plugins/hoster/SizedriveCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class SizedriveCom(SimpleHoster): __name__ = "SizedriveCom" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?sizedrive\.com/[rd]/(?P<ID>\w+)' @@ -23,12 +24,12 @@ class SizedriveCom(SimpleHoster): def setup(self): - self.resumeDownload = False + self.resume_download = False self.multiDL = False - self.chunkLimit = 1 + self.chunk_limit = 1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): self.wait(5) self.html = self.load("http://www.sizedrive.com/getdownload.php", post={'id': self.info['pattern']['ID']}) diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py index 9ae12f145..33d098a00 100644 --- a/module/plugins/hoster/SmoozedCom.py +++ b/module/plugins/hoster/SmoozedCom.py @@ -7,58 +7,56 @@ from module.plugins.internal.MultiHoster import MultiHoster class SmoozedCom(MultiHoster): __name__ = "SmoozedCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.08" + __status__ = "testing" - __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Smoozed.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("", "")] - def handleFree(self, pyfile): - # In some cases hostsers do not supply us with a filename at download, so we - # are going to set a fall back filename (e.g. for freakshare or xfileshare) - pyfile.name = pyfile.name.split('/').pop() # Remove everthing before last slash + FILE_ERRORS = [("Error", r'{"state":"error"}'), + ("Retry", r'{"state":"retry"}')] - # Correction for automatic assigned filename: Removing html at end if needed + + def handle_free(self, pyfile): + #: In some cases hostsers do not supply us with a filename at download, so we + #: Are going to set a fall back filename (e.g. for freakshare or xfileshare) + pyfile.name = pyfile.name.split('/').pop() #: Remove everthing before last slash + + #: Correction for automatic assigned filename: Removing html at end if needed suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"] temp = pyfile.name.split('.') if temp.pop() in suffix_to_remove: pyfile.name = ".".join(temp) - # Check the link - get_data = {'session_key': self.account.getAccountInfo(self.user)['session'], + #: Check the link + get_data = {'session_key': self.account.get_data(self.user)['session'], 'url' : pyfile.url} data = json_loads(self.load("http://www2.smoozed.com/api/check", get=get_data)) - if data["state"] != "ok": - self.fail(data["message"]) + if data['state'] != "ok": + self.fail(data['message']) - if data["data"].get("state", "ok") != "ok": - if data["data"] == "Offline": + if data['data'].get("state", "ok") != "ok": + if data['data'] == "Offline": self.offline() else: - self.fail(data["data"]["message"]) + self.fail(data['data']['message']) - pyfile.name = data["data"]["name"] - pyfile.size = int(data["data"]["size"]) + pyfile.name = data['data']['name'] + pyfile.size = int(data['data']['size']) - # Start the download + #: Start the download header = self.load("http://www2.smoozed.com/api/download", get=get_data, just_header=True) if not "location" in header: self.fail(_("Unable to initialize download")) else: - self.link = header["location"][-1] if isinstance(header["location"], list) else header["location"] - - - def checkFile(self, rules={}): - if self.checkDownload({'error': '{"state":"error"}', - 'retry': '{"state":"retry"}'}): - self.fail(_("Error response received")) - - return super(SmoozedCom, self).checkFile(rules) + self.link = header['location'][-1] if isinstance(header['location'], list) else header['location'] diff --git a/module/plugins/hoster/SockshareCom.py b/module/plugins/hoster/SockshareCom.py index 44eedf9d4..b45a22b72 100644 --- a/module/plugins/hoster/SockshareCom.py +++ b/module/plugins/hoster/SockshareCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class SockshareCom(DeadHoster): __name__ = "SockshareCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?sockshare\.com/(mobile/)?(file|embed)/(?P<ID>\w+)' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/SolidfilesCom.py b/module/plugins/hoster/SolidfilesCom.py index d359577d6..16e23045b 100644 --- a/module/plugins/hoster/SolidfilesCom.py +++ b/module/plugins/hoster/SolidfilesCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # Test links: -# http://www.solidfiles.com/d/609cdb4b1b +# http://www.solidfiles.com/d/609cdb4b1b from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -9,7 +9,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class SolidfilesCom(SimpleHoster): __name__ = "SolidfilesCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?solidfiles\.com\/d/\w+' @@ -27,7 +28,7 @@ class SolidfilesCom(SimpleHoster): def setup(self): self.multiDL = True - self.chunkLimit = 1 + self.chunk_limit = 1 getInfo = create_getInfo(SolidfilesCom) diff --git a/module/plugins/hoster/SoundcloudCom.py b/module/plugins/hoster/SoundcloudCom.py index 8dff4f42a..b189ee1ba 100644 --- a/module/plugins/hoster/SoundcloudCom.py +++ b/module/plugins/hoster/SoundcloudCom.py @@ -9,7 +9,8 @@ from module.common.json_layer import json_loads class SoundcloudCom(SimpleHoster): __name__ = "SoundcloudCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?soundcloud\.com/[\w-]+/[\w-]+' __config__ = [("use_premium", "bool" , "Use premium account if available", True ), @@ -24,7 +25,7 @@ class SoundcloudCom(SimpleHoster): OFFLINE_PATTERN = r'<title>"SoundCloud - Hear the worldâs sounds"</title>' - def handleFree(self, pyfile): + def handle_free(self, pyfile): try: song_id = re.search(r'sounds:(\d+)"', self.html).group(1) @@ -37,19 +38,19 @@ class SoundcloudCom(SimpleHoster): except Exception: client_id = "b45b1aa10f1ac2941910a7f0d10f8e28" - # url to retrieve the actual song url + #: Url to retrieve the actual song url streams = json_loads(self.load("https://api.soundcloud.com/tracks/%s/streams" % song_id, get={'client_id': client_id})) regex = re.compile(r'[^\d]') - http_streams = sorted([(key, value) for key, value in streams.iteritems() if key.startswith('http_')], + http_streams = sorted([(key, value) for key, value in streams.items() if key.startswith('http_')], key=lambda t: regex.sub(t[0], ''), reverse=True) - self.logDebug("Streams found: %s" % (http_streams or "None")) + self.log_debug("Streams found: %s" % (http_streams or "None")) if http_streams: - stream_name, self.link = http_streams[0 if self.getConfig('quality') == "Higher" else -1] + stream_name, self.link = http_streams[0 if self.get_config('quality') == "Higher" else -1] pyfile.name += '.' + stream_name.split('_')[1].lower() diff --git a/module/plugins/hoster/SpeedLoadOrg.py b/module/plugins/hoster/SpeedLoadOrg.py index 18f04b611..abba1be79 100644 --- a/module/plugins/hoster/SpeedLoadOrg.py +++ b/module/plugins/hoster/SpeedLoadOrg.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class SpeedLoadOrg(DeadHoster): __name__ = "SpeedLoadOrg" __type__ = "hoster" - __version__ = "1.02" + __version__ = "1.03" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?speedload\.org/(?P<ID>\w+)' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/SpeedfileCz.py b/module/plugins/hoster/SpeedfileCz.py index cd6d65082..75a55d490 100644 --- a/module/plugins/hoster/SpeedfileCz.py +++ b/module/plugins/hoster/SpeedfileCz.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class SpeedfileCz(DeadHoster): __name__ = "SpeedFileCz" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.33" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?speedfile\.cz/.+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/SpeedyshareCom.py b/module/plugins/hoster/SpeedyshareCom.py index 91788b2c8..7d7a60f04 100644 --- a/module/plugins/hoster/SpeedyshareCom.py +++ b/module/plugins/hoster/SpeedyshareCom.py @@ -12,7 +12,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class SpeedyshareCom(SimpleHoster): __name__ = "SpeedyshareCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(speedyshare\.com|speedy\.sh)/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -32,10 +33,10 @@ class SpeedyshareCom(SimpleHoster): def setup(self): self.multiDL = False - self.chunkLimit = 1 + self.chunk_limit = 1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.link = m.group(1) diff --git a/module/plugins/hoster/StorageTo.py b/module/plugins/hoster/StorageTo.py index feb9f3300..3d0852204 100644 --- a/module/plugins/hoster/StorageTo.py +++ b/module/plugins/hoster/StorageTo.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class StorageTo(DeadHoster): __name__ = "StorageTo" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?storage\.to/get/.+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 97bed8109..a5578fd96 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -2,18 +2,18 @@ import re -from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL as get_url +from module.plugins.internal.Hoster import Hoster -def getInfo(urls): +def get_info(urls): result = [] for url in urls: - html = getURL(url) + html = get_url(url) if re.search(StreamCz.OFFLINE_PATTERN, html): - # File offline + #: File offline result.append((url, 0, 1, url)) else: result.append((url, 0, 2, url)) @@ -23,7 +23,8 @@ def getInfo(urls): class StreamCz(Hoster): __name__ = "StreamCz" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.22" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?stream\.cz/[^/]+/\d+' @@ -39,12 +40,12 @@ class StreamCz(Hoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True def process(self, pyfile): - self.html = self.load(pyfile.url, decode=True) + self.html = self.load(pyfile.url) if re.search(self.OFFLINE_PATTERN, self.html): self.offline() @@ -53,7 +54,7 @@ class StreamCz(Hoster): if m is None: self.error(_("CDN_PATTERN not found")) cdn = m.groupdict() - self.logDebug(cdn) + self.log_debug(cdn) for cdnkey in ("cdnHD", "cdnHQ", "cdnLQ"): if cdnkey in cdn and cdn[cdnkey] > '': cdnid = cdn[cdnkey] @@ -67,5 +68,5 @@ class StreamCz(Hoster): pyfile.name = "%s-%s.%s.mp4" % (m.group(2), m.group(1), cdnkey[-2:]) download_url = "http://cdn-dispatcher.stream.cz/?id=" + cdnid - self.logInfo(_("STREAM: %s") % cdnkey[-2:], download_url) + self.log_info(_("STREAM: %s") % cdnkey[-2:], download_url) self.download(download_url) diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py index 0f8c08ad9..97cde6e92 100644 --- a/module/plugins/hoster/StreamcloudEu.py +++ b/module/plugins/hoster/StreamcloudEu.py @@ -8,7 +8,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class StreamcloudEu(XFSHoster): __name__ = "StreamcloudEu" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.11" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?streamcloud\.eu/\w{12}' @@ -22,8 +23,8 @@ class StreamcloudEu(XFSHoster): def setup(self): self.multiDL = True - self.chunkLimit = 1 - self.resumeDownload = self.premium + self.chunk_limit = 1 + self.resume_download = self.premium getInfo = create_getInfo(StreamcloudEu) diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index 254e06c2a..d323a214b 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -9,20 +9,20 @@ import urllib from Crypto.Cipher import ARC4 -from module.network.RequestFactory import getURL -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp class TurbobitNet(SimpleHoster): __name__ = "TurbobitNet" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """ Turbobit.net hoster plugin """ + __description__ = """Turbobit.net hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), ("prOq", None)] @@ -42,17 +42,16 @@ class TurbobitNet(SimpleHoster): CAPTCHA_PATTERN = r'<img alt="Captcha" src="(.+?)"' - def handleFree(self, pyfile): - self.html = self.load("http://turbobit.net/download/free/%s" % self.info['pattern']['ID'], - decode=True) + def handle_free(self, pyfile): + self.html = self.load("http://turbobit.net/download/free/%s" % self.info['pattern']['ID']) - rtUpdate = self.getRtUpdate() + rtUpdate = self.get_rt_update() - self.solveCaptcha() + self.solve_captcha() self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - self.html = self.load(self.getDownloadUrl(rtUpdate)) + self.html = self.load(self.get_download_url(rtUpdate)) self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With:"]) @@ -61,7 +60,7 @@ class TurbobitNet(SimpleHoster): self.link = m.group(1) - def solveCaptcha(self): + def solve_captcha(self): for _i in xrange(5): m = re.search(self.LIMIT_WAIT_PATTERN, self.html) if m: @@ -69,12 +68,12 @@ class TurbobitNet(SimpleHoster): self.wait(wait_time, wait_time > 60) self.retry() - action, inputs = self.parseHtmlForm("action='#'") + action, inputs = self.parse_html_form("action='#'") if not inputs: self.error(_("Captcha form not found")) - self.logDebug(inputs) + self.log_debug(inputs) - if inputs['captcha_type'] == 'recaptcha': + if inputs['captcha_type'] == "recaptcha": recaptcha = ReCaptcha(self) inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() else: @@ -82,44 +81,44 @@ class TurbobitNet(SimpleHoster): if m is None: self.error(_("captcha")) captcha_url = m.group(1) - inputs['captcha_response'] = self.decryptCaptcha(captcha_url) + inputs['captcha_response'] = self.captcha.decrypt(captcha_url) - self.logDebug(inputs) + self.log_debug(inputs) self.html = self.load(self.url, post=inputs) if '<div class="captcha-error">Incorrect, try again!<' in self.html: - self.invalidCaptcha() + self.captcha.invalid() else: - self.correctCaptcha() + self.captcha.correct() break else: self.fail(_("Invalid captcha")) - def getRtUpdate(self): - rtUpdate = self.getStorage("rtUpdate") + def get_rt_update(self): + rtUpdate = self.retrieve("rtUpdate") if not rtUpdate: - if self.getStorage("version") != self.__version__ \ - or int(self.getStorage("timestamp", 0)) + 86400000 < timestamp(): - # that's right, we are even using jdownloader updates - rtUpdate = getURL("http://update0.jdownloader.org/pluginstuff/tbupdate.js") + 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 + #: 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.setStorage("rtUpdate", rtUpdate) - self.setStorage("timestamp", timestamp()) - self.setStorage("version", self.__version__) + self.store("rtUpdate", rtUpdate) + self.store("timestamp", timestamp()) + self.store("version", self.__version__) else: - self.logError(_("Unable to download, wait for update...")) - self.tempOffline() + self.log_error(_("Unable to download, wait for update...")) + self.temp_offline() return rtUpdate - def getDownloadUrl(self, rtUpdate): + def get_download_url(self, rtUpdate): self.req.http.lastURL = self.url m = re.search("(/\w+/timeout\.js\?\w+=)([^\"\'<>]+)", self.html) @@ -130,7 +129,7 @@ class TurbobitNet(SimpleHoster): fun = self.load(url) - self.setWait(65, False) + self.set_wait(65, False) for b in [1, 3]: self.jscode = "var id = \'%s\';var b = %d;var inn = \'%s\';%sout" % ( @@ -138,16 +137,16 @@ class TurbobitNet(SimpleHoster): try: out = self.js.eval(self.jscode) - self.logDebug("URL", self.js.engine, out) + self.log_debug("URL", self.js.engine, out) if out.startswith('/download/'): return "http://turbobit.net%s" % out.strip() except Exception, e: - self.logError(e) + self.log_error(e) else: if self.retries >= 2: - # retry with updated js - self.delStorage("rtUpdate") + #: Retry with updated js + self.delete("rtUpdate") else: self.retry() @@ -159,7 +158,7 @@ class TurbobitNet(SimpleHoster): return binascii.unhexlify(cipher.encrypt(binascii.unhexlify(data))) - def getLocalTimeString(self): + def get_local_time_string(self): lt = time.localtime() tz = time.altzone if lt.tm_isdst else time.timezone return "%s GMT%+03d%02d" % (time.strftime("%a %b %d %Y %H:%M:%S", lt), -tz // 3600, tz % 3600) diff --git a/module/plugins/hoster/TurbouploadCom.py b/module/plugins/hoster/TurbouploadCom.py index e4b53b818..ffb88d53b 100644 --- a/module/plugins/hoster/TurbouploadCom.py +++ b/module/plugins/hoster/TurbouploadCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class TurbouploadCom(DeadHoster): __name__ = "TurbouploadCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?turboupload\.com/(\w+)' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/TusfilesNet.py b/module/plugins/hoster/TusfilesNet.py index 6021a4c30..8fadb41c3 100644 --- a/module/plugins/hoster/TusfilesNet.py +++ b/module/plugins/hoster/TusfilesNet.py @@ -1,13 +1,15 @@ # -*- coding: utf-8 -*- from module.network.HTTPRequest import BadHeader +from module.plugins.internal.Plugin import Retry from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class TusfilesNet(XFSHoster): __name__ = "TusfilesNet" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.12" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?tusfiles\.net/\w{12}' @@ -18,21 +20,20 @@ class TusfilesNet(XFSHoster): INFO_PATTERN = r'\](?P<N>.+) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)\[' - OFFLINE_PATTERN = r'>File Not Found|<Title>TusFiles - Fast Sharing Files!|The file you are trying to download is no longer available' def setup(self): - self.chunkLimit = -1 + self.chunk_limit = -1 self.multiDL = True - self.resumeDownload = True + self.resume_download = True - def downloadLink(self, link, disposition=True): + def download(self, url, *args, **kwargs): try: - return super(TusfilesNet, self).downloadLink(link, disposition) + return super(TusfilesNet, self).download(url, *args, **kwargs) except BadHeader, e: - if e.code is 503: + if e.code == 503: self.multiDL = False raise Retry("503") diff --git a/module/plugins/hoster/TwoSharedCom.py b/module/plugins/hoster/TwoSharedCom.py index 086228637..1335bafae 100644 --- a/module/plugins/hoster/TwoSharedCom.py +++ b/module/plugins/hoster/TwoSharedCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class TwoSharedCom(SimpleHoster): __name__ = "TwoSharedCom" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?2shared\.com/(account/)?(download|get|file|document|photo|video|audio)/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -26,7 +27,7 @@ class TwoSharedCom(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index b43ff8d92..b402433a4 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -7,15 +7,16 @@ from module.common.json_layer import json_loads from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -def convertDecimalPrefix(m): - # decimal prefixes used in filesize and traffic +def convert_decimal_prefix(m): + #: Decimal prefixes used in filesize and traffic return ("%%.%df" % {'k': 3, 'M': 6, 'G': 9}[m.group(2)] % float(m.group(1))).replace('.', '') class UlozTo(SimpleHoster): __name__ = "UlozTo" __type__ = "hoster" - __version__ = "1.09" + __version__ = "1.13" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -31,10 +32,9 @@ class UlozTo(SimpleHoster): OFFLINE_PATTERN = r'<title>404 - Page not found</title>|<h1 class="h1">File (has been deleted|was banned)</h1>' URL_REPLACEMENTS = [(r'(?<=http://)([^/]+)', "www.ulozto.net")] - SIZE_REPLACEMENTS = [(r'([\d.]+)\s([kMG])B', convertDecimalPrefix)] + SIZE_REPLACEMENTS = [(r'([\d.]+)\s([kMG])B', convert_decimal_prefix)] CHECK_TRAFFIC = True - DISPOSITION = False #: Remove in 0.4.10 ADULT_PATTERN = r'<form action="(.+?)" method="post" id="frm-askAgeForm">' PASSWD_PATTERN = r'<div class="passwordProtectedFile">' @@ -43,37 +43,37 @@ class UlozTo(SimpleHoster): def setup(self): - self.chunkLimit = 16 if self.premium else 1 + self.chunk_limit = 16 if self.premium else 1 self.multiDL = True - self.resumeDownload = True + self.resume_download = True - def handleFree(self, pyfile): - action, inputs = self.parseHtmlForm('id="frm-downloadDialog-freeDownloadForm"') + def handle_free(self, pyfile): + action, inputs = self.parse_html_form('id="frm-downloadDialog-freeDownloadForm"') if not action or not inputs: self.error(_("Free download form not found")) - self.logDebug("inputs.keys = " + str(inputs.keys())) - # get and decrypt captcha + self.log_debug("inputs.keys = " + str(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 - self.logDebug('Using "old" version') + #: Old version - last seen 9.12.2013 + self.log_debug('Using "old" version') - captcha_value = self.decryptCaptcha("http://img.uloz.to/captcha/%s.png" % inputs['captcha_id']) - self.logDebug("CAPTCHA ID: " + inputs['captcha_id'] + ", CAPTCHA VALUE: " + captcha_value) + captcha_value = self.captcha.decrypt("http://img.uloz.to/captcha/%s.png" % inputs['captcha_id']) + self.log_debug("CAPTCHA ID: " + inputs['captcha_id'] + ", CAPTCHA VALUE: " + captcha_value) inputs.update({'captcha_id': inputs['captcha_id'], 'captcha_key': inputs['captcha_key'], 'captcha_value': captcha_value}) elif all(key in inputs for key in ("captcha_value", "timestamp", "salt", "hash")): - # New version - better to get new parameters (like captcha reload) because of image url - since 6.12.2013 - self.logDebug('Using "new" version') + #: 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.logDebug("xapca = " + str(xapca)) + self.log_debug("xapca = " + str(xapca)) data = json_loads(xapca) - captcha_value = self.decryptCaptcha(str(data['image'])) - self.logDebug("CAPTCHA HASH: " + data['hash'], "CAPTCHA SALT: " + str(data['salt']), "CAPTCHA VALUE: " + captcha_value) + captcha_value = self.captcha.decrypt(str(data['image'])) + self.log_debug("CAPTCHA HASH: " + data['hash'], "CAPTCHA SALT: " + str(data['salt']), "CAPTCHA VALUE: " + captcha_value) inputs.update({'timestamp': data['timestamp'], 'salt': data['salt'], 'hash': data['hash'], 'captcha_value': captcha_value}) @@ -83,13 +83,13 @@ class UlozTo(SimpleHoster): self.download("http://www.ulozto.net" + action, post=inputs) - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): self.download(pyfile.url, get={'do': "directDownload"}) - def checkErrors(self): + def check_errors(self): if re.search(self.ADULT_PATTERN, self.html): - self.logInfo(_("Adult content confirmation needed")) + self.log_info(_("Adult content confirmation needed")) m = re.search(self.TOKEN_PATTERN, self.html) if m is None: @@ -97,16 +97,16 @@ class UlozTo(SimpleHoster): self.html = self.load(pyfile.url, get={'do': "askAgeForm-submit"}, - post={"agree": "Confirm", "_token_": m.group(1)}) + post={'agree': "Confirm", '_token_': m.group(1)}) if self.PASSWD_PATTERN in self.html: - password = self.getPassword() + password = self.get_password() if password: - self.logInfo(_("Password protected link, trying ") + password) + self.log_info(_("Password protected link, trying ") + password) self.html = self.load(pyfile.url, get={'do': "passwordProtectedForm-submit"}, - post={"password": password, "password_send": 'Send'}) + post={'password': password, 'password_send': 'Send'}) if self.PASSWD_PATTERN in self.html: self.fail(_("Incorrect password")) @@ -116,20 +116,20 @@ class UlozTo(SimpleHoster): if re.search(self.VIPLINK_PATTERN, self.html): self.html = self.load(pyfile.url, get={'disclaimer': "1"}) - return super(UlozTo, self).checkErrors() + return super(UlozTo, self).check_errors() - def checkFile(self, rules={}): - check = self.checkDownload({ - "wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'), - "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. - "not_found" : "<title>UloÅŸ.to</title>" + def check_file(self): + check = self.check_download({ + 'wrong_captcha': re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'), + '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. + 'not_found' : "<title>UloÅŸ.to</title>" }) if check == "wrong_captcha": - self.invalidCaptcha() + self.captcha.invalid() self.retry(reason=_("Wrong captcha code")) elif check == "offline": @@ -139,7 +139,7 @@ class UlozTo(SimpleHoster): self.fail(_("Wrong password")) elif check == "server_error": - self.logError(_("Server error, try downloading later")) + self.log_error(_("Server error, try downloading later")) self.multiDL = False self.wait(1 * 60 * 60, True) self.retry() @@ -147,7 +147,7 @@ class UlozTo(SimpleHoster): elif check == "not_found": self.fail(_("Server error, file not downloadable")) - return super(UlozTo, self).checkFile(rules) + return super(UlozTo, self).check_file() getInfo = create_getInfo(UlozTo) diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index ad809b47c..7cbcb4d40 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -9,7 +9,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UloziskoSk(SimpleHoster): __name__ = "UloziskoSk" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?ulozisko\.sk/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -30,17 +31,17 @@ class UloziskoSk(SimpleHoster): def process(self, pyfile): - self.html = self.load(pyfile.url, decode=True) - self.getFileInfo() + self.html = self.load(pyfile.url) + self.get_fileInfo() m = re.search(self.IMG_PATTERN, self.html) if m: self.link = "http://ulozisko.sk" + m.group(1) else: - self.handleFree(pyfile) + self.handle_free(pyfile) - def handleFree(self, pyfile): + def handle_free(self, pyfile): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("LINK_FREE_PATTERN not found")) @@ -51,22 +52,22 @@ class UloziskoSk(SimpleHoster): self.error(_("ID_PATTERN not found")) id = m.group(1) - self.logDebug("URL:" + parsed_url + ' ID:' + id) + self.log_debug("URL:" + parsed_url + ' ID:' + id) m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: self.error(_("CAPTCHA_PATTERN not found")) captcha_url = urlparse.urljoin("http://www.ulozisko.sk", m.group(1)) - captcha = self.decryptCaptcha(captcha_url, cookies=True) + captcha = self.captcha.decrypt(captcha_url, cookies=True) - self.logDebug("CAPTCHA_URL:" + captcha_url + ' CAPTCHA:' + captcha) + self.log_debug("CAPTCHA_URL:" + captcha_url + ' CAPTCHA:' + captcha) self.download(parsed_url, - post={"antispam": captcha, - "id" : id, - "name" : pyfile.name, - "but" : "++++STIAHNI+S%DABOR++++"}) + post={'antispam': captcha, + 'id' : id, + 'name' : pyfile.name, + 'but' : "++++STIAHNI+S%DABOR++++"}) getInfo = create_getInfo(UloziskoSk) diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index d090c8e7d..ac2589f47 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -10,7 +10,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UnibytesCom(SimpleHoster): __name__ = "UnibytesCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.14" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?unibytes\.com/[\w .-]{11}B' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -28,14 +29,14 @@ class UnibytesCom(SimpleHoster): LINK_FREE_PATTERN = r'<a href="(.+?)">Download</a>' - def handleFree(self, pyfile): + def handle_free(self, pyfile): domain = "http://www.%s/" % self.HOSTER_DOMAIN - action, post_data = self.parseHtmlForm('id="startForm"') + action, post_data = self.parse_html_form('id="startForm"') self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) for _i in xrange(8): - self.logDebug(action, post_data) + self.log_debug(action, post_data) self.html = self.load(urlparse.urljoin(domain, action), post=post_data) m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) @@ -47,24 +48,24 @@ class UnibytesCom(SimpleHoster): self.wait(10 * 60, True) self.retry() - if post_data['step'] == 'last': + if post_data['step'] == "last": m = re.search(self.LINK_FREE_PATTERN, self.html) if m: self.link = m.group(1) - self.correctCaptcha() + self.captcha.correct() break else: - self.invalidCaptcha() + self.captcha.invalid() last_step = post_data['step'] - action, post_data = self.parseHtmlForm('id="stepForm"') + action, post_data = self.parse_html_form('id="stepForm"') - if last_step == 'timer': + if last_step == "timer": m = re.search(self.WAIT_PATTERN, self.html) self.wait(m.group(1) if m else 60, False) elif last_step in ("captcha", "last"): - post_data['captcha'] = self.decryptCaptcha(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/UnrestrictLi.py b/module/plugins/hoster/UnrestrictLi.py index b63796fe0..082ad3e02 100644 --- a/module/plugins/hoster/UnrestrictLi.py +++ b/module/plugins/hoster/UnrestrictLi.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class UnrestrictLi(DeadHoster): __name__ = "UnrestrictLi" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.24" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(unrestrict|unr)\.li/dl/[\w^_]+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index 9d460ef98..db9517f42 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -9,7 +9,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class UpleaCom(XFSHoster): __name__ = "UpleaCom" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.12" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?uplea\.com/dl/\w{15}' @@ -19,8 +20,6 @@ class UpleaCom(XFSHoster): ("GammaC0de", None)] - DISPOSITION = False #@TODO: Remove in 0.4.10 - HOSTER_DOMAIN = "uplea.com" SIZE_REPLACEMENTS = [('ko','KB'), ('mo','MB'), ('go','GB'), ('Ko','KB'), ('Mo','MB'), ('Go','GB')] @@ -38,11 +37,11 @@ class UpleaCom(XFSHoster): def setup(self): self.multiDL = False - self.chunkLimit = 1 - self.resumeDownload = True + self.chunk_limit = 1 + self.resume_download = True - def handleFree(self, pyfile): + def handle_free(self, pyfile): m = re.search(self.STEP_PATTERN, self.html) if m is None: self.error(_("STEP_PATTERN not found")) @@ -51,7 +50,7 @@ class UpleaCom(XFSHoster): m = re.search(self.WAIT_PATTERN, self.html) if m: - self.logDebug(_("Waiting %s seconds") % m.group(1)) + self.log_debug("Waiting %s seconds" % m.group(1)) self.wait(m.group(1), True) self.retry() diff --git a/module/plugins/hoster/UploadStationCom.py b/module/plugins/hoster/UploadStationCom.py index 61226e3da..36b766b7e 100644 --- a/module/plugins/hoster/UploadStationCom.py +++ b/module/plugins/hoster/UploadStationCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class UploadStationCom(DeadHoster): __name__ = "UploadStationCom" __type__ = "hoster" - __version__ = "0.52" + __version__ = "0.53" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?uploadstation\.com/file/(?P<ID>\w+)' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index f323a3538..88d79e9ba 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -2,14 +2,15 @@ import re -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadableCh(SimpleHoster): __name__ = "UploadableCh" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.12" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?uploadable\.ch/file/(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -32,46 +33,45 @@ class UploadableCh(SimpleHoster): RECAPTCHA_KEY = "6LdlJuwSAAAAAPJbPIoUhyqOJd7-yrah5Nhim5S3" - def handleFree(self, pyfile): - # Click the "free user" button and wait - a = self.load(pyfile.url, post={'downloadLink': "wait"}, decode=True) - self.logDebug(a) + def handle_free(self, pyfile): + #: Click the "free user" button and wait + a = self.load(pyfile.url, post={'downloadLink': "wait"}) + self.log_debug(a) self.wait(30) - # Make the recaptcha appear and show it the pyload interface - b = self.load(pyfile.url, post={'checkDownload': "check"}, decode=True) - self.logDebug(b) #: Expected output: {"success":"showCaptcha"} + #: Make the recaptcha appear and show it the pyload interface + b = self.load(pyfile.url, post={'checkDownload': "check"}) + self.log_debug(b) #: Expected output: {'success': "showCaptcha"} recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) - # Submit the captcha solution + #: Submit the captcha solution self.load("http://www.uploadable.ch/checkReCaptcha.php", post={'recaptcha_challenge_field' : challenge, 'recaptcha_response_field' : response, - 'recaptcha_shortencode_field': self.info['pattern']['ID']}, - decode=True) + 'recaptcha_shortencode_field': self.info['pattern']['ID']}) self.wait(3) - # Get ready for downloading - self.load(pyfile.url, post={'downloadLink': "show"}, decode=True) + #: Get ready for downloading + self.load(pyfile.url, post={'downloadLink': "show"}) self.wait(3) - # Download the file + #: Download the file self.download(pyfile.url, post={'download': "normal"}, disposition=True) - def checkFile(self, rules={}): - if self.checkDownload({'wait': re.compile("Please wait for")}): - self.logInfo("Downloadlimit reached, please wait or reconnect") + def check_file(self): + if self.check_download({'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).checkFile(rules) + return super(UploadableCh, self).check_file() getInfo = create_getInfo(UploadableCh) diff --git a/module/plugins/hoster/UploadboxCom.py b/module/plugins/hoster/UploadboxCom.py index cb4f50184..a1053a413 100644 --- a/module/plugins/hoster/UploadboxCom.py +++ b/module/plugins/hoster/UploadboxCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class UploadboxCom(DeadHoster): __name__ = "Uploadbox" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?uploadbox\.com/files/.+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 16966a23d..c90f2bb0f 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -2,16 +2,18 @@ import re import time +import urlparse -from module.network.RequestFactory import getURL -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.network.RequestFactory import getURL as get_url +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadedTo(SimpleHoster): __name__ = "UploadedTo" __type__ = "hoster" - __version__ = "0.89" + __version__ = "0.96" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -21,28 +23,30 @@ class UploadedTo(SimpleHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - DISPOSITION = False - - API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL" + CHECK_TRAFFIC = True URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g<ID>')] + API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL" + + OFFLINE_PATTERN = r'>Page not found' TEMP_OFFLINE_PATTERN = r'<title>uploaded\.net - Maintenance' + LINK_FREE_PATTERN = r"url:\s*'(.+?)'" LINK_PREMIUM_PATTERN = r'<div class="tfree".*\s*<form method="post" action="(.+?)"' - WAIT_PATTERN = r'Current waiting period: <span>(\d+)' - DL_LIMIT_ERROR = r'You have reached the max. number of possible free downloads for this hour' + WAIT_PATTERN = r'Current waiting period: <span>(\d+)' + DL_LIMIT_PATTERN = r'You have reached the max. number of possible free downloads for this hour' @classmethod - def apiInfo(cls, url): - info = super(UploadedTo, cls).apiInfo(url) + def api_info(cls, url): + info = super(UploadedTo, cls).api_info(url) for _i in xrange(5): - html = getURL("http://uploaded.net/api/filemultiple", - get={"apikey": cls.API_KEY, 'id_0': re.match(cls.__pattern__, url).group('ID')}, - decode=True) + html = get_url("http://uploaded.net/api/filemultiple", + get={'apikey': cls.API_KEY, + 'id_0': re.match(cls.__pattern__, url).group('ID')}) if html != "can't find request": api = html.split(",", 4) @@ -58,42 +62,14 @@ class UploadedTo(SimpleHoster): def setup(self): - self.multiDL = self.resumeDownload = self.premium - self.chunkLimit = 1 # critical problems with more chunks - - - def checkErrors(self): - if 'var free_enabled = false;' in self.html: - self.logError(_("Free-download capacities exhausted")) - self.retry(24, 5 * 60) - - elif "limit-size" in self.html: - self.fail(_("File too big for free download")) - - elif "limit-slot" in self.html: # Temporary restriction so just wait a bit - self.wait(30 * 60, True) - self.retry() - - elif "limit-parallel" in self.html: - self.fail(_("Cannot download in parallel")) + self.multiDL = self.resume_download = self.premium + self.chunk_limit = 1 #: Critical problems with more chunks - elif "limit-dl" in self.html or self.DL_LIMIT_ERROR in self.html: # limit-dl - self.wait(3 * 60 * 60, True) - self.retry() - elif '"err":"captcha"' in self.html: - self.invalidCaptcha() - - else: - m = re.search(self.WAIT_PATTERN, self.html) - if m: - self.wait(m.group(1)) - - - def handleFree(self, pyfile): + def handle_free(self, pyfile): self.load("http://uploaded.net/language/en", just_header=True) - self.html = self.load("http://uploaded.net/js/download.js", decode=True) + self.html = self.load("http://uploaded.net/js/download.js") recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() @@ -102,23 +78,8 @@ class UploadedTo(SimpleHoster): post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) - if "type:'download'" in self.html: - self.correctCaptcha() - try: - self.link = re.search("url:'(.+?)'", self.html).group(1) - - except Exception: - pass - - self.checkErrors() - - - def checkFile(self, rules={}): - if self.checkDownload({'limit-dl': self.DL_LIMIT_ERROR}): - self.wait(3 * 60 * 60, True) - self.retry() - - return super(UploadedTo, self).checkFile(rules) + super(UploadedTo, self).handle_free(pyfile) + self.check_errors() getInfo = create_getInfo(UploadedTo) diff --git a/module/plugins/hoster/UploadhereCom.py b/module/plugins/hoster/UploadhereCom.py index bc94e644e..a3c41e824 100644 --- a/module/plugins/hoster/UploadhereCom.py +++ b/module/plugins/hoster/UploadhereCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class UploadhereCom(DeadHoster): __name__ = "UploadhereCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?uploadhere\.com/\w{10}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index 5c74f10eb..2af0f32fc 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -12,7 +12,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadheroCom(SimpleHoster): __name__ = "UploadheroCom" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.19" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?uploadhero\.com?/dl/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -38,15 +39,15 @@ class UploadheroCom(SimpleHoster): LINK_PREMIUM_PATTERN = r'<a href="(.+?)" id="downloadnow"' - def handleFree(self, pyfile): + def handle_free(self, pyfile): m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: self.error(_("Captcha not found")) - captcha = self.decryptCaptcha(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}) + get={'code': captcha}) m = re.search(self.LINK_FREE_PATTERN, self.html) if m: @@ -54,7 +55,7 @@ class UploadheroCom(SimpleHoster): self.wait(50) - def checkErrors(self): + 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))) @@ -64,7 +65,7 @@ class UploadheroCom(SimpleHoster): self.wait(wait_time, True) self.retry() - return super(UploadheroCom, self).checkErrors() + return super(UploadheroCom, self).check_errors() getInfo = create_getInfo(UploadheroCom) diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index c2e0d2873..36f0c766e 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -4,13 +4,15 @@ 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 class UploadingCom(SimpleHoster): __name__ = "UploadingCom" __type__ = "hoster" - __version__ = "0.40" + __version__ = "0.43" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>\w+)' @@ -21,7 +23,7 @@ class UploadingCom(SimpleHoster): ("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'id="file_title">(?P<N>.+)</' + NAME_PATTERN = r'id="file_title">(?P<N>.+?)</' SIZE_PATTERN = r'size tip_container">(?P<S>[\d.,]+) (?P<U>[\w^_]+)<' OFFLINE_PATTERN = r'(Page|file) not found' @@ -35,16 +37,16 @@ class UploadingCom(SimpleHoster): if not "/get/" in pyfile.url: pyfile.url = pyfile.url.replace("/files", "/files/get") - self.html = self.load(pyfile.url, decode=True) - self.getFileInfo() + self.html = self.load(pyfile.url) + self.get_fileInfo() if self.premium: - self.handlePremium(pyfile) + self.handle_premium(pyfile) else: - self.handleFree(pyfile) + self.handle_free(pyfile) - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): postData = {'action': 'get_link', 'code' : self.info['pattern']['ID'], 'pass' : 'undefined'} @@ -57,11 +59,11 @@ class UploadingCom(SimpleHoster): raise Exception("Plugin defect") - def handleFree(self, pyfile): + def handle_free(self, pyfile): m = re.search('<h2>((Daily )?Download Limit)</h2>', self.html) if m: - pyfile.error = m.group(1) - self.logWarning(pyfile.error) + 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) ajax_url = "http://uploading.com/files/get/?ajax" @@ -72,7 +74,7 @@ class UploadingCom(SimpleHoster): if 'answer' in res and 'wait_time' in res['answer']: wait_time = int(res['answer']['wait_time']) - self.logInfo(_("Waiting %d seconds") % wait_time) + self.log_info(_("Waiting %d seconds") % wait_time) self.wait(wait_time) else: self.error(_("No AJAX/WAIT")) diff --git a/module/plugins/hoster/UploadkingCom.py b/module/plugins/hoster/UploadkingCom.py index 0d60cef1f..54fe47cc8 100644 --- a/module/plugins/hoster/UploadkingCom.py +++ b/module/plugins/hoster/UploadkingCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class UploadkingCom(DeadHoster): __name__ = "UploadkingCom" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?uploadking\.com/\w{10}' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index 6410a2dce..12c667efb 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -2,14 +2,15 @@ import re -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UpstoreNet(SimpleHoster): __name__ = "UpstoreNet" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?upstore\.net/' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -27,39 +28,39 @@ class UpstoreNet(SimpleHoster): LINK_FREE_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>' - def handleFree(self, pyfile): - # STAGE 1: get link to continue + def handle_free(self, pyfile): + #: STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: self.error(_("CHASH_PATTERN not found")) chash = m.group(1) - self.logDebug("Read hash " + chash) - # continue to stage2 + self.log_debug("Read hash " + chash) + #: Continue to stage2 post_data = {'hash': chash, 'free': 'Slow download'} - self.html = self.load(pyfile.url, post=post_data, decode=True) + self.html = self.load(pyfile.url, post=post_data) - # STAGE 2: solv captcha and wait - # first get the infos we need: recaptcha key and wait time + #: STAGE 2: solv captcha and wait + #: First get the infos we need: recaptcha key and wait time recaptcha = ReCaptcha(self) - # try the captcha 5 times + #: Try the captcha 5 times for i in xrange(5): m = re.search(self.WAIT_PATTERN, self.html) if m is None: self.error(_("Wait pattern not found")) wait_time = int(m.group(1)) - # then, do the waiting + #: then, do the waiting self.wait(wait_time) - # then, handle the captcha + #: then, handle the captcha response, challenge = recaptcha.challenge() post_data.update({'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) - self.html = self.load(pyfile.url, post=post_data, decode=True) + self.html = self.load(pyfile.url, post=post_data) - # STAGE 3: get direct link + #: STAGE 3: get direct link m = re.search(self.LINK_FREE_PATTERN, self.html, re.S) if m: break diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py index 2c06558e4..d6baa3990 100644 --- a/module/plugins/hoster/UptoboxCom.py +++ b/module/plugins/hoster/UptoboxCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class UptoboxCom(XFSHoster): __name__ = "UptoboxCom" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(uptobox|uptostream)\.com/\w{12}' @@ -24,8 +25,8 @@ class UptoboxCom(XFSHoster): def setup(self): self.multiDL = True - self.chunkLimit = 1 - self.resumeDownload = True + self.chunk_limit = 1 + self.resume_download = True getInfo = create_getInfo(UptoboxCom) diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index 78da91020..cf206992d 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -2,13 +2,14 @@ import re -from module.plugins.Hoster import Hoster +from module.plugins.internal.Hoster import Hoster class VeehdCom(Hoster): __name__ = "VeehdCom" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.25" + __status__ = "testing" __pattern__ = r'http://veehd\.com/video/\d+_\S+' __config__ = [("filename_spaces", "bool", "Allow spaces in filename", False), @@ -35,7 +36,7 @@ class VeehdCom(Hoster): def download_html(self): url = self.pyfile.url - self.logDebug("Requesting page: %s" % url) + self.log_debug("Requesting page: %s" % url) self.html = self.load(url) @@ -58,17 +59,18 @@ class VeehdCom(Hoster): name = m.group(1) - # replace unwanted characters in filename - if self.getConfig('filename_spaces'): + #: Replace unwanted characters in filename + if self.get_config('filename_spaces'): pattern = '[^\w ]+' else: pattern = '[^\w.]+' - return re.sub(pattern, self.getConfig('replacement_char'), name) + '.avi' + return re.sub(pattern, self.get_config('replacement_char'), name) + '.avi' def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/VeohCom.py b/module/plugins/hoster/VeohCom.py index 57b24623b..7d46ee335 100644 --- a/module/plugins/hoster/VeohCom.py +++ b/module/plugins/hoster/VeohCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class VeohCom(SimpleHoster): __name__ = "VeohCom" __type__ = "hoster" - __version__ = "0.22" + __version__ = "0.23" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?veoh\.com/(tv/)?(watch|videos)/(?P<ID>v\w+)' __config__ = [("use_premium", "bool" , "Use premium account if available", True ), @@ -28,13 +29,13 @@ class VeohCom(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - self.chunkLimit = -1 + self.chunk_limit = -1 - def handleFree(self, pyfile): - quality = self.getConfig('quality') + def handle_free(self, pyfile): + quality = self.get_config('quality') if quality == "Auto": quality = ("High", "Low") @@ -46,7 +47,7 @@ class VeohCom(SimpleHoster): self.link = m.group(1).replace("\\", "") return else: - self.logInfo(_("No %s quality video found") % q.upper()) + self.log_info(_("No %s quality video found") % q.upper()) else: self.fail(_("No video found!")) diff --git a/module/plugins/hoster/VidPlayNet.py b/module/plugins/hoster/VidPlayNet.py index f1a32a897..f9df18c85 100644 --- a/module/plugins/hoster/VidPlayNet.py +++ b/module/plugins/hoster/VidPlayNet.py @@ -9,7 +9,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class VidPlayNet(XFSHoster): __name__ = "VidPlayNet" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?vidplay\.net/\w{12}' diff --git a/module/plugins/hoster/VimeoCom.py b/module/plugins/hoster/VimeoCom.py index a5196cb92..d47677c42 100644 --- a/module/plugins/hoster/VimeoCom.py +++ b/module/plugins/hoster/VimeoCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class VimeoCom(SimpleHoster): __name__ = "VimeoCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(player\.)?vimeo\.com/(video/)?(?P<ID>\d+)' __config__ = [("use_premium", "bool" , "Use premium account if available" , True ), @@ -20,7 +21,7 @@ class VimeoCom(SimpleHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - NAME_PATTERN = r'<title>(?P<N>.+) on Vimeo<' + NAME_PATTERN = r'<title>(?P<N>.+?) on Vimeo<' OFFLINE_PATTERN = r'class="exception_header"' TEMP_OFFLINE_PATTERN = r'Please try again in a few minutes.<' @@ -30,16 +31,16 @@ class VimeoCom(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True - self.chunkLimit = -1 + self.chunk_limit = -1 - def handleFree(self, pyfile): - password = self.getPassword() + def handle_free(self, pyfile): + password = self.get_password() if self.js and 'class="btn iconify_down_b"' in self.html: - html = self.js.eval(self.load(pyfile.url, get={'action': "download", 'password': password}, decode=True)) + html = self.js.eval(self.load(pyfile.url, get={'action': "download", 'password': password})) pattern = r'href="(?P<URL>http://vimeo\.com.+?)".*?\>(?P<QL>.+?) ' else: html = self.load("https://player.vimeo.com/video/" + self.info['pattern']['ID'], get={'password': password}) @@ -47,14 +48,14 @@ class VimeoCom(SimpleHoster): link = dict((l.group('QL').lower(), l.group('URL')) for l in re.finditer(pattern, html)) - if self.getConfig('original'): + if self.get_config('original'): if "original" in link: self.link = link[q] return else: - self.logInfo(_("Original file not downloadable")) + self.log_info(_("Original file not downloadable")) - quality = self.getConfig('quality') + quality = self.get_config('quality') if quality == "Highest": qlevel = ("hd", "sd", "mobile") elif quality == "Lowest": @@ -67,7 +68,7 @@ class VimeoCom(SimpleHoster): self.link = link[q] return else: - self.logInfo(_("No %s quality video found") % q.upper()) + self.log_info(_("No %s quality video found") % q.upper()) else: self.fail(_("No video found!")) diff --git a/module/plugins/hoster/Vipleech4UCom.py b/module/plugins/hoster/Vipleech4UCom.py index 5668e0fad..8eac61341 100644 --- a/module/plugins/hoster/Vipleech4UCom.py +++ b/module/plugins/hoster/Vipleech4UCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class Vipleech4UCom(DeadHoster): __name__ = "Vipleech4UCom" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?vipleech4u\.com/manager\.php' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/VkCom.py b/module/plugins/hoster/VkCom.py new file mode 100644 index 000000000..d0b0b780e --- /dev/null +++ b/module/plugins/hoster/VkCom.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://vk.com/video_ext.php?oid=166335015&id=162608895&hash=b55affa83774504b&hd=1 + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class VkCom(SimpleHoster): + __name__ = "VkCom" + __type__ = "hoster" + __version__ = "0.02" + __status__ = "testing" + + __pattern__ = r"https?://(?:www\.)?vk\.com/video_ext\.php/\?.+" + __config__ = [("quality", "Low;High;Auto", "Quality", "Auto")] + + __description__ = """Vk.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'"md_title":"(?P<N>.+?)"' + OFFLINE_PATTERN = r'<div id="video_ext_msg">' + + LINK_FREE_PATTERN = r'url\d+":"(.+?)"' + + + def handle_free(self, pyfile): + self.link = re.findall(self.LINK_FREE_PATTERN, self.html)[0 if self.get_config('quality') == "Low" else -1] + + +getInfo = create_getInfo(VkCom) diff --git a/module/plugins/hoster/WarserverCz.py b/module/plugins/hoster/WarserverCz.py index 6cb94e57e..a356dccdd 100644 --- a/module/plugins/hoster/WarserverCz.py +++ b/module/plugins/hoster/WarserverCz.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class WarserverCz(DeadHoster): __name__ = "WarserverCz" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?warserver\.cz/stahnout/\d+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index ae670c8d4..0a89363f8 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -2,61 +2,59 @@ import re -from module.network.RequestFactory import getURL +from module.network.RequestFactory import getURL as get_url from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class WebshareCz(SimpleHoster): __name__ = "WebshareCz" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.19" + __status__ = "testing" - __pattern__ = r'https?://(?:www\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)' + __pattern__ = r'https?://(?:www\.)?(en\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """WebShare.cz hoster plugin""" __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it"), - ("rush", "radek.senfeld@gmail.com")] + __authors__ = [("stickell", "l.stickell@yahoo.it "), + ("rush" , "radek.senfeld@gmail.com")] @classmethod - def getInfo(cls, url="", html=""): - info = super(WebshareCz, cls).getInfo(url, html) + def api_info(cls, url): + info = super(WebshareCz, cls).api_info(url) - if url: - info['pattern'] = re.match(cls.__pattern__, url).groupdict() + info['pattern'] = re.match(cls.__pattern__, url).groupdict() - api_data = getURL("https://webshare.cz/api/file_info/", - post={'ident': info['pattern']['ID']}, - decode=True) + api_data = get_url("https://webshare.cz/api/file_info/", + post={'ident': info['pattern']['ID'], 'wst': ""}) - if 'File not found' in api_data: - info['status'] = 1 - else: - info["status"] = 2 - info['name'] = re.search('<name>(.+)</name>', api_data).group(1) or info['name'] - info['size'] = re.search('<size>(.+)</size>', api_data).group(1) or info['size'] + if not re.search(r'<status>OK', api_data): + info['status'] = 1 + else: + info['status'] = 2 + info['name'] = re.search(r'<name>(.+?)<', api_data).group(1) + info['size'] = re.search(r'<size>(.+?)<', api_data).group(1) return info - def handleFree(self, pyfile): - wst = self.account.infos['wst'] if self.account and 'wst' in self.account.infos else "" + def handle_free(self, pyfile): + wst = self.account.get_data(self.user).get('wst', None) if self.account else None - api_data = getURL('https://webshare.cz/api/file_link/', - post={'ident': self.info['pattern']['ID'], 'wst': wst}, - decode=True) + api_data = get_url("https://webshare.cz/api/file_link/", + post={'ident': self.info['pattern']['ID'], 'wst': wst}) - self.logDebug("API data: " + api_data) + self.log_debug("API data: " + api_data) m = re.search('<link>(.+)</link>', api_data) if m: self.link = m.group(1) - def handlePremium(self, pyfile): - return self.handleFree(pyfile) + def handle_premium(self, pyfile): + return self.handle_free(pyfile) getInfo = create_getInfo(WebshareCz) diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py index f11d03ea8..4c3b47b37 100644 --- a/module/plugins/hoster/WrzucTo.py +++ b/module/plugins/hoster/WrzucTo.py @@ -9,7 +9,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class WrzucTo(SimpleHoster): __name__ = "WrzucTo" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?wrzuc\.to/(\w+(\.wt|\.html)|(\w+/?linki/\w+))' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -29,17 +30,17 @@ class WrzucTo(SimpleHoster): self.multiDL = True - def handleFree(self, pyfile): + def handle_free(self, pyfile): data = dict(re.findall(r'(md5|file): "(.*?)"', self.html)) if len(data) != 2: self.error(_("No file ID")) self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) self.req.http.lastURL = pyfile.url - self.load("http://www.wrzuc.to/ajax/server/prepair", post={"md5": data['md5']}) + self.load("http://www.wrzuc.to/ajax/server/prepair", post={'md5': data['md5']}) self.req.http.lastURL = pyfile.url - self.html = self.load("http://www.wrzuc.to/ajax/server/download_link", post={"file": data['file']}) + self.html = self.load("http://www.wrzuc.to/ajax/server/download_link", post={'file': data['file']}) data.update(re.findall(r'"(download_link|server_id)":"(.*?)"', self.html)) if len(data) != 4: diff --git a/module/plugins/hoster/WuploadCom.py b/module/plugins/hoster/WuploadCom.py index 73c008ae8..028e557e9 100644 --- a/module/plugins/hoster/WuploadCom.py +++ b/module/plugins/hoster/WuploadCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class WuploadCom(DeadHoster): __name__ = "WuploadCom" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.24" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?wupload\..+?/file/((\w+/)?\d+)(/.*)?' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/X7To.py b/module/plugins/hoster/X7To.py index 8e2dd3a53..285499807 100644 --- a/module/plugins/hoster/X7To.py +++ b/module/plugins/hoster/X7To.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class X7To(DeadHoster): __name__ = "X7To" __type__ = "hoster" - __version__ = "0.41" + __version__ = "0.42" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?x7\.to/' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 169fbc8d3..8ede709de 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -8,7 +8,8 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class XFileSharingPro(XFSHoster): __name__ = "XFileSharingPro" __type__ = "hoster" - __version__ = "0.46" + __version__ = "0.53" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)' @@ -20,40 +21,54 @@ class XFileSharingPro(XFSHoster): URL_REPLACEMENTS = [("/embed-", "/")] - def _log(self, type, args): - msg = " | ".join(str(a).strip() for a in args if a) - logger = getattr(self.log, type) - logger("%s: %s: %s" % (self.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper()))) + def _log(self, level, plugintype, pluginname, messages): + return super(XFileSharingPro, self)._log(level, + plugintype, + "%s: %s" % (pluginname, self.HOSTER_NAME), + messages) def init(self): - super(XFileSharingPro, self).init() - - self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] + 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 != '.') - - account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) + self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.HOSTER_DOMAIN) if part != '.') - if account and account.canUse(): - self.account = account - elif self.account: - self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + def _setup(self): + account_name = self.__name__ if self.account.HOSTER_DOMAIN is None else self.HOSTER_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.resume_download = self.premium else: - return + self.req = self.pyload.requestFactory.getRequest(account_name) + self.premium = False + self.resume_download = False + + + def load_account(self): + if self.req: + self.req.close() + + if not self.account: + self.account = self.pyload.accountManager.getAccountPlugin(self.HOSTER_NAME) + + if not self.account: + self.account = self.pyload.accountManager.getAccountPlugin(self.__name__) - self.user, data = self.account.selectAccount() - self.req = self.account.getAccountRequest(self.user) - self.premium = self.account.isPremium(self.user) + if self.account: + if not self.account.HOSTER_DOMAIN: + self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + if not self.user: + self.user = self.account.select()[0] - def setup(self): - self.chunkLimit = 1 - self.resumeDownload = self.premium - self.multiDL = True + if not self.user or not self.account.is_logged(self.user, True): + self.account = False getInfo = create_getInfo(XFileSharingPro) diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index a1711cb0e..8df1a441f 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -4,7 +4,7 @@ import re import urllib from module.common.json_layer import json_loads -from module.plugins.Hoster import Hoster +from module.plugins.internal.Hoster import Hoster def clean_json(json_expr): @@ -18,7 +18,8 @@ def clean_json(json_expr): class XHamsterCom(Hoster): __name__ = "XHamsterCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.14" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?xhamster\.com/movies/.+' __config__ = [("type", ".mp4;.flv", "Preferred type", ".mp4")] @@ -34,8 +35,8 @@ class XHamsterCom(Hoster): if not self.file_exists(): self.offline() - if self.getConfig('type'): - self.desired_fmt = self.getConfig('type') + if self.get_config('type'): + self.desired_fmt = self.get_config('type') pyfile.name = self.get_file_name() + self.desired_fmt self.download(self.get_file_url()) @@ -47,7 +48,8 @@ class XHamsterCom(Hoster): def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() @@ -79,19 +81,19 @@ class XHamsterCom(Hoster): self.error(_("file_url not found")) file_url = file_url.group(1) long_url = srv_url + file_url - self.logDebug("long_url = " + long_url) + self.log_debug("long_url = " + long_url) else: if flashvars['file']: file_url = urllib.unquote(flashvars['file']) else: self.error(_("file_url not found")) - if url_mode == '3': + if url_mode == "3": long_url = file_url - self.logDebug("long_url = " + long_url) + self.log_debug("long_url = " + long_url) else: long_url = srv_url + "key=" + file_url - self.logDebug("long_url = " + long_url) + self.log_debug("long_url = " + long_url) return long_url @@ -118,7 +120,8 @@ class XHamsterCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/XVideosCom.py b/module/plugins/hoster/XVideosCom.py index a8f291824..d74f35616 100644 --- a/module/plugins/hoster/XVideosCom.py +++ b/module/plugins/hoster/XVideosCom.py @@ -3,13 +3,14 @@ import re import urllib -from module.plugins.Hoster import Hoster +from module.plugins.internal.Hoster import Hoster class XVideosCom(Hoster): __name__ = "XVideos.com" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.12" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?xvideos\.com/video(\d+)' diff --git a/module/plugins/hoster/XdadevelopersCom.py b/module/plugins/hoster/XdadevelopersCom.py index 45d1e92cb..12f27c880 100644 --- a/module/plugins/hoster/XdadevelopersCom.py +++ b/module/plugins/hoster/XdadevelopersCom.py @@ -11,7 +11,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class XdadevelopersCom(SimpleHoster): __name__ = "XdadevelopersCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?forum\.xda-developers\.com/devdb/project/dl/\?id=\d+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -28,11 +29,11 @@ class XdadevelopersCom(SimpleHoster): def setup(self): self.multiDL = True - self.resumeDownload = True - self.chunkLimit = 1 + self.resume_download = True + self.chunk_limit = 1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): self.link = pyfile.url + "&task=get" #@TODO: Revert to `get={'task': "get"}` in 0.4.10 diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index d167e4cab..aba66ee94 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -8,14 +8,16 @@ import time from select import select -from module.plugins.Hoster import Hoster -from module.utils import save_join +from module.plugins.internal.Hoster import Hoster +# from module.utils import decode +from module.utils import save_join as fs_join class Xdcc(Hoster): __name__ = "Xdcc" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.34" + __status__ = "testing" __config__ = [("nick", "str", "Nickname", "pyload"), ("ident", "str", "Ident", "pyloadident"), @@ -27,20 +29,19 @@ class Xdcc(Hoster): def setup(self): - self.debug = 0 # 0,1,2 self.timeout = 30 self.multiDL = False def process(self, pyfile): - # change request type - self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, type="XDCC") + #: Change request type + self.req = self.pyload.requestFactory.getRequest(self.__name__, type="XDCC") self.pyfile = pyfile for _i in xrange(0, 3): try: - nmn = self.doDownload(pyfile.url) - self.logDebug("Download of %s finished." % nmn) + nmn = self.do_download(pyfile.url) + self.log_debug("Download of %s finished." % nmn) return except socket.error, e: if hasattr(e, "errno"): @@ -49,9 +50,8 @@ class Xdcc(Hoster): errno = e.args[0] if errno == 10054: - self.logDebug("Server blocked our ip, retry in 5 min") - self.setWait(300) - self.wait() + self.log_debug("Server blocked our ip, retry in 5 min") + self.wait(300) continue self.fail(_("Failed due to socket errors. Code: %d") % errno) @@ -59,17 +59,17 @@ class Xdcc(Hoster): self.fail(_("Server blocked our ip, retry again later manually")) - def doDownload(self, url): - self.pyfile.setStatus("waiting") # real link + def do_download(self, url): + self.pyfile.setStatus("waiting") #: Real link m = re.match(r'xdcc://(.*?)/#?(.*?)/(.*?)/#?(\d+)/?', url) server = m.group(1) chan = m.group(2) bot = m.group(3) pack = m.group(4) - nick = self.getConfig('nick') - ident = self.getConfig('ident') - real = self.getConfig('realname') + nick = self.get_config('nick') + ident = self.get_config('ident') + real = self.get_config('realname') temp = server.split(':') ln = len(temp) @@ -81,30 +81,29 @@ class Xdcc(Hoster): self.fail(_("Invalid hostname for IRC Server: %s") % server) ####################### - # CONNECT TO IRC AND IDLE FOR REAL LINK + #: CONNECT TO IRC AND IDLE FOR REAL LINK dl_time = time.time() sock = socket.socket() sock.connect((host, int(port))) if nick == "pyload": - nick = "pyload-%d" % (time.time() % 1000) # last 3 digits + nick = "pyload-%d" % (time.time() % 1000) #: last 3 digits sock.send("NICK %s\r\n" % nick) sock.send("USER %s %s bla :%s\r\n" % (ident, host, real)) - self.setWait(3) - self.wait() + self.wait(3) sock.send("JOIN #%s\r\n" % chan) sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) - # IRC recv loop + #: IRC recv loop readbuffer = "" done = False retry = None m = None while True: - # done is set if we got our real link + #: Done is set if we got our real link if done: break @@ -115,7 +114,7 @@ class Xdcc(Hoster): sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) else: - if (dl_time + self.timeout) < time.time(): # todo: add in config + if (dl_time + self.timeout) < time.time(): #@TODO: add in config sock.send("QUIT :byebye\r\n") sock.close() self.fail(_("XDCC Bot did not answer")) @@ -129,8 +128,8 @@ class Xdcc(Hoster): readbuffer = temp.pop() for line in temp: - if self.debug is 2: - print "*> " + unicode(line, errors='ignore') + # if self.pyload.debug: + # self.log_debug("*> " + decode(line)) line = line.rstrip() first = line.split() @@ -145,29 +144,29 @@ class Xdcc(Hoster): continue msg = { - "origin": msg[0][1:], - "action": msg[1], - "target": msg[2], - "text": msg[3][1:] + 'origin': msg[0][1:], + 'action': msg[1], + 'target': msg[2], + 'text': msg[3][1:] } - if nick == msg['target'][0:len(nick)] and "PRIVMSG" == msg['action']: + if nick is msg['target'][0:len(nick)] and "PRIVMSG" is msg['action']: if msg['text'] == "\x01VERSION\x01": - self.logDebug("Sending CTCP VERSION") + self.log_debug("Sending CTCP VERSION") sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) elif msg['text'] == "\x01TIME\x01": - self.logDebug("Sending CTCP TIME") + self.log_debug("Sending CTCP TIME") sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) elif msg['text'] == "\x01LAG\x01": - pass # don't know how to answer + pass #: don't know how to answer - if not (bot == msg['origin'][0:len(bot)] - and nick == msg['target'][0:len(nick)] + if not (bot is msg['origin'][0:len(bot)] + and nick is msg['target'][0:len(nick)] and msg['action'] in ("PRIVMSG", "NOTICE")): continue - if self.debug is 1: - print "%s: %s" % (msg['origin'], msg['text']) + if self.pyload.debug: + self.log_debug(msg['origin'], msg['text']) if "You already requested that pack" in msg['text']: retry = time.time() + 300 @@ -179,7 +178,7 @@ class Xdcc(Hoster): if m: done = True - # get connection data + #: Get connection data ip = socket.inet_ntoa(struct.pack('L', socket.ntohl(int(m.group(2))))) port = int(m.group(3)) packname = m.group(1) @@ -189,20 +188,20 @@ class Xdcc(Hoster): self.pyfile.name = packname - download_folder = self.config['general']['download_folder'] - filename = save_join(download_folder, packname) + download_folder = self.pyload.config.get("general", "download_folder") + filename = fs_join(download_folder, packname) - self.logInfo(_("Downloading %s from %s:%d") % (packname, ip, port)) + self.log_info(_("Downloading %s from %s:%d") % (packname, ip, port)) self.pyfile.setStatus("downloading") newname = self.req.download(ip, port, filename, sock, self.pyfile.setProgress) - if newname and newname != filename: - self.logInfo(_("%(name)s saved as %(newname)s") % {"name": self.pyfile.name, "newname": newname}) + if newname and newname is not filename: + self.log_info(_("%(name)s saved as %(newname)s") % {'name': self.pyfile.name, 'newname': newname}) filename = newname - # kill IRC socket - # sock.send("QUIT :byebye\r\n") + #: kill IRC socket + #: sock.send("QUIT :byebye\r\n") sock.close() - self.lastDownload = filename - return self.lastDownload + self.last_download = filename + return self.last_download diff --git a/module/plugins/hoster/YadiSk.py b/module/plugins/hoster/YadiSk.py index 3b4c9d985..a907cd282 100644 --- a/module/plugins/hoster/YadiSk.py +++ b/module/plugins/hoster/YadiSk.py @@ -10,7 +10,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class YadiSk(SimpleHoster): __name__ = "YadiSk" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __pattern__ = r'https?://yadi\.sk/d/[\w-]+' @@ -23,8 +24,8 @@ class YadiSk(SimpleHoster): @classmethod - def getInfo(cls, url="", html=""): - info = super(YadiSk, cls).getInfo(url, html) + def get_info(cls, url="", html=""): + info = super(YadiSk, cls).get_info(url, html) if html: if 'idclient' not in info: @@ -59,12 +60,12 @@ class YadiSk(SimpleHoster): def setup(self): - self.resumeDownload = False + self.resume_download = False self.multiDL = False - self.chunkLimit = 1 + self.chunk_limit = 1 - def handleFree(self, pyfile): + def handle_free(self, pyfile): if any(True for _k in ['id', 'sk', 'version', 'idclient'] if _k not in self.info): self.error(_("Missing JSON data")) diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index 00185c05a..e0e90a311 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -10,7 +10,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class YibaishiwuCom(SimpleHoster): __name__ = "YibaishiwuCom" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?(?:u\.)?115\.com/file/(?P<ID>\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -27,14 +28,14 @@ class YibaishiwuCom(SimpleHoster): LINK_FREE_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)' - def handleFree(self, pyfile): + def handle_free(self, pyfile): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("LINK_FREE_PATTERN not found")) url = m.group(1) - self.logDebug(('FREEUSER' if m.group(2) == 'download' else 'GUEST') + ' URL', url) + 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)) if "urls" in res: @@ -49,7 +50,7 @@ class YibaishiwuCom(SimpleHoster): for mr in mirrors: try: self.link = mr['url'].replace("\\", "") - self.logDebug("Trying URL: " + self.link) + self.log_debug("Trying URL: " + self.link) break except Exception: continue diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py index 19d07fa36..02272bf36 100644 --- a/module/plugins/hoster/YoupornCom.py +++ b/module/plugins/hoster/YoupornCom.py @@ -2,13 +2,14 @@ import re -from module.plugins.Hoster import Hoster +from module.plugins.internal.Hoster import Hoster class YoupornCom(Hoster): __name__ = "YoupornCom" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.22" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?youporn\.com/watch/.+' @@ -29,11 +30,12 @@ class YoupornCom(Hoster): def download_html(self): url = self.pyfile.url - self.html = self.load(url, post={"user_choice": "Enter"}, cookies=False) + self.html = self.load(url, post={'user_choice': "Enter"}, cookies=False) def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() @@ -50,7 +52,8 @@ class YoupornCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index d0316d3ac..a75bbcc94 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -1,14 +1,16 @@ # -*- coding: utf-8 -*- -import reimport urllib +import re +import urllib -from module.plugins.Hoster import Hoster +from module.plugins.internal.Hoster import Hoster class YourfilesTo(Hoster): __name__ = "YourfilesTo" __type__ = "hoster" - __version__ = "0.22" + __version__ = "0.24" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?yourfiles\.(to|biz)/\?d=\w+' @@ -30,16 +32,14 @@ class YourfilesTo(Hoster): self.pyfile.name = self.get_file_name() - wait_time = self.get_waiting_time() - self.setWait(wait_time) - self.wait() + self.wait(self.get_waiting_time()) def get_waiting_time(self): if not self.html: self.download_html() - #var zzipitime = 15; + #: var zzipitime = 15 m = re.search(r'var zzipitime = (\d+);', self.html) if m: sec = int(m.group(1)) @@ -55,7 +55,8 @@ class YourfilesTo(Hoster): def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ url = re.search(r"var bla = '(.*?)';", self.html) if url: @@ -74,7 +75,8 @@ class YourfilesTo(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index e2ab146a9..865eeef2e 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -2,17 +2,19 @@ import os import re -import subprocessimport urllib +import subprocess +import urllib -from module.plugins.Hoster import Hoster -from module.plugins.internal.SimpleHoster import replace_patterns +from module.plugins.internal.Hoster import Hoster +from module.plugins.internal.Plugin import replace_patterns from module.utils import html_unescape def which(program): - """Works exactly like the unix command which - Courtesy of http://stackoverflow.com/a/377028/675646""" - + """ + 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) @@ -31,7 +33,8 @@ def which(program): class YoutubeCom(Hoster): __name__ = "YoutubeCom" __type__ = "hoster" - __version__ = "0.41" + __version__ = "0.44" + __status__ = "testing" __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com|youtu\.be)/watch\?(?:.*&)?v=.+' __config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting" , "hd" ), @@ -50,10 +53,10 @@ class YoutubeCom(Hoster): URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/')] - # Invalid characters that must be removed from the file name + #: Invalid characters that must be removed from the file name invalidChars = u'\u2605:?><"|\\' - # name, width, height, quality ranking, 3D + #: name, width, height, quality ranking, 3D formats = {5 : (".flv" , 400 , 240 , 1 , False), 6 : (".flv" , 640 , 400 , 4 , False), 17 : (".3gp" , 176 , 144 , 0 , False), @@ -78,88 +81,88 @@ class YoutubeCom(Hoster): def setup(self): - self.resumeDownload = True + self.resume_download = True self.multiDL = True def process(self, pyfile): pyfile.url = replace_patterns(pyfile.url, self.URL_REPLACEMENTS) - html = self.load(pyfile.url, decode=True) + html = self.load(pyfile.url) if re.search(r'<div id="player-unavailable" class="\s*player-width player-height\s*">', html): self.offline() if "We have been receiving a large volume of requests from your network." in html: - self.tempOffline() + self.temp_offline() - #get config - use3d = self.getConfig('3d') + #: Get config + use3d = self.get_config('3d') if use3d: - quality = {"sd": 82, "hd": 84, "fullhd": 85, "240p": 83, "360p": 82, - "480p": 82, "720p": 84, "1080p": 85, "3072p": 85} + quality = {'sd': 82, 'hd': 84, 'fullhd': 85, '240p': 83, '360p': 82, + '480p': 82, '720p': 84, '1080p': 85, '3072p': 85} else: - quality = {"sd": 18, "hd": 22, "fullhd": 37, "240p": 5, "360p": 18, - "480p": 35, "720p": 22, "1080p": 37, "3072p": 38} + quality = {'sd': 18, 'hd': 22, 'fullhd': 37, '240p': 5, '360p': 18, + '480p': 35, '720p': 22, '1080p': 37, '3072p': 38} - desired_fmt = self.getConfig('fmt') + desired_fmt = self.get_config('fmt') if not desired_fmt: - desired_fmt = quality.get(self.getConfig('quality'), 18) + desired_fmt = quality.get(self.get_config('quality'), 18) elif desired_fmt not in self.formats: - self.logWarning(_("FMT %d unknown, using default") % desired_fmt) + self.log_warning(_("FMT %d unknown, using default") % desired_fmt) desired_fmt = 0 - #parse available streams + #: Parse available streams streams = re.search(r'"url_encoded_fmt_stream_map":"(.+?)",', html).group(1) streams = [x.split('\u0026') for x in streams.split(',')] streams = [dict((y.split('=', 1)) for y in x) for x in streams] streams = [(int(x['itag']), urllib.unquote(x['url'])) for x in streams] - # self.logDebug("Found links: %s" % streams) + # self.log_debug("Found links: %s" % streams) - self.logDebug("AVAILABLE STREAMS: %s" % [x[0] for x in streams]) + self.log_debug("AVAILABLE STREAMS: %s" % [x[0] for x in streams]) - #build dictionary of supported itags (3D/2D) - allowed = lambda x: self.getConfig(self.formats[x][0]) + #: Build dictionary of supported itags (3D/2D) + allowed = lambda x: self.get_config(self.formats[x][0]) streams = [x for x in streams if x[0] in self.formats and allowed(x[0])] if not streams: self.fail(_("No available stream meets your preferences")) - fmt_dict = dict([x for x in streams if self.formats[x[0]][4] == use3d] or streams) + fmt_dict = dict([x for x in streams if self.formats[x[0]][4] is use3d] or streams) - self.logDebug("DESIRED STREAM: ITAG:%d (%s) %sfound, %sallowed" % + self.log_debug("DESIRED STREAM: ITAG:%d (%s) %sfound, %sallowed" % (desired_fmt, "%s %dx%d Q:%d 3D:%s" % self.formats[desired_fmt], "" if desired_fmt in fmt_dict else "NOT ", "" if allowed(desired_fmt) else "NOT ")) - #return fmt nearest to quality index + #: Return fmt nearest to quality index if desired_fmt in fmt_dict and allowed(desired_fmt): fmt = desired_fmt else: - sel = lambda x: self.formats[x][3] # select quality index + sel = lambda x: self.formats[x][3] #: Select quality index comp = lambda x, y: abs(sel(x) - sel(y)) - self.logDebug("Choosing nearest fmt: %s" % [(x, allowed(x), comp(x, desired_fmt)) for x in fmt_dict.keys()]) + self.log_debug("Choosing nearest fmt: %s" % [(x, allowed(x), comp(x, desired_fmt)) for x in fmt_dict.keys()]) fmt = reduce(lambda x, y: x if comp(x, desired_fmt) <= comp(y, desired_fmt) and sel(x) > sel(y) else y, fmt_dict.keys()) - self.logDebug("Chosen fmt: %s" % fmt) + self.log_debug("Chosen fmt: %s" % fmt) url = fmt_dict[fmt] - self.logDebug("URL: %s" % url) + self.log_debug("URL: %s" % url) - #set file name + #: Set file name file_suffix = self.formats[fmt][0] if fmt in self.formats else ".flv" file_name_pattern = '<meta name="title" content="(.+?)">' name = re.search(file_name_pattern, html).group(1).replace("/", "") - # Cleaning invalid characters from the file name + #: Cleaning invalid characters from the file name name = name.encode('ascii', 'replace') - for c in self.invalidChars: + for c in self.invalid_chars: name = name.replace(c, '_') pyfile.name = html_unescape(name) diff --git a/module/plugins/hoster/ZDF.py b/module/plugins/hoster/ZDF.py index 8d3de5b26..f0b85d11a 100644 --- a/module/plugins/hoster/ZDF.py +++ b/module/plugins/hoster/ZDF.py @@ -1,17 +1,17 @@ # -*- coding: utf-8 -*- import re +import xml.etree.ElementTree as etree -from xml.etree.ElementTree import fromstring - -from module.plugins.Hoster import Hoster +from module.plugins.internal.Hoster import Hoster # Based on zdfm by Roland Beermann (http://github.com/enkore/zdfm/) class ZDF(Hoster): __name__ = "ZDF Mediathek" __type__ = "hoster" - __version__ = "0.80" + __version__ = "0.84" + __status__ = "testing" __pattern__ = r'http://(?:www\.)?zdf\.de/ZDFmediathek/\D*(\d+)\D*' @@ -42,7 +42,7 @@ class ZDF(Hoster): def process(self, pyfile): - xml = fromstring(self.load(self.XML_API % self.get_id(pyfile.url))) + xml = etree.fromstring(self.load(self.XML_API % self.get_id(pyfile.url), decode=False)) status = xml.findtext("./status/statuscode") if status != "ok": @@ -51,7 +51,7 @@ class ZDF(Hoster): video = xml.find("video") title = video.findtext("information/title") - pyfile.name = title + pyfile.name = title.encode("Latin-1") target_url = sorted((v for v in video.iter("formitaet") if self.video_valid(v)), key=self.video_key)[-1].findtext("url") diff --git a/module/plugins/hoster/ZShareNet.py b/module/plugins/hoster/ZShareNet.py index 6e4508a18..b5dd66769 100644 --- a/module/plugins/hoster/ZShareNet.py +++ b/module/plugins/hoster/ZShareNet.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class ZShareNet(DeadHoster): __name__ = "ZShareNet" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" + __status__ = "testing" __pattern__ = r'https?://(?:ww[2w]\.)?zshares?\.net/.+' __config__ = [] #@TODO: Remove in 0.4.10 diff --git a/module/plugins/hoster/ZahikiNet.py b/module/plugins/hoster/ZahikiNet.py new file mode 100644 index 000000000..f9ea995ba --- /dev/null +++ b/module/plugins/hoster/ZahikiNet.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class ZahikiNet(SimpleHoster): + __name__ = "ZahikiNet" + __type__ = "hoster" + __version__ = "0.02" + __status__ = "testing" + + __pattern__ = r'https?://(?:www\.)?zahiki\.net/\w+/.+' + + __description__ = """Zahiki.net hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + DIRECT_LINK = True + + NAME_PATTERN = r'/(?P<N>.+?) </title>' + OFFLINE_PATTERN = r'>(Not Found|Il file selezionato non esiste)' + + LINK_FREE_PATTERN = r'file: "(.+?)"' + + + def setup(self): + self.resume_download = True + self.multiDL = True + self.limitDL = 6 + + +getInfo = create_getInfo(ZahikiNet) diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py index 617e00e58..ff3a43e6d 100644 --- a/module/plugins/hoster/ZeveraCom.py +++ b/module/plugins/hoster/ZeveraCom.py @@ -9,10 +9,12 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class ZeveraCom(MultiHoster): __name__ = "ZeveraCom" __type__ = "hoster" - __version__ = "0.29" + __version__ = "0.32" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)zevera\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Zevera.com multi-hoster plugin""" __license__ = "GPLv3" @@ -20,15 +22,11 @@ class ZeveraCom(MultiHoster): ("Walter Purcaro", "vuolter@gmail.com")] - def handlePremium(self, pyfile): - self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url) - + FILE_ERRORS = [("Error", r'action="ErrorDownload.aspx')] - def checkFile(self, rules={}): - if self.checkDownload({"error": 'action="ErrorDownload.aspx'}): - self.fail(_("Error response received")) - return super(ZeveraCom, self).checkFile(rules) + def handle_premium(self, pyfile): + self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url) getInfo = create_getInfo(ZeveraCom) diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index d776e5928..1b29948ce 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -3,18 +3,19 @@ import re import urllib -from BeautifulSoup import BeautifulSoup +import BeautifulSoup -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.79" + __version__ = "0.82" + __status__ = "testing" - __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)' + __pattern__ = r'http://www\d{0,3}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Zippyshare.com hoster plugin""" @@ -33,12 +34,12 @@ class ZippyshareCom(SimpleHoster): def setup(self): - self.chunkLimit = -1 + self.chunk_limit = -1 self.multiDL = True - self.resumeDownload = True + self.resume_download = True - def handleFree(self, pyfile): + def handle_free(self, pyfile): recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() @@ -53,41 +54,41 @@ class ZippyshareCom(SimpleHoster): else: self.link = self.get_link() - if self.link and pyfile.name == 'file.html': + if self.link and pyfile.name == "file.html": pyfile.name = urllib.unquote(self.link.split('/')[-1]) def get_link(self): - # get all the scripts inside the html body - soup = BeautifulSoup(self.html) + #: Get all the scripts inside the html body + soup = BeautifulSoup.BeautifulSoup(self.html) scripts = (s.getText().strip() for s in soup.body.findAll('script', type='text/javascript')) - # meant to be populated with the initialization of all the DOM elements found in the scripts + #: Meant to be populated with the initialization of all the DOM elements found in the scripts initScripts = set() - def replElementById(element): - id = element.group(1) # id might be either 'x' (a real id) or x (a variable) - attr = element.group(4) # attr might be None + def repl_element_by_id(element): + id = element.group(1) #: Id might be either 'x' (a real id) or x (a variable) + attr = element.group(4) #: Attr might be None varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr)) realid = id.strip('"\'') - if id != realid: #id is not a variable, so look for realid.attr in the html + if id is not realid: #: Id is not a variable, so look for realid.attr in the html initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=realid)]) initValue = '"%s"' % initValues[-1] if initValues else 'null' initScripts.add('%s = %s;' % (varName, initValue)) return varName - # handle all getElementById + #: Handle all getElementById reVar = r'document.getElementById\(([\'"\w-]+)\)(\.)?(getAttribute\([\'"])?(\w+)?([\'"]\))?' - scripts = [re.sub(reVar, replElementById, script) for script in scripts if script] + scripts = [re.sub(reVar, repl_element_by_id, script) for script in scripts if script] - # add try/catch in JS to handle deliberate errors + #: Add try/catch in JS to handle deliberate errors scripts = ['\n'.join(('try{', script, '} catch(err){}')) for script in scripts] - # get the file's url by evaluating all the scripts - scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR["dlbutton_href"]'] + #: Get the file's url by evaluating all the scripts + scripts = ["var GVAR = {}"] + list(initScripts) + scripts + ['GVAR["dlbutton_href"]'] return self.js.eval('\n'.join(scripts)) |