From 75b6540be746d66d3fba3ab364c78addbc50c485 Mon Sep 17 00:00:00 2001 From: Smoozed Date: Mon, 5 Jan 2015 16:49:39 +0100 Subject: Added multihoster smoozed.com --- module/plugins/accounts/SmoozedCom.py | 55 +++++++++++++++++++++++++++ module/plugins/hooks/SmoozedCom.py | 43 +++++++++++++++++++++ module/plugins/hoster/SmoozedCom.py | 70 +++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 module/plugins/accounts/SmoozedCom.py create mode 100644 module/plugins/hooks/SmoozedCom.py create mode 100644 module/plugins/hoster/SmoozedCom.py (limited to 'module') diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py new file mode 100644 index 000000000..8157806c8 --- /dev/null +++ b/module/plugins/accounts/SmoozedCom.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account + +from module.common.json_layer import json_loads + +from time import time + +import hashlib +from beaker.crypto.pbkdf2 import PBKDF2 + + + +class SmoozedCom(Account): + __name__ = "SmoozedCom" + __type__ = "account" + __version__ = "0.01" + + __description__ = """Smoozed.com account plugin""" + __license__ = "GPLv3" + __authors__ = [] + + + def loadAccountInfo(self, user, req): + # Get user data from premiumize.me + status = self.getAccountStatus(user, req) + self.logDebug(status) + + # Parse account info + account_info = {"validuntil": float(status["data"]["user"]["user_premium"]), + "trafficleft": max(0, status["data"]["traffic"][1] - status["data"]["traffic"][0]), + "session_key": status["data"]["session_key"], + "hoster": [hoster["name"] for hoster in status["data"]["hoster"]]} + + if account_info["validuntil"] < time(): + account_info['premium'] = False + else: + account_info['premium'] = True + + return account_info + + def login(self, user, data, req): + # Get user data from premiumize.me + status = self.getAccountStatus(user, req) + + # Check if user and password are valid + if status['state'] != 'ok': + self.wrongPassword() + + def getAccountStatus(self, user, req): + salt = hashlib.sha256(self.accounts[user]['password']).hexdigest() + encrypted = PBKDF2(self.accounts[user]['password'], salt, iterations=1000).hexread(32) + answer = req.load('http://www2.smoozed.com/api/login?auth=%s&password=%s' % ( + user, encrypted)) + return json_loads(answer) diff --git a/module/plugins/hooks/SmoozedCom.py b/module/plugins/hooks/SmoozedCom.py new file mode 100644 index 000000000..0aff36c0f --- /dev/null +++ b/module/plugins/hooks/SmoozedCom.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.MultiHook import MultiHook + + +class SmoozedCom(MultiHook): + __name__ = "SmoozedCom" + __type__ = "hook" + __version__ = "0.01" + + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + ("hosterList", "str", "Hoster list (comma separated)", ""), + ("unloadFailing", "bool", "Revert to stanard download if download fails", False), + ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + + __description__ = """Smoozed.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [] + + + def getHosters(self): + # If no accounts are available there will be no hosters available + if not self.account or not self.account.canUse(): + return [] + + # Get account data + (user, data) = self.account.selectAccount() + account_info = self.account.getAccountInfo(user, True) + + # Return hoster list + return account_info["hoster"] + + + def coreReady(self): + # Get account plugin and check if there is a valid account available + self.account = self.core.accountManager.getAccountPlugin("SmoozedCom") + if not self.account.canUse(): + self.account = None + self.logError(_("Please add a valid premiumize.me account first and restart pyLoad")) + return + + # Run the overwriten core ready which actually enables the multihook hook + return MultiHook.coreReady(self) diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py new file mode 100644 index 000000000..ce0eeedda --- /dev/null +++ b/module/plugins/hoster/SmoozedCom.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Hoster import Hoster + +from module.common.json_layer import json_loads + + +class SmoozedCom(Hoster): + __name__ = "SmoozedCom" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady + + __description__ = """Smoozed.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [] + + + def process(self, pyfile): + # Check account + if not self.account or not self.account.canUse(): + self.logError(_("Please enter your %s account or deactivate this plugin") % "smoozed.com") + self.fail(_("No valid smoozed.com account provided")) + + # 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) + + # Get account data + (user, data) = self.account.selectAccount() + account_info = self.account.getAccountInfo(user, True) + + # Check the link + get_data = { + "session_key": account_info['session_key'], + "url": pyfile.url + } + answer = self.load("http://www2.smoozed.com/api/check", get=get_data) + data = json_loads(answer) + if data["state"] != "ok": + self.fail(_(data["message"])) + if data["data"].get("state", "ok") != "ok": + if data["data"] == "Offline": + self.offline() + else: + self.fail(_(data["data"]["message"])) + pyfile.name = data["data"]["name"] + pyfile.size = int(data["data"]["size"]) + + # 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")) + + if isinstance(header["location"], list): + url = header["location"][-1] + else: + url = header["location"] + self.download(url, disposition=True) + + check = self.checkDownload({"error": '{"state":"error"}', "retry": '{"state":"retry"}'}) + if check == "error" or check == "retry": + self.fail(_("Error response received - contact Smoozed support")) -- cgit v1.2.3 From df143e902d00903f16cf32174948f636bda56e4c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 8 Jan 2015 22:58:32 +0100 Subject: "New Year" Update: internal plugins --- module/plugins/internal/CaptchaService.py | 49 ++++++--- module/plugins/internal/MultiHook.py | 158 ++++++++++++++++++----------- module/plugins/internal/MultiHoster.py | 15 +-- module/plugins/internal/SimpleCrypter.py | 4 +- module/plugins/internal/SimpleDereferer.py | 6 +- module/plugins/internal/SimpleHoster.py | 55 ++++++---- module/plugins/internal/XFSAccount.py | 8 +- module/plugins/internal/XFSCrypter.py | 1 - module/plugins/internal/XFSHoster.py | 26 ++--- 9 files changed, 197 insertions(+), 125 deletions(-) (limited to 'module') diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py index 965799e8e..b429fd6e0 100644 --- a/module/plugins/internal/CaptchaService.py +++ b/module/plugins/internal/CaptchaService.py @@ -2,6 +2,7 @@ import re +from base64 import urlsafe_b64encode from random import random from module.common.json_layer import json_loads @@ -54,14 +55,14 @@ class CaptchaService: class ReCaptcha(CaptchaService): __name__ = "ReCaptcha" - __version__ = "0.08" + __version__ = "0.09" __description__ = """ReCaptcha captcha service plugin""" __license__ = "GPLv3" __authors__ = [("pyLoad Team", "admin@pyload.org")] - KEY_PATTERN = r'recaptcha(?:/api|\.net)/(?:challenge|noscript)\?k=([\w-]+)' + KEY_PATTERN = r'(?:class="g-recaptcha"\s+data-sitekey="|recaptcha(?:/api|\.net)/(?:challenge|noscript)\?k=)([\w-]+)' KEY_AJAX_PATTERN = r'Recaptcha\.create\s*\(\s*["\']([\w-]+)' @@ -84,7 +85,7 @@ class ReCaptcha(CaptchaService): return None - def challenge(self, key=None): + def challenge(self, key=None, userverify=False): if not key: if self.detect_key(): key = self.key @@ -97,14 +98,30 @@ class ReCaptcha(CaptchaService): try: challenge = re.search("challenge : '(.+?)',", html).group(1) server = re.search("server : '(.+?)',", html).group(1) - except: + + except AttributeError: errmsg = _("ReCaptcha challenge pattern not found") self.plugin.fail(errmsg) - raise ValueError(errmsg) + raise AttributeError(errmsg) self.plugin.logDebug("ReCaptcha challenge: %s" % challenge) - return challenge, self.result(server, challenge) + response = challenge, self.result(server, challenge) + + return self.userverify(*response) if userverify else response + + + def userverify(self, challenge, result): + response = self.plugin.req.load("https://www.google.com/recaptcha/api2/userverify", + post={'c' : challenge, + 'response': urlsafe_b64encode('{"response":"%s"}' % result)}) + try: + return re.search(r'"uvresp","(.+?)"', response).group(1) + + except AttributeError: + errmsg = _("ReCaptcha userverify response not found") + self.plugin.fail(errmsg) + raise AttributeError(errmsg) def result(self, server, challenge): @@ -167,10 +184,11 @@ class AdsCaptcha(CaptchaService): try: challenge = re.search("challenge: '(.+?)',", html).group(1) server = re.search("server: '(.+?)',", html).group(1) - except: + + except AttributeError: errmsg = _("AdsCaptcha challenge pattern not found") self.plugin.fail(errmsg) - raise ValueError(errmsg) + raise AttributeError(errmsg) self.plugin.logDebug("AdsCaptcha challenge: %s" % challenge) @@ -214,10 +232,11 @@ class SolveMedia(CaptchaService): challenge = re.search(r'', html).group(1) server = "http://api.solvemedia.com/papi/media" - except: + + except AttributeError: errmsg = _("SolveMedia challenge pattern not found") self.plugin.fail(errmsg) - raise ValueError(errmsg) + raise AttributeError(errmsg) self.plugin.logDebug("SolveMedia challenge: %s" % challenge) @@ -286,10 +305,11 @@ class AdYouLike(CaptchaService): 'callback': callback}) try: challenge = json_loads(re.search(callback + r'\s*\((.+?)\)', html).group(1)) - except: + + except AttributeError: errmsg = _("AdYouLike challenge pattern not found") self.plugin.fail(errmsg) - raise ValueError(errmsg) + raise AttributeError(errmsg) self.plugin.logDebug("AdYouLike challenge: %s" % challenge) @@ -316,10 +336,11 @@ class AdYouLike(CaptchaService): try: instructions_visual = challenge['translations'][server['all']['lang']]['instructions_visual'] result = re.search(u'«(.+?)»', instructions_visual).group(1).strip() - except: + + except AttributeError: errmsg = _("AdYouLike result not found") self.plugin.fail(errmsg) - raise ValueError(errmsg) + raise AttributeError(errmsg) result = {'_ayl_captcha_engine' : "adyoulike", '_ayl_env' : server['all']['env'], diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index ea9f32673..202868175 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -9,12 +9,15 @@ from module.utils import remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.29" + __version__ = "0.30" - __config__ = [("mode" , "all;listed;unlisted", "Use for plugins (if supported)" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed", "bool" , "Revert to standard download if download fails", False), - ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Hook plugin for multi hoster/crypter""" __license__ = "GPLv3" @@ -22,45 +25,68 @@ class MultiHook(Hook): ("Walter Purcaro", "vuolter@gmail.com")] - MIN_INTERVAL = 12 * 60 * 60 #: reload plugins every 12h + MIN_INTERVAL = 1 * 60 * 60 - PLUGIN_REPLACEMENTS = [("1fichier.com" , "onefichier.com"), - ("2shared.com" , "twoshared.com" ), - ("4shared.com" , "fourshared.com"), - ("cloudnator.com" , "shragle.com" ), - ("easy-share.com" , "crocko.com" ), - ("fileparadox.com", "fileparadox.in"), - ("freakshare.net" , "freakshare.com"), - ("hellshare.com" , "hellshare.cz" ), - ("ifile.it" , "filecloud.io" ), - ("nowdownload.ch" , "nowdownload.sx"), - ("nowvideo.co" , "nowvideo.sx" ), - ("putlocker.com" , "firedrive.com" ), - ("share-rapid.cz" , "multishare.cz" ), - ("sharerapid.cz" , "multishare.cz" ), - ("ul.to" , "uploaded.to" ), - ("uploaded.net" , "uploaded.to" )] + DOMAIN_REPLACEMENTS = [(r'\d+.+' , "_\0" ), + (r'bayfiles\.net' , "bayfiles.com" ), + (r'cloudnator\.com' , "shragle.com" ), + (r'dfiles\.eu' , "depositfiles.com"), + (r'easy-share\.com' , "crocko.com" ), + (r'freakshare\.net' , "freakshare.com" ), + (r'hellshare\.com' , "hellshare.cz" ), + (r'ifile\.it' , "filecloud.io" ), + (r'nowdownload\.\w+', "nowdownload.sx" ), + (r'nowvideo\.\w+' , "nowvideo.sx" ), + (r'putlocker\.com' , "firedrive.com" ), + (r'share-?rapid\.cz', "multishare.cz" ), + (r'ul\.to' , "uploaded.to" ), + (r'uploaded\.net' , "uploaded.to" ), + (r'uploadhero\.co' , "uploadhero.com" ), + (r'zshares\.net' , "zshare.net" )] def setup(self): - self.account = None - self.type = self.core.pluginManager.findPlugin(self.__name__)[1] or "hoster" self.plugins = [] self.supported = [] self.new_supported = [] + self.account = None + self.pluginclass = None + self.pluginmodule = None + self.pluginname = None + self.plugintype = None - def coreReady(self): - self.account = self.core.accountManager.getAccountPlugin(self.__name__) + self._initPlugin() + + + def _initPlugin(self): + plugin, type = self.core.pluginManager.findPlugin(self.__name__) + + if not plugin: + self.logWarning("Hook plugin will be deactivated due missing plugin reference") + self.setConfig('activated', False) + else: + self.pluginname = self.__name__ + self.plugintype = type + self.pluginmodule = self.core.pluginManager.loadModule(type, self.__name__) + self.pluginclass = getattr(self.pluginmodule, self.__name__) + + + def _loadAccount(self): + self.account = self.core.accountManager.getAccountPlugin(self.pluginname) if self.account and not self.account.canUse(): self.account = None - if not self.account: - self.logWarning("MultiHook will be deactivated due missing account reference") + if not self.account and hasattr(self.pluginclass, "LOGIN_ACCOUNT") and not self.pluginclass.LOGIN_ACCOUNT: + self.logWarning("Hook plugin will be deactivated due missing account reference") self.setConfig('activated', False) + def coreReady(self): + self._loadAccount() + + def getURL(self, *args, **kwargs): #@TODO: Remove in 0.4.10 """ see HTTPRequest for argument list """ h = pyreq.getHTTPRequest(timeout=120) @@ -81,19 +107,19 @@ class MultiHook(Hook): return default - def pluginCached(self): + def pluginsCached(self): if not self.plugins: try: - pluginset = self.pluginSet(self.getHosters() if self.type == "hoster" else self.getCrypters()) + pluginset = self._pluginSet(self.getHosters() if self.plugintype == "hoster" else self.getCrypters()) except Exception, e: self.logError(e) return [] try: - configmode = self.getConfig("mode", 'all') + configmode = self.getConfig("pluginmode", 'all') if configmode in ("listed", "unlisted"): pluginlist = self.getConfig("pluginlist", '').replace('|', ',').replace(';', ',').split(',') - configset = self.pluginSet(pluginlist) + configset = self._pluginSet(pluginlist) if configmode == "listed": pluginset &= configset @@ -108,13 +134,14 @@ class MultiHook(Hook): return self.plugins - def pluginSet(self, plugins): + def _pluginSet(self, plugins): plugins = set((str(x).strip().lower() for x in plugins)) - for rep in self.PLUGIN_REPLACEMENTS: - if rep[0] in plugins: - plugins.remove(rep[0]) - plugins.add(rep[1]) + for rf, rt in self.DOMAIN_REPLACEMENTS: + regex = re.compile(rf) + for p in filter(lambda x: regex.match(x), plugins): + plugins.remove(p) + plugins.add(re.sub(rf, rt, p)) plugins.discard('') @@ -139,9 +166,7 @@ class MultiHook(Hook): def periodical(self): """reload plugin list periodically""" - self.interval = max(self.getConfig("interval", 0), self.MIN_INTERVAL) - - self.logInfo(_("Reloading supported %s list") % self.type) + self.logInfo(_("Reloading supported %s list") % self.plugintype) old_supported = self.supported @@ -158,18 +183,24 @@ class MultiHook(Hook): for plugin in old_supported: self.unloadPlugin(plugin) + if self.getConfig("reload", True): + self.interval = max(self.getConfig("reloadinterval", 12), self.MIN_INTERVAL) + else: + self.core.scheduler.removeJob(self.cb) + self.cb = None + def overridePlugins(self): excludedList = [] - if self.type == "hoster": + if self.plugintype == "hoster": pluginMap = dict((name.lower(), name) for name in self.core.pluginManager.hosterPlugins.iterkeys()) accountList = [account.type.lower() for account in self.core.api.getAccounts(False) if account.valid and account.premium] else: pluginMap = {} accountList = [name[::-1].replace("Folder"[::-1], "", 1).lower()[::-1] for name in self.core.pluginManager.crypterPlugins.iterkeys()] - for plugin in self.pluginCached(): + for plugin in self.pluginsCached(): name = remove_chars(plugin, "-.") if name in accountList: @@ -181,42 +212,39 @@ class MultiHook(Hook): self.new_supported.append(plugin) if not self.supported and not self.new_supported: - self.logError(_("No %s loaded") % self.type) + self.logError(_("No %s loaded") % self.plugintype) return - module = self.core.pluginManager.getPlugin(self.__name__) - klass = getattr(module, self.__name__) - # inject plugin plugin - self.logDebug("Overwritten %ss: %s" % (self.type, ", ".join(sorted(self.supported)))) + self.logDebug("Overwritten %ss: %s" % (self.plugintype, ", ".join(sorted(self.supported)))) for plugin in self.supported: - hdict = self.core.pluginManager.plugins[self.type][plugin] - hdict['new_module'] = module - hdict['new_name'] = self.__name__ + hdict = self.core.pluginManager.plugins[self.plugintype][plugin] + hdict['new_module'] = self.pluginmodule + hdict['new_name'] = self.pluginname if excludedList: - self.logInfo(_("%ss not overwritten: %s") % (self.type.capitalize(), ", ".join(sorted(excludedList)))) + self.logInfo(_("%ss not overwritten: %s") % (self.plugintype.capitalize(), ", ".join(sorted(excludedList)))) if self.new_supported: plugins = sorted(self.new_supported) - self.logDebug("New %ss: %s" % (self.type, ", ".join(plugins))) + self.logDebug("New %ss: %s" % (self.plugintype, ", ".join(plugins))) # create new regexp regexp = r'.*(%s).*' % "|".join([x.replace(".", "\.") for x in plugins]) - if hasattr(klass, "__pattern__") and isinstance(klass.__pattern__, basestring) and '://' in klass.__pattern__: - regexp = r'%s|%s' % (klass.__pattern__, regexp) + if hasattr(self.pluginclass, "__pattern__") and isinstance(self.pluginclass.__pattern__, basestring) and '://' in self.pluginclass.__pattern__: + regexp = r'%s|%s' % (self.pluginclass.__pattern__, regexp) self.logDebug("Regexp: %s" % regexp) - hdict = self.core.pluginManager.plugins[self.type][self.__name__] + hdict = self.core.pluginManager.plugins[self.plugintype][self.pluginname] hdict['pattern'] = regexp hdict['re'] = re.compile(regexp) def unloadPlugin(self, plugin): - hdict = self.core.pluginManager.plugins[self.type][plugin] + hdict = self.core.pluginManager.plugins[self.plugintype][plugin] if "module" in hdict: del hdict['module'] @@ -231,18 +259,24 @@ class MultiHook(Hook): self.unloadPlugin(plugin) # reset pattern - klass = getattr(self.core.pluginManager.getPlugin(self.__name__), self.__name__) - hdict = self.core.pluginManager.plugins[self.type][self.__name__] + hdict = self.core.pluginManager.plugins[self.plugintype][self.pluginname] - hdict['pattern'] = getattr(klass, "__pattern__", r'^unmatchable$') + hdict['pattern'] = getattr(self.pluginclass, "__pattern__", r'^unmatchable$') hdict['re'] = re.compile(hdict['pattern']) def downloadFailed(self, pyfile): """remove plugin override if download fails but not if file is offline/temp.offline""" - if pyfile.hasStatus("failed") and self.getConfig("revertfailed", True): - hdict = self.core.pluginManager.plugins[self.type][pyfile.pluginname] - if "new_name" in hdict and hdict['new_name'] == self.__name__: + if pyfile.status != 8 or not self.getConfig("revertfailed", True): + return + + hdict = self.core.pluginManager.plugins[self.plugintype][pyfile.pluginname] + if "new_name" in hdict and hdict['new_name'] == self.pluginname: + if pyfile.error == "MultiHook": self.logDebug("Unload MultiHook", pyfile.pluginname, hdict) self.unloadPlugin(pyfile.pluginname) pyfile.setStatus("queued") + else: + retries = max(self.getConfig("retry", 10), 0) + wait_time = max(self.getConfig("retryinterval", 1), 0) + pyfile.plugin.retry(retries, wait_time, "MultiHook") diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index 60320399a..ae06eaf4b 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, r class MultiHoster(SimpleHoster): __name__ = "MultiHoster" __type__ = "hoster" - __version__ = "0.29" + __version__ = "0.30" __pattern__ = r'^unmatchable$' @@ -17,12 +17,14 @@ class MultiHoster(SimpleHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + CHECK_TRAFFIC = True LOGIN_ACCOUNT = True def setup(self): - self.chunkLimit = 1 - self.multiDL = self.premium + self.chunkLimit = 1 + self.multiDL = bool(self.account) + self.resumeDownload = self.premium def prepare(self): @@ -76,7 +78,8 @@ class MultiHoster(SimpleHoster): if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): self.logDebug("Handled as premium download") self.handlePremium() - else: + + elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): self.logDebug("Handled as free download") self.handleFree() @@ -84,11 +87,11 @@ class MultiHoster(SimpleHoster): self.checkFile() - def handlePremium(self, pyfile=None): + def handlePremium(self, pyfile): return self.handleFree(pyfile) - def handleFree(self, pyfile=None): + def handleFree(self, pyfile): if self.premium: raise NotImplementedError else: diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index bfc473801..e16e45405 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -12,7 +12,7 @@ from module.utils import fixup class SimpleCrypter(Crypter, SimpleHoster): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.37" + __version__ = "0.38" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package'] @@ -82,6 +82,8 @@ class SimpleCrypter(Crypter, SimpleHoster): def prepare(self): + self.pyfile.error = "" #@TODO: Remove in 0.4.10 + self.info = {} self.links = [] #@TODO: Move to hoster class in 0.4.10 diff --git a/module/plugins/internal/SimpleDereferer.py b/module/plugins/internal/SimpleDereferer.py index 04d63658e..53b80f827 100644 --- a/module/plugins/internal/SimpleDereferer.py +++ b/module/plugins/internal/SimpleDereferer.py @@ -5,13 +5,13 @@ import re from urllib import unquote from module.plugins.Crypter import Crypter -from module.plugins.internal.SimpleHoster import _isDirectLink, set_cookies +from module.plugins.internal.SimpleHoster import directLink, set_cookies class SimpleDereferer(Crypter): __name__ = "SimpleDereferer" __type__ = "crypter" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -45,7 +45,7 @@ class SimpleDereferer(Crypter): def decrypt(self, pyfile): - link = _isDirectLink(pyfile.url) + link = directLink(self, pyfile.url) if not link: try: diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index c87a6160f..991dc6240 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -10,6 +10,7 @@ from urlparse import urljoin, urlparse from module.PyFile import statusMap as _statusMap from module.network.CookieJar import CookieJar +from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL from module.plugins.Hoster import Hoster from module.plugins.Plugin import Fail @@ -126,7 +127,7 @@ def timestamp(): #@TODO: Move to hoster class in 0.4.10 -def _isDirectLink(self, url, resumable=False): +def directLink(self, url, resumable=False): link = "" for i in xrange(5 if resumable else 1): @@ -182,7 +183,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "0.90" + __version__ = "0.91" __pattern__ = r'^unmatchable$' @@ -244,18 +245,32 @@ class SimpleHoster(Hoster): CHECK_TRAFFIC = False #: Set to True to force checking traffic left for premium account DIRECT_LINK = None #: Set to True to looking for direct link (as defined in handleDirect method), set to None to do it if self.account is True else False MULTI_HOSTER = False #: Set to True to leech other hoster link (as defined in handleMulti method) + LOGIN_ACCOUNT = False #: Set to True to require account login + + directLink = directLink #@TODO: Remove in 0.4.10 @classmethod - def parseInfos(cls, urls): + def parseInfos(cls, urls): #@TODO: Built-in in 0.4.10 core, then remove from plugins for url in urls: url = replace_patterns(url, cls.FILE_URL_REPLACEMENTS if hasattr(cls, "FILE_URL_REPLACEMENTS") else cls.URL_REPLACEMENTS) #@TODO: Remove FILE_URL_REPLACEMENTS check in 0.4.10 yield cls.getInfo(url) + @classmethod + def apiInfo(cls, url="", get={}, post={}): + url = unquote(url) + return {'name' : (urlparse(url).path.split('/')[-1] + or urlparse(url).query.split('&', 1)[0].split('=', 1)[1] + or _("Unknown")), + 'size' : 0, + 'status': 3, + 'url' : url} + + @classmethod def getInfo(cls, url="", html=""): - info = {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3, 'url': url} + info = cls.apiInfo(url) online = False try: @@ -268,7 +283,7 @@ class SimpleHoster(Hoster): info['error'] = "missing url" info['status'] = 1 - else: + elif info['status'] is 3: try: html = getURL(url, cookies=cls.COOKIES, decode=not cls.TEXT_ENCODING) @@ -343,11 +358,16 @@ class SimpleHoster(Hoster): def prepare(self): + self.pyfile.error = "" #@TODO: Remove in 0.4.10 + self.info = {} self.link = "" #@TODO: Move to hoster class in 0.4.10 self.directDL = False #@TODO: Move to hoster class in 0.4.10 self.multihost = False #@TODO: Move to hoster class in 0.4.10 + if self.LOGIN_ACCOUNT and not self.account: + self.fail(_("Required account not found")) + self.req.setOption("timeout", 120) if isinstance(self.COOKIES, list): @@ -399,7 +419,7 @@ class SimpleHoster(Hoster): self.logDebug("Handled as premium download") self.handlePremium() - else: + elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): self.logDebug("Handled as free download") self.handleFree() @@ -420,15 +440,12 @@ class SimpleHoster(Hoster): elif not self.lastDownload or not exists(fs_encode(self.lastDownload)): self.lastDownload = "" - - errmsg = _("No file downloaded") - if 'error' in self.info: - self.fail(errmsg, self.info['error']) - else: - self.fail(errmsg) + self.fail(errmsg, self.pyfile.error or _("No file downloaded")) else: - rules = {'empty file': re.compile(r"^$")} + rules = {'empty file': re.compile(r'\A\Z'), + 'html file' : re.compile(r'\A\s*)?\d{3}[^\d]*')} if hasattr(self, 'ERROR_PATTERN'): rules['error'] = re.compile(self.ERROR_PATTERN) @@ -529,7 +546,7 @@ class SimpleHoster(Hoster): def handleDirect(self, pyfile): - link = _isDirectLink(self, pyfile.url, self.resumeDownload) + link = self.directLink(pyfile.url, self.resumeDownload) if link: self.logInfo(_("Direct download link detected")) @@ -543,9 +560,9 @@ class SimpleHoster(Hoster): pass - def handleFree(self, pyfile=None): + def handleFree(self, pyfile): if not hasattr(self, 'LINK_FREE_PATTERN'): - self.fail(_("Free download not implemented")) + self.logError(_("Free download not implemented")) try: m = re.search(self.LINK_FREE_PATTERN, self.html) @@ -558,9 +575,11 @@ class SimpleHoster(Hoster): self.fail(e) - def handlePremium(self, pyfile=None): + def handlePremium(self, pyfile): if not hasattr(self, 'LINK_PREMIUM_PATTERN'): - self.fail(_("Premium download not implemented")) + self.logError(_("Premium download not implemented")) + self.logDebug("Handled as free download") + self.handleFree() try: m = re.search(self.LINK_PREMIUM_PATTERN, self.html) diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 2784ecd0b..263d78ff8 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies class XFSAccount(Account): __name__ = "XFSAccount" __type__ = "account" - __version__ = "0.33" + __version__ = "0.34" __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" @@ -35,7 +35,7 @@ class XFSAccount(Account): LEECH_TRAFFIC_PATTERN = r'Leech Traffic left:.*?(?P[\d.,]+|[Uu]nlimited)\s*(?:(?P[\w^_]+)\s*)?' LEECH_TRAFFIC_UNIT = "MB" #: used only if no group was found - LOGIN_FAIL_PATTERN = r'>\s*(Incorrect Login or Password|Error<)' + LOGIN_FAIL_PATTERN = r'Incorrect Login or Password|account was banned|Error<' def __init__(self, manager, accounts): #@TODO: remove in 0.4.10 @@ -76,10 +76,10 @@ class XFSAccount(Account): self.logDebug("Valid until: %s" % validuntil) if validuntil > mktime(gmtime()): - premium = True + premium = True trafficleft = -1 else: - premium = False + premium = False validuntil = None #: registered account type (not premium) else: self.logDebug("VALID_UNTIL_PATTERN not found") diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py index 4b57dab90..3cb837aac 100644 --- a/module/plugins/internal/XFSCrypter.py +++ b/module/plugins/internal/XFSCrypter.py @@ -16,7 +16,6 @@ class XFSCrypter(SimpleCrypter): HOSTER_DOMAIN = None - HOSTER_NAME = None URL_REPLACEMENTS = [(r'&?per_page=\d+', ""), (r'[?/&]+$', ""), (r'(.+/[^?]+)$', r'\1?'), (r'$', r'&per_page=10000')] diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index e15504d16..873df8989 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -15,7 +15,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.34" + __version__ = "0.35" __pattern__ = r'^unmatchable$' @@ -27,7 +27,6 @@ class XFSHoster(SimpleHoster): HOSTER_DOMAIN = None - HOSTER_NAME = None TEXT_ENCODING = False COOKIES = [(HOSTER_DOMAIN, "lang", "english")] @@ -66,9 +65,6 @@ class XFSHoster(SimpleHoster): if not self.HOSTER_DOMAIN: self.fail(_("Missing HOSTER_DOMAIN")) - if not self.HOSTER_NAME: - self.HOSTER_NAME = "".join([str.capitalize() for str in self.HOSTER_DOMAIN.split('.')]) - if not self.LINK_PATTERN: pattern = r'(https?://(www\.)?([^/]*?%s|\d+\.\d+\.\d+\.\d+)(\:\d+)?(/d/|(/files)?/\d+/\w+/).+?)["\'<]' self.LINK_PATTERN = pattern % self.HOSTER_DOMAIN.replace('.', '\.') @@ -82,10 +78,8 @@ class XFSHoster(SimpleHoster): self.directDL = bool(self.premium) - def handleFree(self, pyfile=None): - link = self.getDownloadLink() - - if link: + def downloadLink(self, link): + if link and isinstance(link, basestring): if self.captcha: self.correctCaptcha() @@ -101,11 +95,7 @@ class XFSHoster(SimpleHoster): self.fail(_("Download link not found")) - def handlePremium(self, pyfile=None): - return self.handleFree(pyfile) - - - def getDownloadLink(self): + def handleFree(self, pyfile): for i in xrange(1, 6): self.logDebug("Getting download link: #%d" % i) @@ -119,7 +109,7 @@ class XFSHoster(SimpleHoster): self.req.http.c.setopt(FOLLOWLOCATION, 0) - self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True) + self.html = self.load(pyfile.url, post=data, ref=True, decode=True) self.req.http.c.setopt(FOLLOWLOCATION, 1) @@ -136,7 +126,11 @@ class XFSHoster(SimpleHoster): self.errmsg = None - return m.group(1).strip() #@TODO: Remove .strip() in 0.4.10 + self.link = m.group(1).strip() #@TODO: Remove .strip() in 0.4.10 + + + def handlePremium(self, pyfile): + return self.handleFree(pyfile) def handleMulti(self, pyfile): -- cgit v1.2.3 From 36e60a23497ae05736c24fed2f4ce936fb61f744 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 8 Jan 2015 23:31:33 +0100 Subject: "New Year" Update: account plugins --- module/plugins/accounts/AlldebridCom.py | 5 +- module/plugins/accounts/BackinNet.py | 16 ++++++ module/plugins/accounts/BitshareCom.py | 6 ++- module/plugins/accounts/CatShareNet.py | 5 +- module/plugins/accounts/CloudzillaTo.py | 5 +- module/plugins/accounts/CzshareCom.py | 12 ++--- module/plugins/accounts/DebridItaliaCom.py | 5 +- module/plugins/accounts/DepositfilesCom.py | 6 ++- module/plugins/accounts/EuroshareEu.py | 12 ++--- module/plugins/accounts/FastixRu.py | 5 +- module/plugins/accounts/File4safeCom.py | 8 +-- module/plugins/accounts/FilecloudIo.py | 8 +-- module/plugins/accounts/FilefactoryCom.py | 10 ++-- module/plugins/accounts/FilejungleCom.py | 17 ++++--- module/plugins/accounts/FilerNet.py | 13 +++-- module/plugins/accounts/FilesMailRu.py | 14 ++++-- module/plugins/accounts/FourSharedCom.py | 33 ------------- module/plugins/accounts/FreakshareCom.py | 8 +-- module/plugins/accounts/FreeWayMe.py | 15 +++--- module/plugins/accounts/FshareVn.py | 20 ++++---- module/plugins/accounts/HellshareCz.py | 21 ++++---- module/plugins/accounts/HundredEightyUploadCom.py | 16 ------ module/plugins/accounts/Keep2shareCc.py | 33 +++++++------ module/plugins/accounts/LetitbitNet.py | 4 +- module/plugins/accounts/LinksnappyCom.py | 14 ++++-- module/plugins/accounts/MegaRapidCz.py | 23 ++++----- module/plugins/accounts/MegasharesCom.py | 14 +++--- module/plugins/accounts/MultihostersCom.py | 52 ++++---------------- module/plugins/accounts/MultishareCz.py | 12 ++--- module/plugins/accounts/MyfastfileCom.py | 6 ++- module/plugins/accounts/NetloadIn.py | 12 +++-- module/plugins/accounts/NowVideoSx.py | 7 +-- module/plugins/accounts/OboomCom.py | 7 ++- module/plugins/accounts/OneFichierCom.py | 55 --------------------- module/plugins/accounts/PremiumTo.py | 5 +- module/plugins/accounts/PremiumizeMe.py | 4 +- module/plugins/accounts/PutdriveCom.py | 16 ++++++ module/plugins/accounts/QuickshareCz.py | 12 ++--- module/plugins/accounts/RPNetBiz.py | 4 +- module/plugins/accounts/RapidgatorNet.py | 5 +- module/plugins/accounts/RealdebridCom.py | 8 ++- module/plugins/accounts/RehostTo.py | 9 ++-- module/plugins/accounts/ShareonlineBiz.py | 7 ++- module/plugins/accounts/SimplyPremiumCom.py | 4 +- module/plugins/accounts/SimplydebridCom.py | 7 +-- module/plugins/accounts/SmoozedCom.py | 53 +++++++++++--------- module/plugins/accounts/StahnuTo.py | 11 +++-- module/plugins/accounts/TurbobitNet.py | 11 +++-- module/plugins/accounts/UnrestrictLi.py | 6 +-- module/plugins/accounts/UploadableCh.py | 5 +- module/plugins/accounts/UploadedTo.py | 9 ++-- module/plugins/accounts/UploadheroCom.py | 5 +- module/plugins/accounts/YibaishiwuCom.py | 14 +++--- module/plugins/accounts/ZeveraCom.py | 53 +++++++++++--------- module/plugins/accounts/_180UploadCom.py | 16 ++++++ module/plugins/accounts/_1FichierCom.py | 60 +++++++++++++++++++++++ module/plugins/accounts/_4SharedCom.py | 34 +++++++++++++ 57 files changed, 473 insertions(+), 384 deletions(-) create mode 100644 module/plugins/accounts/BackinNet.py delete mode 100644 module/plugins/accounts/FourSharedCom.py delete mode 100644 module/plugins/accounts/HundredEightyUploadCom.py delete mode 100644 module/plugins/accounts/OneFichierCom.py create mode 100644 module/plugins/accounts/PutdriveCom.py create mode 100644 module/plugins/accounts/_180UploadCom.py create mode 100644 module/plugins/accounts/_1FichierCom.py create mode 100644 module/plugins/accounts/_4SharedCom.py (limited to 'module') diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 278f3af06..1f2371e28 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -13,7 +13,7 @@ from module.plugins.Account import Account class AlldebridCom(Account): __name__ = "AlldebridCom" __type__ = "account" - __version__ = "0.22" + __version__ = "0.23" __description__ = """AllDebrid.com account plugin""" __license__ = "GPLv3" @@ -55,7 +55,8 @@ class AlldebridCom(Account): html = req.load("http://www.alldebrid.com/register/", get={'action' : "login", 'login_login' : user, - 'login_password': data['password']}) + 'login_password': data['password']}, + decode=True) if "This login doesn't exist" in html \ or "The password is not valid" in html \ diff --git a/module/plugins/accounts/BackinNet.py b/module/plugins/accounts/BackinNet.py new file mode 100644 index 000000000..46c8d7ac5 --- /dev/null +++ b/module/plugins/accounts/BackinNet.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class BackinNet(XFSAccount): + __name__ = "BackinNet" + __type__ = "account" + __version__ = "0.01" + + __description__ = """Backin.net account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "backin.net" diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index 960ff6c3c..412aae534 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -6,7 +6,7 @@ from module.plugins.Account import Account class BitshareCom(Account): __name__ = "BitshareCom" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __description__ = """Bitshare account plugin""" __license__ = "GPLv3" @@ -27,7 +27,9 @@ class BitshareCom(Account): def login(self, user, data, req): html = req.load("http://bitshare.com/login.html", - post={"user": user, "password": data['password'], "submit": "Login"}, cookies=True) + post={"user": user, "password": data['password'], "submit": "Login"}, + cookies=True, + decode=True) if "login" in req.lastEffectiveURL: self.wrongPassword() diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py index c33219685..bcb14bee3 100644 --- a/module/plugins/accounts/CatShareNet.py +++ b/module/plugins/accounts/CatShareNet.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class CatShareNet(Account): __name__ = "CatShareNet" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """CatShareNet account plugin""" __license__ = "GPLv3" @@ -50,7 +50,8 @@ class CatShareNet(Account): post={'user_email': user, 'user_password': data['password'], 'remindPassword': 0, - 'user[submit]': "Login"}) + 'user[submit]': "Login"}, + decode=True) if not 'Wyloguj' in html: self.wrongPassword() diff --git a/module/plugins/accounts/CloudzillaTo.py b/module/plugins/accounts/CloudzillaTo.py index f0676f42f..d22d5e4b3 100644 --- a/module/plugins/accounts/CloudzillaTo.py +++ b/module/plugins/accounts/CloudzillaTo.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class CloudzillaTo(Account): __name__ = "CloudzillaTo" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Cloudzilla.to account plugin""" __license__ = "GPLv3" @@ -30,7 +30,8 @@ class CloudzillaTo(Account): html = req.load("http://www.cloudzilla.to/", post={'lusername': user, 'lpassword': data['password'], - 'w' : "dologin"}) + 'w' : "dologin"}, + decode=True) if "ERROR" in html: self.wrongPassword() diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 414883228..f84bc67f3 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class CzshareCom(Account): __name__ = "CzshareCom" __type__ = "account" - __version__ = "0.15" + __version__ = "0.16" __description__ = """Czshare.com account plugin, now Sdilej.cz""" __license__ = "GPLv3" @@ -33,11 +33,11 @@ class CzshareCom(Account): def login(self, user, data, req): - html = req.load('https://sdilej.cz/index.php', post={ - "Prihlasit": "Prihlasit", - "login-password": data['password'], - "login-name": user - }) + html = req.load('https://sdilej.cz/index.php', + post={"Prihlasit": "Prihlasit", + "login-password": data['password'], + "login-name": user}, + decode=True) if '' in html: self.wrongPassword() diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py index c75f8ee33..f92a4e821 100644 --- a/module/plugins/accounts/EuroshareEu.py +++ b/module/plugins/accounts/EuroshareEu.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class EuroshareEu(Account): __name__ = "EuroshareEu" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Euroshare.eu account plugin""" __license__ = "GPLv3" @@ -31,11 +31,11 @@ class EuroshareEu(Account): def login(self, user, data, req): - html = req.load('http://euroshare.eu/customer-zone/login/', post={ - "trvale": "1", - "login": user, - "password": data['password'] - }, decode=True) + html = req.load('http://euroshare.eu/customer-zone/login/', + post={"trvale": "1", + "login": user, + "password": data['password']}, + decode=True) if u">Nesprávne prihlasovacie meno alebo heslo" in html: self.wrongPassword() diff --git a/module/plugins/accounts/FastixRu.py b/module/plugins/accounts/FastixRu.py index d33d611c9..51be3880f 100644 --- a/module/plugins/accounts/FastixRu.py +++ b/module/plugins/accounts/FastixRu.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FastixRu(Account): __name__ = "FastixRu" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Fastix account plugin""" __license__ = "GPLv3" @@ -31,8 +31,11 @@ class FastixRu(Account): def login(self, user, data, req): html = req.load("http://fastix.ru/api_v2/", get={'sub': "get_apikey", 'email': user, 'password': data['password']}) + api = json_loads(html) api = api['apikey'] + data['api'] = api + if "error_code" in html: self.wrongPassword() diff --git a/module/plugins/accounts/File4safeCom.py b/module/plugins/accounts/File4safeCom.py index 20053d895..50fe1aac8 100644 --- a/module/plugins/accounts/File4safeCom.py +++ b/module/plugins/accounts/File4safeCom.py @@ -3,12 +3,12 @@ from module.plugins.internal.XFSAccount import XFSAccount -class File4safeCom(XFSAccount): - __name__ = "File4safeCom" +class File4SafeCom(XFSAccount): + __name__ = "File4SafeCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" - __description__ = """File4safe.com account plugin""" + __description__ = """File4Safe.com account plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index d20f756f3..8ca55b1bc 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FilecloudIo(Account): __name__ = "FilecloudIo" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """FilecloudIo account plugin""" __license__ = "GPLv3" @@ -19,7 +19,7 @@ class FilecloudIo(Account): # It looks like the first API request always fails, so we retry 5 times, it should work on the second try for _i in xrange(5): rep = req.load("https://secure.filecloud.io/api-fetch_apikey.api", - post={"username": user, "password": self.accounts[user]['password']}) + post={"username": user, "password": self.getAccountData(user)['password']}) rep = json_loads(rep) if rep['status'] == 'ok': break @@ -55,5 +55,5 @@ class FilecloudIo(Account): post=self.form_data, multipart=True) - self.logged_in = True if "you have successfully logged in - filecloud.io" in html else False - self.form_data = {} + if "you have successfully logged in" not in html: + self.wrongPassword() diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index 8394c549e..426d572db 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -11,7 +11,7 @@ from module.plugins.Account import Account class FilefactoryCom(Account): __name__ = "FilefactoryCom" __type__ = "account" - __version__ = "0.14" + __version__ = "0.15" __description__ = """Filefactory.com account plugin""" __license__ = "GPLv3" @@ -40,10 +40,10 @@ class FilefactoryCom(Account): def login(self, user, data, req): req.http.c.setopt(REFERER, "http://www.filefactory.com/member/login.php") - html = req.load("http://www.filefactory.com/member/signin.php", post={ - "loginEmail": user, - "loginPassword": data['password'], - "Submit": "Sign In"}) + html = req.load("http://www.filefactory.com/member/signin.php", + post={"loginEmail" : user, + "loginPassword": data['password'], + "Submit" : "Sign In"}) if req.lastEffectiveURL != "http://www.filefactory.com/account/": self.wrongPassword() diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py index a3ec7af64..9f7474207 100644 --- a/module/plugins/accounts/FilejungleCom.py +++ b/module/plugins/accounts/FilejungleCom.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class FilejungleCom(Account): __name__ = "FilejungleCom" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __description__ = """Filejungle.com account plugin""" __license__ = "GPLv3" @@ -37,13 +37,14 @@ class FilejungleCom(Account): def login(self, user, data, req): - html = req.load(self.URL + "login.php", post={ - "loginUserName": user, - "loginUserPassword": data['password'], - "loginFormSubmit": "Login", - "recaptcha_challenge_field": "", - "recaptcha_response_field": "", - "recaptcha_shortencode_field": ""}) + html = req.load(self.URL + "login.php", + post={"loginUserName": user, + "loginUserPassword": data['password'], + "loginFormSubmit": "Login", + "recaptcha_challenge_field": "", + "recaptcha_response_field": "", + "recaptcha_shortencode_field": ""}, + decode=True) if re.search(self.LOGIN_FAILED_PATTERN, html): self.wrongPassword() diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index a845e7ba4..4067445af 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class FilerNet(Account): __name__ = "FilerNet" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """Filer.net account plugin""" __license__ = "GPLv3" @@ -44,9 +44,16 @@ class FilerNet(Account): def login(self, user, data, req): html = req.load("https://filer.net/login") + token = re.search(self.TOKEN_PATTERN, html).group(1) + html = req.load("https://filer.net/login_check", - post={"_username": user, "_password": data['password'], - "_remember_me": "on", "_csrf_token": token, "_target_path": "https://filer.net/"}) + post={"_username": user, + "_password": data['password'], + "_remember_me": "on", + "_csrf_token": token, + "_target_path": "https://filer.net/"}, + decode=True) + if 'Logout' not in html: self.wrongPassword() diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py index f91f4d5ba..15926589e 100644 --- a/module/plugins/accounts/FilesMailRu.py +++ b/module/plugins/accounts/FilesMailRu.py @@ -6,7 +6,7 @@ from module.plugins.Account import Account class FilesMailRu(Account): __name__ = "FilesMailRu" __type__ = "account" - __version__ = "0.10" + __version__ = "0.11" __description__ = """Filesmail.ru account plugin""" __license__ = "GPLv3" @@ -20,9 +20,13 @@ class FilesMailRu(Account): def login(self, user, data, req): user, domain = user.split("@") - html = req.load("http://swa.mail.ru/cgi-bin/auth", None, - {"Domain": domain, "Login": user, "Password": data['password'], - "Page": "http://files.mail.ru/"}, cookies=True) + html = req.load("http://swa.mail.ru/cgi-bin/auth", + post={"Domain": domain, + "Login": user, + "Password": data['password'], + "Page": "http://files.mail.ru/"}, + cookies=True, + decode=True) - if "Неверное имя пользователя или пароль" in html: # @TODO seems not to work + if "Неверное имя пользователя или пароль" in html: self.wrongPassword() diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py deleted file mode 100644 index ec19f83f5..000000000 --- a/module/plugins/accounts/FourSharedCom.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.Account import Account - - -class FourSharedCom(Account): - __name__ = "FourSharedCom" - __type__ = "account" - __version__ = "0.03" - - __description__ = """FourShared.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] - - - def loadAccountInfo(self, user, req): - # Free mode only for now - return {"premium": False} - - - def login(self, user, data, req): - req.cj.setCookie("4shared.com", "4langcookie", "en") - res = req.load('http://www.4shared.com/web/login', - post={'login': user, - 'password': data['password'], - 'remember': "on", - '_remember': "on", - 'returnTo': "http://www.4shared.com/account/home.jsp"}) - - if 'Please log in to access your 4shared account' in res: - self.wrongPassword() diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py index 576d835e2..83f4a9a84 100644 --- a/module/plugins/accounts/FreakshareCom.py +++ b/module/plugins/accounts/FreakshareCom.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class FreakshareCom(Account): __name__ = "FreakshareCom" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __description__ = """Freakshare.com account plugin""" __license__ = "GPLv3" @@ -44,8 +44,10 @@ class FreakshareCom(Account): def login(self, user, data, req): req.load("http://freakshare.com/index.php?language=EN") - html = req.load("http://freakshare.com/login.html", None, - {"submit": "Login", "user": user, "pass": data['password']}, cookies=True) + html = req.load("http://freakshare.com/login.html", + post={"submit": "Login", "user": user, "pass": data['password']}, + cookies=True, + decode=True) if ">Wrong Username or Password" in html: self.wrongPassword() diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index 3b9841630..14b9f1e9a 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FreeWayMe(Account): __name__ = "FreeWayMe" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __description__ = """FreeWayMe account plugin""" __license__ = "GPLv3" @@ -16,8 +16,7 @@ class FreeWayMe(Account): def loadAccountInfo(self, user, req): status = self.getAccountStatus(user, req) - if not status: - return False + self.logDebug(status) account_info = {"validuntil": -1, "premium": False} @@ -33,10 +32,6 @@ class FreeWayMe(Account): return account_info - def getpw(self, user): - return self.accounts[user]['password'] - - def login(self, user, data, req): status = self.getAccountStatus(user, req) @@ -47,9 +42,11 @@ class FreeWayMe(Account): def getAccountStatus(self, user, req): answer = req.load("https://www.free-way.me/ajax/jd.php", - get={"id": 4, "user": user, "pass": self.accounts[user]['password']}) + get={"id": 4, "user": user, "pass": self.getAccountData(user)['password']}) + self.logDebug("Login: %s" % answer) + if answer == "Invalid login": self.wrongPassword() - return False + return json_loads(answer) diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index 2da45aac6..66d912958 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -1,16 +1,16 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime -from pycurl import REFERER import re +from time import mktime, strptime + from module.plugins.Account import Account class FshareVn(Account): __name__ = "FshareVn" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __description__ = """Fshare.vn account plugin""" __license__ = "GPLv3" @@ -46,13 +46,13 @@ class FshareVn(Account): def login(self, user, data, req): - req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php") - - html = req.load('https://www.fshare.vn/login.php', post={ - "login_password": data['password'], - "login_useremail": user, - "url_refe": "http://www.fshare.vn/index.php" - }, referer=True, decode=True) + html = req.load("https://www.fshare.vn/login.php", + post={'LoginForm[email]' : user, + 'LoginForm[password]' : data['password'], + 'LoginForm[rememberMe]': 1, + 'yt0' : "Login"}, + referer=True, + decode=True) if not re.search(r'You input a wrong user name or wrong password

" in html: self.wrongPassword() diff --git a/module/plugins/accounts/HundredEightyUploadCom.py b/module/plugins/accounts/HundredEightyUploadCom.py deleted file mode 100644 index 39f91a8af..000000000 --- a/module/plugins/accounts/HundredEightyUploadCom.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.XFSAccount import XFSAccount - - -class HundredEightyUploadCom(XFSAccount): - __name__ = "HundredEightyUploadCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """180upload.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "180upload.com" diff --git a/module/plugins/accounts/Keep2shareCc.py b/module/plugins/accounts/Keep2shareCc.py index fac3cc4a6..e855fb977 100644 --- a/module/plugins/accounts/Keep2shareCc.py +++ b/module/plugins/accounts/Keep2shareCc.py @@ -7,12 +7,12 @@ from time import gmtime, mktime, strptime from module.plugins.Account import Account -class Keep2shareCc(Account): - __name__ = "Keep2shareCc" +class Keep2ShareCc(Account): + __name__ = "Keep2ShareCc" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" - __description__ = """Keep2share.cc account plugin""" + __description__ = """Keep2Share.cc account plugin""" __license__ = "GPLv3" __authors__ = [("aeronaut", "aeronaut@pianoguy.de")] @@ -35,18 +35,22 @@ class Keep2shareCc(Account): expiredate = m.group(1).strip() self.logDebug("Expire date: " + expiredate) - try: - validuntil = mktime(strptime(expiredate, "%Y.%m.%d")) + if expiredate == "LifeTime": + premium = True + validuntil = -1 + else: + try: + validuntil = mktime(strptime(expiredate, "%Y.%m.%d")) - except Exception, e: - self.logError(e) + except Exception, e: + self.logError(e) - else: - if validuntil > mktime(gmtime()): - premium = True else: - premium = False - validuntil = None + if validuntil > mktime(gmtime()): + premium = True + else: + premium = False + validuntil = None m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: @@ -66,7 +70,8 @@ class Keep2shareCc(Account): post={'LoginForm[username]' : user, 'LoginForm[password]' : data['password'], 'LoginForm[rememberMe]': 1, - 'yt0' : ""}) + 'yt0' : ""}, + decode=True) if re.search(self.LOGIN_FAIL_PATTERN, html): self.wrongPassword() diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py index b8244a06d..7f973d2d3 100644 --- a/module/plugins/accounts/LetitbitNet.py +++ b/module/plugins/accounts/LetitbitNet.py @@ -7,7 +7,7 @@ from module.plugins.Account import Account class LetitbitNet(Account): __name__ = "LetitbitNet" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Letitbit.net account plugin""" __license__ = "GPLv3" @@ -16,7 +16,7 @@ class LetitbitNet(Account): def loadAccountInfo(self, user, req): ## DISABLED BECAUSE IT GET 'key exausted' EVEN IF VALID ## - # api_key = self.accounts[user]['password'] + # api_key = self.getAccountData(user)['password'] # json_data = [api_key, ['key/info']] # api_rep = req.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) # self.logDebug("API Key Info: " + api_rep) diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index 19986157b..dff28a055 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -9,7 +9,7 @@ from module.common.json_layer import json_loads class LinksnappyCom(Account): __name__ = "LinksnappyCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """Linksnappy.com account plugin""" __license__ = "GPLv3" @@ -20,17 +20,22 @@ class LinksnappyCom(Account): data = self.getAccountData(user) r = req.load('http://gen.linksnappy.com/lseAPI.php', get={'act': 'USERDETAILS', 'username': user, 'password': md5(data['password']).hexdigest()}) + self.logDebug("JSON data: " + r) + j = json_loads(r) if j['error']: return {"premium": False} validuntil = j['return']['expire'] + if validuntil == 'lifetime': validuntil = -1 + elif validuntil == 'expired': return {"premium": False} + else: validuntil = float(validuntil) @@ -43,8 +48,11 @@ class LinksnappyCom(Account): def login(self, user, data, req): - r = req.load('http://gen.linksnappy.com/lseAPI.php', - get={'act': 'USERDETAILS', 'username': user, 'password': md5(data['password']).hexdigest()}) + r = req.load("http://gen.linksnappy.com/lseAPI.php", + get={'act' : 'USERDETAILS', + 'username': user, + 'password': md5(data['password']).hexdigest()}, + decode=True) if 'Invalid Account Details' in r: self.wrongPassword() diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py index 41da7ac73..b229fe47d 100644 --- a/module/plugins/accounts/MegaRapidCz.py +++ b/module/plugins/accounts/MegaRapidCz.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class MegaRapidCz(Account): __name__ = "MegaRapidCz" __type__ = "account" - __version__ = "0.34" + __version__ = "0.35" __description__ = """MegaRapid.cz account plugin""" __license__ = "GPLv3" @@ -25,19 +25,19 @@ class MegaRapidCz(Account): def loadAccountInfo(self, user, req): - html = req.load("http://megarapid.cz/mujucet/", decode=True) + htmll = req.load("http://megarapid.cz/mujucet/", decode=True) - m = re.search(self.LIMITDL_PATTERN, html) + m = re.search(self.LIMITDL_PATTERN, htmll) if m: data = self.getAccountData(user) data['options']['limitDL'] = [int(m.group(1))] - m = re.search(self.VALID_UNTIL_PATTERN, html) + m = re.search(self.VALID_UNTIL_PATTERN, htmll) if m: validuntil = mktime(strptime(m.group(1), "%d.%m.%Y - %H:%M")) return {"premium": True, "trafficleft": -1, "validuntil": validuntil} - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + m = re.search(self.TRAFFIC_LEFT_PATTERN, htmll) if m: trafficleft = float(m.group(1)) * (1 << 20) return {"premium": True, "trafficleft": trafficleft, "validuntil": -1} @@ -46,12 +46,13 @@ class MegaRapidCz(Account): def login(self, user, data, req): - htm = req.load("http://megarapid.cz/prihlaseni/") - if "Heslo:" in htm: - start = htm.index('id="inp_hash" name="hash" value="') - htm = htm[start + 33:] - hashes = htm[0:32] - htm = req.load("http://megarapid.cz/prihlaseni/", + html = req.load("http://megarapid.cz/prihlaseni/", decode=True) + + if "Heslo:" in html: + start = html.index('id="inp_hash" name="hash" value="') + html = html[start + 33:] + hashes = html[0:32] + html = req.load("http://megarapid.cz/prihlaseni/", post={"hash": hashes, "login": user, "pass1": data['password'], diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py index 6e0a4358e..127ebadc8 100644 --- a/module/plugins/accounts/MegasharesCom.py +++ b/module/plugins/accounts/MegasharesCom.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class MegasharesCom(Account): __name__ = "MegasharesCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Megashares.com account plugin""" __license__ = "GPLv3" @@ -37,12 +37,12 @@ class MegasharesCom(Account): def login(self, user, data, req): - html = req.load('http://d01.megashares.com/myms_login.php', post={ - "httpref": "", - "myms_login": "Login", - "mymslogin_name": user, - "mymspassword": data['password'] - }, decode=True) + html = req.load('http://d01.megashares.com/myms_login.php', + post={"httpref" : "", + "myms_login" : "Login", + "mymslogin_name": user, + "mymspassword" : data['password']}, + decode=True) if not '%s' % user in html: self.wrongPassword() diff --git a/module/plugins/accounts/MultihostersCom.py b/module/plugins/accounts/MultihostersCom.py index 3f96fdf41..0be64af7f 100644 --- a/module/plugins/accounts/MultihostersCom.py +++ b/module/plugins/accounts/MultihostersCom.py @@ -1,50 +1,16 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime -from module.plugins.Account import Account +from module.plugins.accounts.ZeveraCom import ZeveraCom -class MultihostersCom(Account): - __name__ = "MultihostersCom" - __version__ = "0.01" - __type__ = "account" - __description__ = """Multihosters.com account plugin""" - __author_name__ = "tjeh" - __author_mail__ = "tjeh@gmx.net" - - def loadAccountInfo(self, user, req): - data = self.getAPIData(req) - if data == "No traffic": - account_info = {"trafficleft": 0, "validuntil": 0, "premium": False} - else: - account_info = { - "trafficleft": int(data['availabletodaytraffic']) * 1024, - "validuntil": mktime(strptime(data['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")), - "premium": True - } - return account_info - def login(self, user, data, req): - self.loginname = user - self.password = data['password'] - if self.getAPIData(req) == "No traffic": - self.wrongPassword() +class MultihostersCom(ZeveraCom): + __name__ = "MultihostersCom" + __type__ = "account" + __version__ = "0.02" - def getAPIData(self, req, just_header=False, **kwargs): - get_data = { - 'cmd': 'accountinfo', - 'login': self.loginname, - 'pass': self.password - } - get_data.update(kwargs) + __description__ = """Multihosters.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("tjeh", "tjeh@gmx.net")] - response = req.load("http://www.multihosters.com/jDownloader.ashx", get=get_data, - decode=True, just_header=just_header) - self.logDebug(response) - if ':' in response: - if not just_header: - response = response.replace(',', '\n') - return dict((y.strip().lower(), z.strip()) for (y, z) in - [x.split(':', 1) for x in response.splitlines() if ':' in x]) - else: - return response + API_URL = "http://api.multihosters.com/jDownloader.ashx" diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index 878413007..0ac764ee1 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class MultishareCz(Account): __name__ = "MultishareCz" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """Multishare.cz account plugin""" __license__ = "GPLv3" @@ -34,11 +34,11 @@ class MultishareCz(Account): def login(self, user, data, req): - html = req.load('http://www.multishare.cz/html/prihlaseni_process.php', post={ - "akce": "Přihlásit", - "heslo": data['password'], - "jmeno": user - }, decode=True) + html = req.load('http://www.multishare.cz/html/prihlaseni_process.php', + post={"akce" : "Přihlásit", + "heslo": data['password'], + "jmeno": user}, + decode=True) if '
' in html: self.wrongPassword() diff --git a/module/plugins/accounts/MyfastfileCom.py b/module/plugins/accounts/MyfastfileCom.py index 36923470e..4c75b27f0 100644 --- a/module/plugins/accounts/MyfastfileCom.py +++ b/module/plugins/accounts/MyfastfileCom.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class MyfastfileCom(Account): __name__ = "MyfastfileCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """Myfastfile.com account plugin""" __license__ = "GPLv3" @@ -27,8 +27,10 @@ class MyfastfileCom(Account): def login(self, user, data, req): # Password to use is the API-Password written in http://myfastfile.com/myaccount html = req.load("http://myfastfile.com/api.php", - get={"user": user, "pass": data['password']}) + get={"user": user, "pass": data['password']}) + self.logDebug("JSON data: " + html) + self.json_data = json_loads(html) if self.json_data['status'] != 'ok': self.logError(_('Invalid login. The password to use is the API-Password you find in your "My Account" page')) diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py index 15bad6966..1abd7fa84 100755 --- a/module/plugins/accounts/NetloadIn.py +++ b/module/plugins/accounts/NetloadIn.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class NetloadIn(Account): __name__ = "NetloadIn" __type__ = "account" - __version__ = "0.22" + __version__ = "0.23" __description__ = """Netload.in account plugin""" __license__ = "GPLv3" @@ -33,8 +33,12 @@ class NetloadIn(Account): def login(self, user, data, req): - html = req.load("http://netload.in/index.php", None, - {"txtuser": user, "txtpass": data['password'], "txtcheck": "login", "txtlogin": "Login"}, - cookies=True) + html = req.load("http://netload.in/index.php", + post={"txtuser" : user, + "txtpass" : data['password'], + "txtcheck": "login", + "txtlogin": "Login"}, + cookies=True, + decode=True) if "password or it might be invalid!" in html: self.wrongPassword() diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py index e2dcaba12..f44ae3865 100644 --- a/module/plugins/accounts/NowVideoSx.py +++ b/module/plugins/accounts/NowVideoSx.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class NowVideoSx(Account): __name__ = "NowVideoSx" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """NowVideo.at account plugin""" __license__ = "GPLv3" @@ -50,7 +50,8 @@ class NowVideoSx(Account): def login(self, user, data, req): html = req.load("http://www.nowvideo.sx/login.php", - post={'user': user, 'pass': data['password']}) + post={'user': user, 'pass': data['password']}, + decode=True) - if ">Invalid login details" is html: + if re.search(r'>Log In<', html): self.wrongPassword() diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index 4d90e1b25..0acacbb2a 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -11,7 +11,7 @@ from module.plugins.Account import Account class OboomCom(Account): __name__ = "OboomCom" __type__ = "account" - __version__ = "0.22" + __version__ = "0.23" __description__ = """Oboom.com account plugin""" __license__ = "GPLv3" @@ -20,12 +20,15 @@ class OboomCom(Account): def loadAccountData(self, user, req): passwd = self.getAccountData(user)['password'] - salt = passwd[::-1] + salt = passwd[::-1] pbkdf2 = PBKDF2(passwd, salt, 1000).hexread(16) + result = json_loads(req.load("https://www.oboom.com/1/login", get={"auth": user, "pass": pbkdf2})) + if not result[0] == 200: self.logWarning(_("Failed to log in: %s") % result[1]) self.wrongPassword() + return result[1] diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py deleted file mode 100644 index 2f1c914c1..000000000 --- a/module/plugins/accounts/OneFichierCom.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import strptime, mktime - -from pycurl import REFERER - -from module.plugins.Account import Account - - -class OneFichierCom(Account): - __name__ = "OneFichierCom" - __type__ = "account" - __version__ = "0.11" - - __description__ = """1fichier.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Elrick69", "elrick69[AT]rocketmail[DOT]com"), - ("Walter Purcaro", "vuolter@gmail.com")] - - - VALID_UNTIL_PATTERN = r'Your Premium Status will end the (\d+/\d+/\d+)' - - - def loadAccountInfo(self, user, req): - validuntil = None - trafficleft = -1 - premium = None - - html = req.load("https://1fichier.com/console/abo.pl") - - m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - expiredate = m.group(1) - self.logDebug("Expire date: " + expiredate) - - try: - validuntil = mktime(strptime(expiredate, "%d/%m/%Y")) - except Exception, e: - self.logError(e) - else: - premium = True - - return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium or False} - - - def login(self, user, data, req): - req.http.c.setopt(REFERER, "https://1fichier.com/login.pl?lg=en") - - html = req.load("https://1fichier.com/login.pl?lg=en", - post={'mail': user, 'pass': data['password'], 'It': "on", 'purge': "off", 'valider': "Send"}) - - if '>Invalid email address' in html or '>Invalid password' in html: - self.wrongPassword() diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py index 2c486a1dd..ea6fbbf65 100644 --- a/module/plugins/accounts/PremiumTo.py +++ b/module/plugins/accounts/PremiumTo.py @@ -6,7 +6,7 @@ from module.plugins.Account import Account class PremiumTo(Account): __name__ = "PremiumTo" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __description__ = """Premium.to account plugin""" __license__ = "GPLv3" @@ -30,7 +30,8 @@ class PremiumTo(Account): self.username = user self.password = data['password'] authcode = req.load("http://premium.to/api/getauthcode.php", - get={'username': user, 'password': self.password}).strip() + get={'username': user, 'password': self.password}, + decode=True) if "wrong username" in authcode: self.wrongPassword() diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index c1abde309..7d061ec2d 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -8,7 +8,7 @@ from module.common.json_layer import json_loads class PremiumizeMe(Account): __name__ = "PremiumizeMe" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __description__ = """Premiumize.me account plugin""" __license__ = "GPLv3" @@ -45,5 +45,5 @@ class PremiumizeMe(Account): answer = req.load("https://api.premiumize.me/pm-api/v1.php", get={'method' : "accountstatus", 'params[login]': user, - 'params[pass]' : self.accounts[user]['password']}) + 'params[pass]' : self.getAccountData(user)['password']}) return json_loads(answer) diff --git a/module/plugins/accounts/PutdriveCom.py b/module/plugins/accounts/PutdriveCom.py new file mode 100644 index 000000000..7e7410d4e --- /dev/null +++ b/module/plugins/accounts/PutdriveCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.accounts.ZeveraCom import ZeveraCom + + +class PutdriveCom(ZeveraCom): + __name__ = "PutdriveCom" + __type__ = "account" + __version__ = "0.01" + + __description__ = """Putdrive.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + API_URL = "http://api.putdrive.com/jDownloader.ashx" diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py index 18af5f736..16141d63e 100644 --- a/module/plugins/accounts/QuickshareCz.py +++ b/module/plugins/accounts/QuickshareCz.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class QuickshareCz(Account): __name__ = "QuickshareCz" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Quickshare.cz account plugin""" __license__ = "GPLv3" @@ -33,11 +33,11 @@ class QuickshareCz(Account): def login(self, user, data, req): - html = req.load('http://www.quickshare.cz/html/prihlaseni_process.php', post={ - "akce": u'Přihlásit', - "heslo": data['password'], - "jmeno": user - }, decode=True) + html = req.load('http://www.quickshare.cz/html/prihlaseni_process.php', + post={"akce": u'Přihlásit', + "heslo": data['password'], + "jmeno": user}, + decode=True) if u'>Takový uživatel neexistuje.<' in html or u'>Špatné heslo.<' in html: self.wrongPassword() diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py index 813453c03..829e54a46 100644 --- a/module/plugins/accounts/RPNetBiz.py +++ b/module/plugins/accounts/RPNetBiz.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class RPNetBiz(Account): __name__ = "RPNetBiz" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __description__ = """RPNet.biz account plugin""" __license__ = "GPLv3" @@ -44,7 +44,7 @@ class RPNetBiz(Account): def getAccountStatus(self, user, req): # Using the rpnet API, check if valid premium account res = req.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, "password": self.accounts[user]['password'], + get={"username": user, "password": self.getAccountData(user)['password'], "action": "showAccountInformation"}) self.logDebug("JSON data: %s" % res) diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index 2899d5a68..b29d94228 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class RapidgatorNet(Account): __name__ = "RapidgatorNet" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __description__ = """Rapidgator.net account plugin""" __license__ = "GPLv3" @@ -44,7 +44,9 @@ class RapidgatorNet(Account): def login(self, user, data, req): try: json = req.load('%s/login' % self.API_URL, post={"username": user, "password": data['password']}) + self.logDebug("API:LOGIN", json) + json = json_loads(json) if json['response_status'] == 200: @@ -52,6 +54,7 @@ class RapidgatorNet(Account): return else: self.logError(json['response_details']) + except Exception, e: self.logError(e) diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index 48b17df5f..41d8a0975 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class RealdebridCom(Account): __name__ = "RealdebridCom" __type__ = "account" - __version__ = "0.44" + __version__ = "0.45" __description__ = """Real-Debrid.com account plugin""" __license__ = "GPLv3" @@ -28,9 +28,13 @@ class RealdebridCom(Account): def login(self, user, data, req): self.pin_code = False - html = req.load("https://real-debrid.com/ajax/login.php", get={"user": user, "pass": data['password']}) + html = req.load("https://real-debrid.com/ajax/login.php", + get={"user": user, "pass": data['password']}, + decode=True) + if "Your login informations are incorrect" in html: self.wrongPassword() + elif "PIN Code required" in html: self.logWarning(_("PIN code required. Please login to https://real-debrid.com using the PIN or disable the double authentication in your control panel on https://real-debrid.com")) self.pin_code = True diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py index 00a45dedd..660bef07e 100644 --- a/module/plugins/accounts/RehostTo.py +++ b/module/plugins/accounts/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.Account import Account class RehostTo(Account): __name__ = "RehostTo" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __description__ = """Rehost.to account plugin""" __license__ = "GPLv3" @@ -17,8 +17,10 @@ class RehostTo(Account): data = self.getAccountData(user) html = req.load("http://rehost.to/api.php", get={'cmd': "login", 'user': user, 'pass': data['password']}) + data = [x.split("=") for x in html.split(",")] - ses = data[0][1] + + ses = data[0][1] long_ses = data[1][1] html = req.load("http://rehost.to/api.php", @@ -39,7 +41,8 @@ class RehostTo(Account): def login(self, user, data, req): html = req.load("http://rehost.to/api.php", - get={'cmd': "login", 'user': user, 'pass': data['password']}) + get={'cmd': "login", 'user': user, 'pass': data['password']}, + decode=True) if "Login failed." in html: self.wrongPassword() diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 57fe52385..3ee6e04af 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class ShareonlineBiz(Account): __name__ = "ShareonlineBiz" __type__ = "account" - __version__ = "0.29" + __version__ = "0.30" __description__ = """Share-online.biz account plugin""" __license__ = "GPLv3" @@ -17,7 +17,10 @@ class ShareonlineBiz(Account): def api_response(self, user, req): return req.load("http://api.share-online.biz/cgi-bin", - get={'q': "userdetails", 'aux': "traffic", "username": user, "password": self.accounts[user]['password']}) + get={'q' : "userdetails", + 'aux' : "traffic", + 'username': user, + 'password': self.getAccountData(user)['password']}) def loadAccountInfo(self, user, req): diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 465757457..accb3aba8 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -7,7 +7,7 @@ from module.plugins.Account import Account class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Simply-Premium.com account plugin""" __license__ = "GPLv3" @@ -42,7 +42,7 @@ class SimplyPremiumCom(Account): else: post_data = {"login_name": user, "login_pass": data['password']} - html = req.load("http://www.simply-premium.com/login.php", post=post_data) + html = req.load("http://www.simply-premium.com/login.php", post=post_data, decode=True) if 'logout' not in html: self.wrongPassword() diff --git a/module/plugins/accounts/SimplydebridCom.py b/module/plugins/accounts/SimplydebridCom.py index 406534364..29be2f73d 100644 --- a/module/plugins/accounts/SimplydebridCom.py +++ b/module/plugins/accounts/SimplydebridCom.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class SimplydebridCom(Account): __name__ = "SimplydebridCom" __type__ = "account" - __version__ = "0.10" + __version__ = "0.11" __description__ = """Simply-Debrid.com account plugin""" __license__ = "GPLv3" @@ -27,8 +27,9 @@ class SimplydebridCom(Account): def login(self, user, data, req): self.loginname = user - self.password = data['password'] - get_data = {'login': 1, 'u': self.loginname, 'p': self.password} + self.password = data['password'] + get_data = {'login': 1, 'u': self.loginname, 'p': self.password} + res = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) if res != "02: loggin success": self.wrongPassword() diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py index 8157806c8..d192f20cf 100644 --- a/module/plugins/accounts/SmoozedCom.py +++ b/module/plugins/accounts/SmoozedCom.py @@ -1,43 +1,48 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account - -from module.common.json_layer import json_loads - -from time import time - import hashlib + from beaker.crypto.pbkdf2 import PBKDF2 +from time import time +from module.common.json_layer import json_loads +from module.plugins.Account import Account class SmoozedCom(Account): __name__ = "SmoozedCom" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Smoozed.com account plugin""" __license__ = "GPLv3" - __authors__ = [] + __authors__ = [("", "")] def loadAccountInfo(self, user, req): # Get user data from premiumize.me status = self.getAccountStatus(user, req) - self.logDebug(status) - # Parse account info - account_info = {"validuntil": float(status["data"]["user"]["user_premium"]), - "trafficleft": max(0, status["data"]["traffic"][1] - status["data"]["traffic"][0]), - "session_key": status["data"]["session_key"], - "hoster": [hoster["name"] for hoster in status["data"]["hoster"]]} + self.logDebug(status) - if account_info["validuntil"] < time(): - account_info['premium'] = False + if status['state'] != 'ok': + info = {'validuntil' : None, + 'trafficleft': None, + 'premium' : False} else: - account_info['premium'] = True + # Parse account info + info = {'validuntil' : float(status["data"]["user"]["user_premium"]), + 'trafficleft': max(0, status["data"]["traffic"][1] - status["data"]["traffic"][0]), + 'session_key': status["data"]["session_key"], + 'hosters' : [hoster["name"] for hoster in status["data"]["hoster"]]} + + if info['validuntil'] < time(): + info['premium'] = False + else: + info['premium'] = True + + return info - return account_info def login(self, user, data, req): # Get user data from premiumize.me @@ -47,9 +52,11 @@ class SmoozedCom(Account): if status['state'] != 'ok': self.wrongPassword() + def getAccountStatus(self, user, req): - salt = hashlib.sha256(self.accounts[user]['password']).hexdigest() - encrypted = PBKDF2(self.accounts[user]['password'], salt, iterations=1000).hexread(32) - answer = req.load('http://www2.smoozed.com/api/login?auth=%s&password=%s' % ( - user, encrypted)) - return json_loads(answer) + password = self.getAccountData(user)['password'] + salt = hashlib.sha256(password).hexdigest() + encrypted = PBKDF2(password, salt, iterations=1000).hexread(32) + + return json_loads(req.load("http://www2.smoozed.com/api/login", + get={'auth': user, 'password': encrypted})) diff --git a/module/plugins/accounts/StahnuTo.py b/module/plugins/accounts/StahnuTo.py index 2b08c67cd..882dbd2c3 100644 --- a/module/plugins/accounts/StahnuTo.py +++ b/module/plugins/accounts/StahnuTo.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class StahnuTo(Account): __name__ = "StahnuTo" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """StahnuTo account plugin""" __license__ = "GPLv3" @@ -25,10 +25,11 @@ class StahnuTo(Account): def login(self, user, data, req): - html = req.load("http://www.stahnu.to/login.php", post={ - "username": user, - "password": data['password'], - "submit": "Login"}) + html = req.load("http://www.stahnu.to/login.php", + post={"username": user, + "password": data['password'], + "submit": "Login"}, + decode=True) if not '' in html: self.wrongPassword() diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py index f87d234a7..a857649eb 100644 --- a/module/plugins/accounts/TurbobitNet.py +++ b/module/plugins/accounts/TurbobitNet.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class TurbobitNet(Account): __name__ = "TurbobitNet" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """TurbobitNet account plugin""" __license__ = "GPLv3" @@ -33,10 +33,11 @@ class TurbobitNet(Account): def login(self, user, data, req): req.cj.setCookie("turbobit.net", "user_lang", "en") - html = req.load("http://turbobit.net/user/login", post={ - "user[login]": user, - "user[pass]": data['password'], - "user[submit]": "Login"}) + html = req.load("http://turbobit.net/user/login", + post={"user[login]": user, + "user[pass]": data['password'], + "user[submit]": "Login"}, + decode=True) if not '