From 3353ea228835ffa96cc73d5b5e23f6d92ba84203 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 29 Sep 2015 22:43:17 +0200 Subject: Update hoster plugins --- module/plugins/hoster/BasePlugin.py | 60 +++++++++++++++---------------- module/plugins/hoster/BitshareCom.py | 6 ++-- module/plugins/hoster/CrockoCom.py | 4 +-- module/plugins/hoster/CzshareCom.py | 14 ++++---- module/plugins/hoster/DataportCz.py | 4 +-- module/plugins/hoster/DepositfilesCom.py | 6 ++-- module/plugins/hoster/EuroshareEu.py | 8 ++--- module/plugins/hoster/ExtabitCom.py | 4 +-- module/plugins/hoster/FastixRu.py | 4 +-- module/plugins/hoster/FastshareCz.py | 10 +++--- module/plugins/hoster/FilecloudIo.py | 6 ++-- module/plugins/hoster/FilefactoryCom.py | 10 +++--- module/plugins/hoster/FilepostCom.py | 6 ++-- module/plugins/hoster/FilesMailRu.py | 4 +-- module/plugins/hoster/FileserveCom.py | 16 ++++----- module/plugins/hoster/FreakshareCom.py | 6 ++-- module/plugins/hoster/FreeWayMe.py | 4 +-- module/plugins/hoster/Ftp.py | 22 ++++++++---- module/plugins/hoster/HighWayMe.py | 6 ++-- module/plugins/hoster/Keep2ShareCc.py | 6 ++-- module/plugins/hoster/LetitbitNet.py | 9 +++-- module/plugins/hoster/LinksnappyCom.py | 6 ++-- module/plugins/hoster/LuckyShareNet.py | 4 +-- module/plugins/hoster/MegaRapidCz.py | 6 ++-- module/plugins/hoster/MegaRapidoNet.py | 4 +-- module/plugins/hoster/MegasharesCom.py | 8 ++--- module/plugins/hoster/MultishareCz.py | 4 +-- module/plugins/hoster/MyfastfileCom.py | 5 +-- module/plugins/hoster/NoPremiumPl.py | 10 +++--- module/plugins/hoster/NowDownloadSx.py | 1 - module/plugins/hoster/OboomCom.py | 6 ++-- module/plugins/hoster/OverLoadMe.py | 4 +-- module/plugins/hoster/PremiumTo.py | 8 ++--- module/plugins/hoster/QuickshareCz.py | 6 ++-- module/plugins/hoster/RPNetBiz.py | 8 ++--- module/plugins/hoster/RapideoPl.py | 10 +++--- module/plugins/hoster/RapidgatorNet.py | 10 +++--- module/plugins/hoster/RehostTo.py | 4 +-- module/plugins/hoster/Share4WebCom.py | 4 +-- module/plugins/hoster/ShareonlineBiz.py | 16 ++++----- module/plugins/hoster/SimplyPremiumCom.py | 6 ++-- module/plugins/hoster/SimplydebridCom.py | 8 ++--- module/plugins/hoster/SmoozedCom.py | 4 +-- module/plugins/hoster/UlozTo.py | 8 ++--- module/plugins/hoster/UnibytesCom.py | 6 ++-- module/plugins/hoster/UpleaCom.py | 4 +-- module/plugins/hoster/UploadableCh.py | 8 ++--- module/plugins/hoster/WebshareCz.py | 4 +-- module/plugins/hoster/XFileSharingPro.py | 26 +++++++------- module/plugins/hoster/ZeveraCom.py | 4 +-- 50 files changed, 211 insertions(+), 206 deletions(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index d64834a7c..1952309fe 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -12,7 +12,7 @@ from module.plugins.internal.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.45" + __version__ = "0.46" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -33,48 +33,48 @@ class BasePlugin(Hoster): """ Main function """ + netloc = urlparse.urlparse(pyfile.url).netloc + pyfile.name = self.get_info(pyfile.url)['name'] if not pyfile.url.startswith("http"): self.fail(_("No plugin matched")) - for _i in xrange(5): - try: - link = self.direct_link(urllib.unquote(pyfile.url)) + try: + link = self.direct_link(urllib.unquote(pyfile.url)) - if link: - self.download(link, ref=False, disposition=True) - else: - self.fail(_("File not found")) + if link: + self.download(link, ref=False, disposition=True) + else: + self.fail(_("File not found")) - except BadHeader, e: - if e.code == 404: - self.offline() + except BadHeader, e: + if e.code == 404: + self.offline() - elif e.code in (401, 403): - self.log_debug("Auth required", "Received HTTP status code: %d" % e.code) + elif e.code in (401, 403): + self.log_debug("Auth required", "Received HTTP status code: %d" % e.code) - account = self.pyload.accountManager.getAccountPlugin('Http') - servers = [x['login'] for x in account.getAllAccounts()] #@TODO: Recheck in 0.4.10 - server = urlparse.urlparse(pyfile.url).netloc + #@TODO: Recheck in 0.4.10 + if self.account: + servers = [x['login'] for x in self.account.getAllAccounts()] + else: + servers = [] + + if netloc in servers: + self.log_debug("Logging on to %s" % netloc) + self.req.addAuth(self.account.get_login('password')) - if server in servers: - self.log_debug("Logging on to %s" % server) - self.req.addAuth(account.get_info(server)['login']['password']) - else: - pwd = self.get_password() - if ':' in pwd: - self.req.addAuth(pwd) - else: - self.fail(_("Authorization required")) else: - self.fail(e) + pwd = self.get_password() + if ':' in pwd: + self.req.addAuth(pwd) + else: + self.fail(_("Authorization required")) else: - break - else: - self.fail(_("No file downloaded")) #@TODO: Move to hoster class in 0.4.10 + self.fail(e) - errmsg = self.check_download({'Empty file' : re.compile(r'\A\s*\Z'), + errmsg = self.check_file({'Empty file' : re.compile(r'\A\s*\Z'), 'Html error' : re.compile(r'\A(?:\s*<.+>)?((?:[\w\s]*(?:[Ee]rror|ERROR)\s*\:?)?\s*\d{3})(?:\Z|\s+)'), 'Html file' : re.compile(r'\A\s*\w+)(?(1)/(?P.+?)\.html)' @@ -39,7 +39,7 @@ class BitshareCom(SimpleHoster): def process(self, pyfile): if self.premium: - self.account.relogin(self.user) + self.account.relogin() #: File id m = re.match(self.__pattern__, pyfile.url) @@ -75,7 +75,7 @@ class BitshareCom(SimpleHoster): #: This may either download our file or forward us to an error page self.link = self.get_download_url() - if self.check_download({'error': ">Error occured<"}): + if self.check_file({'error': ">Error occured<"}): self.retry(5, 5 * 60, "Bitshare host : Error occured") diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 17e3ee93c..2ed140b9c 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CrockoCom(SimpleHoster): __name__ = "CrockoCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+' @@ -58,7 +58,7 @@ class CrockoCom(SimpleHoster): inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() self.download(action, post=inputs) - if self.check_download({'captcha': recaptcha.KEY_AJAX_PATTERN}): + if self.check_file({'captcha': recaptcha.KEY_AJAX_PATTERN}): self.captcha.invalid() else: break diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 6afd9fa2d..eeba9d86d 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -12,7 +12,7 @@ from module.utils import parseFileSize as parse_size class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __version__ = "1.02" + __version__ = "1.03" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+' @@ -40,11 +40,11 @@ class CzshareCom(SimpleHoster): USER_CREDIT_PATTERN = r'
\s*kredit: ([\d .,]+)(\w+)\s*
' - def check_traffic_left(self): + def check_traffic(self): #: Check if user logged in m = re.search(self.USER_CREDIT_PATTERN, self.html) if m is None: - self.account.relogin(self.user) + self.account.relogin() self.html = self.load(self.pyfile.url) m = re.search(self.USER_CREDIT_PATTERN, self.html) if m is None: @@ -54,7 +54,7 @@ class CzshareCom(SimpleHoster): try: credit = parse_size(m.group(1).replace(' ', ''), m.group(2)) self.log_info(_("Premium download for %i KiB of Credit") % (self.pyfile.size / 1024)) - self.log_info(_("User %s has %i KiB left") % (self.user, credit / 1024)) + self.log_info(_("User %s has %i KiB left") % (self.account.user, credit / 1024)) if credit < self.pyfile.size: self.log_info(_("Not enough credit to download file: %s") % self.pyfile.name) return False @@ -137,9 +137,9 @@ class CzshareCom(SimpleHoster): self.wait() - def check_file(self): + def check_download(self): #: Check download - check = self.check_download({ + check = self.check_file({ "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), 'credit' : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), "multi-dl" : re.compile(self.MULTIDL_PATTERN), @@ -159,7 +159,7 @@ class CzshareCom(SimpleHoster): self.captcha.invalid() self.retry() - return super(CzshareCom, self).check_file() + return super(CzshareCom, self).check_download() getInfo = create_getInfo(CzshareCom) diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index 15caae1f7..2b30df059 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -6,7 +6,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataportCz(SimpleHoster): __name__ = "DataportCz" __type__ = "hoster" - __version__ = "0.42" + __version__ = "0.43" __status__ = "testing" __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.+)' @@ -41,7 +41,7 @@ class DataportCz(SimpleHoster): self.download("http://www.dataport.cz%s" % action, post=inputs) - check = self.check_download({'captcha': 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', + check = self.check_file({'captcha': 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', 'slot' : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) if check == "captcha": self.error(_("invalid captcha")) diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 9d42935cb..cb9ab5572 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" - __version__ = "0.57" + __version__ = "0.58" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P\w+)' @@ -48,7 +48,7 @@ class DepositfilesCom(SimpleHoster): m = re.search(r"var fid = '(\w+)';", self.html) if m is None: - self.retry(wait_time=5) + self.retry(delay=5) params = {'fid': m.group(1)} self.log_debug("FID: %s" % params['fid']) @@ -76,7 +76,7 @@ class DepositfilesCom(SimpleHoster): self.retry(25, 60 * 60, "Download limit reached") elif 'onClick="show_gold_offer' in self.html: - self.account.relogin(self.user) + self.account.relogin() self.retry() else: diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 70df8e354..3cfa014dd 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class EuroshareEu(SimpleHoster): __name__ = "EuroshareEu" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" __status__ = "testing" __pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.+' @@ -32,16 +32,16 @@ class EuroshareEu(SimpleHoster): def handle_premium(self, pyfile): if self.ERROR_PATTERN in self.html: - self.account.relogin(self.user) + self.account.relogin() self.retry(msg=_("User not logged in")) self.link = pyfile.url.rstrip('/') + "/download/" - check = self.check_download({'login': re.compile(self.ERROR_PATTERN), + check = self.check_file({'login': re.compile(self.ERROR_PATTERN), 'json' : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) if check == "login" or (check == "json" and self.last_check.group(1) == "Access token expired"): - self.account.relogin(self.user) + self.account.relogin() self.retry(msg=_("Access token expired")) elif check == "json": diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 3442e7d27..0d5533539 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, s class ExtabitCom(SimpleHoster): __name__ = "ExtabitCom" __type__ = "hoster" - __version__ = "0.67" + __version__ = "0.68" __status__ = "testing" __pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P\w+)' @@ -39,7 +39,7 @@ class ExtabitCom(SimpleHoster): self.wait(int(m.group(1)) * 60, True) elif "The daily downloads limit from your IP is exceeded" in self.html: self.log_warning(_("You have reached your daily downloads limit for today")) - self.wait(seconds_to_midnight(gmt=2), True) + self.wait(seconds_to_midnight(), True) self.log_debug("URL: " + self.req.http.lastEffectiveURL) m = re.match(self.__pattern__, self.req.http.lastEffectiveURL) diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index f00dded3f..d932bb22e 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -10,7 +10,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}' @@ -28,7 +28,7 @@ class FastixRu(MultiHoster): def handle_premium(self, pyfile): self.html = json_loads(self.load("http://fastix.ru/api_v2/", - get={'apikey': self.account.get_data()['apikey'], + get={'apikey': self.account.get_data('apikey'), 'sub' : "getdirectlink", 'link' : pyfile.url}) data = self.html) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 62cf3889b..985faaa93 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FastshareCz(SimpleHoster): __name__ = "FastshareCz" __type__ = "hoster" - __version__ = "0.33" + __version__ = "0.34" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+' @@ -59,8 +59,8 @@ class FastshareCz(SimpleHoster): self.download(urlparse.urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18}) - def check_file(self): - check = self.check_download({ + def check_download(self): + check = self.check_file({ 'paralell-dl' : re.compile(r"FastShare.cz|