diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-11-13 23:47:36 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-11-13 23:47:36 +0100 |
commit | bdfa8104065831bf0eb2f6a022552e8de725ed47 (patch) | |
tree | 4a43864e1bb257c7737a765d62899244b825a859 /pyload/plugins | |
parent | [themes] Tiny code cosmetics (diff) | |
parent | [Plugin] Some fixes by rlindner81 (diff) | |
download | pyload-bdfa8104065831bf0eb2f6a022552e8de725ed47.tar.xz |
Merge branch 'stable' into 0.4.10
Conflicts:
module/plugins/accounts/MegaRapidCz.py
module/plugins/accounts/ShareRapidCom.py
module/plugins/crypter/HotfileComFolder.py
module/plugins/crypter/HotfileFolderCom.py
module/plugins/hoster/Keep2shareCC.py
module/plugins/hoster/Keep2shareCc.py
module/plugins/hoster/MegaCoNz.py
module/plugins/hoster/MegaNz.py
module/plugins/hoster/MegaRapidCz.py
module/plugins/hoster/ShareRapidCom.py
module/plugins/internal/CaptchaService.py
pyload/api/__init__.py
pyload/manager/AccountManager.py
pyload/manager/PluginManager.py
pyload/manager/thread/PluginThread.py
pyload/network/HTTPRequest.py
pyload/network/XDCCRequest.py
pyload/plugins/Plugin.py
pyload/plugins/account/BillionuploadsCom.py
pyload/plugins/account/CramitIn.py
pyload/plugins/account/EasybytezCom.py
pyload/plugins/account/FastshareCz.py
pyload/plugins/account/File4safeCom.py
pyload/plugins/account/FileParadoxIn.py
pyload/plugins/account/FileomCom.py
pyload/plugins/account/FilerNet.py
pyload/plugins/account/FilerioCom.py
pyload/plugins/account/FourSharedCom.py
pyload/plugins/account/Ftp.py
pyload/plugins/account/Http.py
pyload/plugins/account/HugefilesNet.py
pyload/plugins/account/HundredEightyUploadCom.py
pyload/plugins/account/LomafileCom.py
pyload/plugins/account/MovReelCom.py
pyload/plugins/account/MultishareCz.py
pyload/plugins/account/MyfastfileCom.py
pyload/plugins/account/NosuploadCom.py
pyload/plugins/account/NovafileCom.py
pyload/plugins/account/QuickshareCz.py
pyload/plugins/account/RarefileNet.py
pyload/plugins/account/RyushareCom.py
pyload/plugins/account/SecureUploadEu.py
pyload/plugins/account/SendmywayCom.py
pyload/plugins/account/ShareRapidCom.py
pyload/plugins/account/StahnuTo.py
pyload/plugins/account/StreamcloudEu.py
pyload/plugins/account/TusfilesNet.py
pyload/plugins/account/UploadingCom.py
pyload/plugins/account/UptoboxCom.py
pyload/plugins/account/VidPlayNet.py
pyload/plugins/addon/Checksum.py
pyload/plugins/addon/ClickAndLoad.py
pyload/plugins/addon/DeleteFinished.py
pyload/plugins/addon/DownloadScheduler.py
pyload/plugins/addon/ExternalScripts.py
pyload/plugins/addon/ExtractArchive.py
pyload/plugins/addon/HotFolder.py
pyload/plugins/addon/IRCInterface.py
pyload/plugins/addon/MergeFiles.py
pyload/plugins/addon/MultiHome.py
pyload/plugins/addon/RestartFailed.py
pyload/plugins/addon/UnSkipOnFail.py
pyload/plugins/addon/WindowsPhoneToastNotify.py
pyload/plugins/addon/XMPPInterface.py
pyload/plugins/base/Container.py
pyload/plugins/base/Crypter.py
pyload/plugins/base/Hook.py
pyload/plugins/base/OCR.py
pyload/plugins/container/RSDF.py
pyload/plugins/crypter/DuploadOrgFolder.py
pyload/plugins/crypter/EasybytezComFolder.py
pyload/plugins/crypter/FiredriveComFolder.py
pyload/plugins/crypter/HotfileFolderCom.py
pyload/plugins/crypter/LinkSaveIn.py
pyload/plugins/crypter/MultiuploadCom.py
pyload/plugins/crypter/ShareRapidComFolder.py
pyload/plugins/crypter/TusfilesNetFolder.py
pyload/plugins/crypter/UploadableChFolder.py
pyload/plugins/crypter/UploadedToFolder.py
pyload/plugins/hook/Captcha9kw.py
pyload/plugins/hook/MyfastfileCom.py
pyload/plugins/hoster/BillionuploadsCom.py
pyload/plugins/hoster/CramitIn.py
pyload/plugins/hoster/EasybytezCom.py
pyload/plugins/hoster/File4safeCom.py
pyload/plugins/hoster/FileParadoxIn.py
pyload/plugins/hoster/FilefactoryCom.py
pyload/plugins/hoster/FileomCom.py
pyload/plugins/hoster/FilerioCom.py
pyload/plugins/hoster/FileshareInUa.py
pyload/plugins/hoster/FiredriveCom.py
pyload/plugins/hoster/Ftp.py
pyload/plugins/hoster/HugefilesNet.py
pyload/plugins/hoster/HundredEightyUploadCom.py
pyload/plugins/hoster/Keep2shareCC.py
pyload/plugins/hoster/LoadTo.py
pyload/plugins/hoster/LomafileCom.py
pyload/plugins/hoster/MegaNz.py
pyload/plugins/hoster/MegacrypterCom.py
pyload/plugins/hoster/MovReelCom.py
pyload/plugins/hoster/MyvideoDe.py
pyload/plugins/hoster/NosuploadCom.py
pyload/plugins/hoster/NovafileCom.py
pyload/plugins/hoster/PandaPlaNet.py
pyload/plugins/hoster/PremiumTo.py
pyload/plugins/hoster/RarefileNet.py
pyload/plugins/hoster/RyushareCom.py
pyload/plugins/hoster/SecureUploadEu.py
pyload/plugins/hoster/SendmywayCom.py
pyload/plugins/hoster/ShareRapidCom.py
pyload/plugins/hoster/SockshareCom.py
pyload/plugins/hoster/StreamcloudEu.py
pyload/plugins/hoster/TurbobitNet.py
pyload/plugins/hoster/TusfilesNet.py
pyload/plugins/hoster/UptoboxCom.py
pyload/plugins/hoster/VidPlayNet.py
pyload/plugins/hoster/WebshareCz.py
pyload/plugins/internal/DeadCrypter.py
pyload/plugins/internal/DeadHoster.py
pyload/plugins/internal/MultiHoster.py
pyload/plugins/internal/SimpleCrypter.py
pyload/plugins/internal/SimpleHoster.py
pyload/plugins/internal/UpdateManager.py
pyload/plugins/internal/XFSPAccount.py
pyload/plugins/internal/XFSPHoster.py
pyload/utils/__init__.py
pyload/utils/packagetools.py
pyload/webui/app/cnl.py
Diffstat (limited to 'pyload/plugins')
383 files changed, 5289 insertions, 5197 deletions
diff --git a/pyload/plugins/Plugin.py b/pyload/plugins/Plugin.py index 98153bd5b..43dbcfab3 100644 --- a/pyload/plugins/Plugin.py +++ b/pyload/plugins/Plugin.py @@ -13,8 +13,10 @@ if os.name != "nt": from grp import getgrnam from itertools import islice +from traceback import print_exc +from urlparse import urlparse -from pyload.utils import safe_join, safe_filename, fs_encode, fs_decode +from module.utils import fs_decode, fs_encode, html_unescape, save_join, save_path def chunks(iterable, size): it = iter(iterable) @@ -57,23 +59,39 @@ class Base(object): #: core config self.config = core.config - #log functions + + def _log(self, type, args): + msg = " | ".join([str(a).strip() for a in args if a]) + logger = getattr(self.log, type) + logger("%s: %s" % (self.__name__, msg or _("%s MARK" % type.upper()))) + + + def logDebug(self, *args): + if self.core.debug: + return self._log("debug", args) + + def logInfo(self, *args): - self.log.info("%s: %s" % (self.__name__, " | ".join([a if isinstance(a, basestring) else str(a) for a in args]))) + return self._log("info", args) + def logWarning(self, *args): - self.log.warning("%s: %s" % (self.__name__, " | ".join([a if isinstance(a, basestring) else str(a) for a in args]))) + return self._log("warning", args) + def logError(self, *args): - self.log.error("%s: %s" % (self.__name__, " | ".join([a if isinstance(a, basestring) else str(a) for a in args]))) + return self._log("error", args) - def logDebug(self, *args): - self.log.debug("%s: %s" % (self.__name__, " | ".join([a if isinstance(a, basestring) else str(a) for a in args]))) + + def logCritical(self, *args): + return self._log("critical", args) + #: Deprecated method def setConf(self, option, value): """ see `setConfig` """ - self.config.setPlugin(self.__name__, option, value) + self.setConfig(option, value) + def setConfig(self, option, value): """ Set config value for current plugin @@ -82,39 +100,46 @@ class Base(object): :param value: :return: """ - self.setConf(option, value) + self.core.config.setPlugin(self.__name__, option, value) + #: Deprecated method def getConf(self, option): """ see `getConfig` """ return self.getConfig(option) + def getConfig(self, option): """ Returns config value for current plugin :param option: :return: """ - return self.config.getPlugin(self.__name__, option) + return self.core.config.getPlugin(self.__name__, option) + def setStorage(self, key, value): """ Saves a value persistently to the database """ self.core.db.setStorage(self.__name__, key, value) + def store(self, key, value): """ same as `setStorage` """ self.core.db.setStorage(self.__name__, key, value) + def getStorage(self, key=None, default=None): """ Retrieves saved value or dict of all saved entries if key is None """ - if key is not None: + if key: return self.core.db.getStorage(self.__name__, key) or default return self.core.db.getStorage(self.__name__, key) + def retrieve(self, *args, **kwargs): """ same as `getStorage` """ return self.getStorage(*args, **kwargs) + def delStorage(self, key): """ Delete entry in db """ self.core.db.delStorage(self.__name__, key) @@ -125,17 +150,21 @@ class Plugin(Base): Base plugin for hoster/crypter. Overwrite `process` / `decrypt` in your subclassed plugin. """ - __name__ = "Plugin" - __type__ = "hoster" - __version__ = "0.5" + __name__ = "Plugin" + __type__ = "hoster" + __version__ = "0.07" __pattern__ = None - __config__ = [("name", "type", "desc", "default")] + __config__ = [] #: [("name", "type", "desc", "default")] __description__ = """Base plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("spoob", "spoob@pyload.org"), - ("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("spoob", "spoob@pyload.org"), + ("mkaay", "mkaay@mkaay.de")] + + + info = {} #: file info dict def __init__(self, pyfile): @@ -199,33 +228,37 @@ class Plugin(Base): #: captcha task self.cTask = None - #: amount of retries already made + self.html = None #@TODO: Move to hoster class self.retries = 0 #: some plugins store html code here - self.html = None #: quick caller for API - self.api = self.core.api + # self.api = self.core.api self.init() + def getChunkCount(self): if self.chunkLimit <= 0: return self.config['download']['chunks'] return min(self.config['download']['chunks'], self.chunkLimit) + def __call__(self): return self.__name__ + def init(self): """initialize the plugin (in addition to `__init__`)""" pass + def setup(self): """ setup for enviroment and other things, called before downloading (possibly more than one time)""" pass + def preprocessing(self, thread): """ handles important things to do before starting """ self.thread = thread @@ -246,12 +279,14 @@ class Plugin(Base): """the 'main' method of every plugin, you **have to** overwrite it""" raise NotImplementedError + def resetAccount(self): """ dont use account and retry download """ self.account = None self.req = self.core.requestFactory.getRequest(self.__name__) self.retry() + def checksum(self, local_file=None): """ return codes: @@ -272,48 +307,96 @@ class Plugin(Base): :param seconds: wait time in seconds :param reconnect: True if a reconnect would avoid wait time """ - if reconnect: - self.wantReconnect = True - self.pyfile.waitUntil = time() + int(seconds) + wait_time = int(seconds) + 1 + wait_until = time() + wait_time - def wait(self, seconds=None, reconnect=None): - """ Waits the time previously set or use these from arguments. See `setWait` - """ - if seconds: - self.setWait(seconds, reconnect) + self.logDebug("Set waitUntil to: %f (previous: %f)" % (wait_until, self.pyfile.waitUntil), + "Wait: %d seconds" % wait_time) + + self.pyfile.waitUntil = wait_until + + if reconnect is not None: + self.logDebug("Set wantReconnect to: %s (previous: %s)" % (reconnect, self.wantReconnect)) + self.wantReconnect = reconnect + + + def wait(self, seconds=0, reconnect=None): + """ waits the time previously set """ + + pyfile = self.pyfile - self._wait() + self.setWait(seconds, reconnect) - def _wait(self): self.waiting = True - self.pyfile.setStatus("waiting") - while self.pyfile.waitUntil > time(): - self.thread.m.reconnecting.wait(2) + status = pyfile.status + pyfile.setStatus("waiting") - if self.pyfile.abort: - raise Abort - if self.thread.m.reconnecting.isSet(): - self.waiting = False - self.wantReconnect = False - raise Reconnect + self.logDebug("WAIT: %d seconds" % seconds, + "WAITUNTIL: %f" % pyfile.waitUntil, + "RECONNECT: %s" % self.wantReconnect) + + if not account: + self.logDebug("Ignore reconnection due account logged") + + while pyfile.waitUntil > time(): + self.thread.m.reconnecting.wait(2) + + if pyfile.abort: + self.abort() + + if self.thread.m.reconnecting.isSet(): + self.waiting = False + self.wantReconnect = False + raise Reconnect + else: + while pyfile.waitUntil > time(): + if pyfile.abort: + self.abort() self.waiting = False - self.pyfile.setStatus("starting") + + pyfile.status = status + def fail(self, reason): """ fail and give reason """ raise Fail(reason) - def offline(self): + + def abort(self, reason=""): + """ abort and give reason """ + if reason: + self.pyfile.error = str(reason) + raise Abort #@TODO: Use raise Abort(reason) in 0.4.10 + + + def error(self, reason="", type=""): + if not reason and not type: + type = "unknown" + + msg = _("%s error") % _(type.strip().capitalize()) if type else _("Error") + msg += ": " + reason.strip() if reason else "" + msg += _(" | Plugin may be out of date") + + raise Fail(msg) + + + def offline(self, reason=""): """ fail and indicate file is offline """ - raise Fail("offline") + if reason: + self.pyfile.error = str(reason) + raise Fail("offline") #@TODO: Use raise Fail("offline", reason) in 0.4.10 + - def tempOffline(self): + def tempOffline(self, reason=""): """ fail and indicates file ist temporary offline, the core may take consequences """ - raise Fail("temp. offline") + if reason: + self.pyfile.error = str(reason) + raise Fail("temp. offline") #@TODO: Use raise Fail("temp. offline", reason) in 0.4.10 - def retry(self, max_tries=3, wait_time=1, reason=""): + + def retry(self, max_tries=5, wait_time=1, reason=""): """Retries and begin again from the beginning :param max_tries: number of maximum retries @@ -321,26 +404,28 @@ class Plugin(Base): :param reason: reason for retrying, will be passed to fail if max_tries reached """ if 0 < max_tries <= self.retries: - if not reason: reason = "Max retries reached" - raise Fail(reason) + self.error(reason or _("Max retries reached"), "retry") - self.wantReconnect = False - self.setWait(wait_time) - self.wait() + self.wait(wait_time, False) self.retries += 1 raise Retry(reason) + def invalidCaptcha(self): + self.logError(_("Invalid captcha")) if self.cTask: self.cTask.invalid() + def correctCaptcha(self): + self.logInfo(_("Correct captcha")) if self.cTask: self.cTask.correct() + def decryptCaptcha(self, url, get={}, post={}, cookies=False, forceUser=False, imgtype='jpg', - result_type='textual'): + result_type='textual', timeout=290): """ Loads a captcha and decrypts it with ocr, plugin, user input :param url: url of captcha image @@ -359,9 +444,9 @@ class Plugin(Base): img = self.load(url, get=get, post=post, cookies=cookies) id = ("%.2f" % time())[-6:].replace(".", "") - temp_file = open(join("tmp", "tmpCaptcha_%s_%s.%s" % (self.__name__, id, imgtype)), "wb") - temp_file.write(img) - temp_file.close() + + with open(join("tmp", "tmpCaptcha_%s_%s.%s" % (self.__name__, id, imgtype)), "wb") as tmpCaptcha: + tmpCaptcha.write(img) has_plugin = self.__name__ in self.core.pluginManager.ocrPlugins @@ -372,20 +457,21 @@ class Plugin(Base): if Ocr and not forceUser: sleep(randint(3000, 5000) / 1000.0) - if self.pyfile.abort: raise Abort + if self.pyfile.abort: + self.abort() ocr = Ocr() - result = ocr.get_captcha(temp_file.name) + result = ocr.get_captcha(tmpCaptcha.name) else: captchaManager = self.core.captchaManager - task = captchaManager.newTask(img, imgtype, temp_file.name, result_type) + task = captchaManager.newTask(img, imgtype, tmpCaptcha.name, result_type) self.cTask = task - captchaManager.handleCaptcha(task) + captchaManager.handleCaptcha(task, timeout) while task.isWaiting(): if self.pyfile.abort: captchaManager.removeTask(task) - raise Abort + self.abort() sleep(1) captchaManager.removeTask(task) @@ -395,21 +481,21 @@ class Plugin(Base): elif task.error: self.fail(task.error) elif not task.result: - self.fail(_("No captcha result obtained in appropiate time by any of the plugins.")) + self.fail(_("No captcha result obtained in appropiate time by any of the plugins")) result = task.result - self.logDebug("Received captcha result: %s" % str(result)) + self.logDebug("Received captcha result: %s" % result) if not self.core.debug: try: - remove(temp_file.name) + remove(tmpCaptcha.name) except: pass return result - def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=False): + def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=False, follow_location=True, save_cookies=True): """Load content at url and returns it :param url: @@ -417,36 +503,44 @@ class Plugin(Base): :param post: :param ref: :param cookies: - :param just_header: if True only the header will be retrieved and returned as dict + :param just_header: If True only the header will be retrieved and returned as dict :param decode: Wether to decode the output according to http header, should be True in most cases + :param follow_location: If True follow location else not + :param save_cookies: If True saves received cookies else discard them :return: Loaded content """ - if self.pyfile.abort: raise Abort - #utf8 vs decode -> please use decode attribute in all future plugins - if type(url) == unicode: - url = str(url) # encode('utf8') + if self.pyfile.abort: + self.abort() + + if not url: + self.fail(_("No url given")) - res = self.req.load(url, get, post, ref, cookies, just_header, decode=decode) + if type(url) == unicode: # utf8 vs decode -> please use decode attribute in all future plugins + url = str(url) #: encode('utf8') + + url = url.strip() if self.core.debug: - from inspect import currentframe + self.logDebug("Load url: " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")]) - frame = currentframe() - if not exists(join("tmp", self.__name__)): - makedirs(join("tmp", self.__name__)) + res = self.req.load(url, get, post, ref, cookies, just_header, decode=decode, follow_location=follow_location, save_cookies=save_cookies) - f = open( - join("tmp", self.__name__, "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)) - , "wb") - del frame # delete the frame or it wont be cleaned + if self.core.debug: + from inspect import currentframe + frame = currentframe() + framefile = save_join("tmp", self.__name__, "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)) try: - tmp = res.encode("utf8") - except: - tmp = res + if not exists(join("tmp", self.__name__)): + makedirs(join("tmp", self.__name__)) - f.write(tmp) - f.close() + with open(framefile, "wb") as f: + del frame #: delete the frame or it wont be cleaned + if decode: + res = res.encode('utf-8') + f.write(res) + except IOError, e: + self.logError(e) if just_header: #parse header @@ -456,7 +550,7 @@ class Plugin(Base): if not line or ":" not in line: continue key, none, value = line.partition(":") - key = key.lower().strip() + key = key.strip().lower() value = value.strip() if key in header: @@ -470,6 +564,7 @@ class Plugin(Base): return res + def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False): """Downloads the content at url to download folder @@ -482,6 +577,19 @@ class Plugin(Base): the filename will be changed if needed :return: The location where the file was saved """ + if self.pyfile.abort: + self.abort() + + if not url: + self.fail(_("No url given")) + + if type(url) == unicode: + url = str(url) + + url = url.strip() + + if self.core.debug: + self.logDebug("Download url: " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")]) self.checkForSameFiles() @@ -492,16 +600,16 @@ class Plugin(Base): location = safe_join(download_folder, self.pyfile.package().folder) if not exists(location): - makedirs(location, int(self.config['permission']['folder'], 8)) + try: + makedirs(location, int(self.core.config['permission']['folder'], 8)) - if self.config['permission']['change_dl'] and os.name != "nt": - try: + if self.core.config['permission']['change_dl'] and os.name != "nt": uid = getpwnam(self.config['permission']['user'])[2] gid = getgrnam(self.config['permission']['group'])[2] - chown(location, uid, gid) - except Exception, e: - self.logWarning(_("Setting User and Group failed: %s") % str(e)) + + except Exception, e: + self.fail(e) # convert back to unicode location = fs_decode(location) @@ -518,28 +626,35 @@ class Plugin(Base): finally: self.pyfile.size = self.req.size - if disposition and newname and newname != name: #triple check, just to be sure - self.logInfo("%(name)s saved as %(newname)s" % {"name": name, "newname": newname}) - self.pyfile.name = newname - filename = join(location, newname) + if newname: + newname = urlparse(newname).path.split("/")[-1] + + if disposition and newname != name: + self.logInfo(_("%(name)s saved as %(newname)s") % {"name": name, "newname": newname}) + self.pyfile.name = newname + filename = join(location, newname) fs_filename = fs_encode(filename) - if self.config['permission']['change_file']: - chmod(fs_filename, int(self.config['permission']['file'], 8)) + if self.core.config['permission']['change_file']: + try: + chmod(fs_filename, int(self.core.config['permission']['file'], 8)) + except Exception, e: + self.logWarning(_("Setting file mode failed"), e) - if self.config['permission']['change_dl'] and os.name != "nt": + if self.core.config['permission']['change_dl'] and os.name != "nt": try: uid = getpwnam(self.config['permission']['user'])[2] gid = getgrnam(self.config['permission']['group'])[2] - chown(fs_filename, uid, gid) + except Exception, e: - self.logWarning(_("Setting User and Group failed: %s") % str(e)) + self.logWarning(_("Setting User and Group failed"), e) self.lastDownload = filename return self.lastDownload + def checkDownload(self, rules, api_size=0, max_size=50000, delete=True, read_size=0): """ checks the content of the last downloaded file, re match is saved to `lastCheck` @@ -551,7 +666,8 @@ class Plugin(Base): :return: dictionary key of the first rule that matched """ lastDownload = fs_encode(self.lastDownload) - if not exists(lastDownload): return None + if not exists(lastDownload): + return None size = stat(lastDownload) size = size.st_size @@ -559,9 +675,10 @@ class Plugin(Base): if api_size and api_size <= size: return None elif size > max_size and not read_size: return None self.logDebug("Download Check triggered") - f = open(lastDownload, "rb") - content = f.read(read_size if read_size else -1) - f.close() + + with open(lastDownload, "rb") as f: + content = f.read(read_size if read_size else -1) + #produces encoding errors, better log to other file in the future? #self.logDebug("Content: %s" % content) for name, rule in rules.iteritems(): @@ -609,7 +726,7 @@ class Plugin(Base): if starting and self.config['download']['skip_existing'] and exists(location): size = os.stat(location).st_size if size >= self.pyfile.size: - raise SkipDownload("File exists.") + raise SkipDownload("File exists") pyfile = self.core.db.findDuplicates(self.pyfile.id, self.pyfile.package().folder, self.pyfile.name) if pyfile: @@ -618,14 +735,18 @@ class Plugin(Base): self.logDebug("File %s not skipped, because it does not exists." % self.pyfile.name) + def clean(self): """ clean everything and remove references """ if hasattr(self, "pyfile"): del self.pyfile + if hasattr(self, "req"): self.req.close() del self.req + if hasattr(self, "thread"): del self.thread + if hasattr(self, "html"): del self.html diff --git a/pyload/plugins/account/AlldebridCom.py b/pyload/plugins/account/AlldebridCom.py index 7183b8e6e..daf844a40 100644 --- a/pyload/plugins/account/AlldebridCom.py +++ b/pyload/plugins/account/AlldebridCom.py @@ -12,12 +12,13 @@ from pyload.plugins.base.Account import Account class AlldebridCom(Account): - __name__ = "AlldebridCom" - __type__ = "account" + __name__ = "AlldebridCom" + __type__ = "account" __version__ = "0.22" __description__ = """AllDebrid.com account plugin""" - __authors__ = [("Andy Voigt", "spamsales@online.de")] + __license__ = "GPLv3" + __authors__ = [("Andy Voigt", "spamsales@online.de")] def loadAccountInfo(self, user, req): @@ -43,6 +44,7 @@ class AlldebridCom(Account): account_info = {"validuntil": exp_time, "trafficleft": -1} return account_info + def login(self, user, data, req): urlparams = urlencode({'action': 'login', 'login_login': user, 'login_password': data['password']}) page = req.load("http://www.alldebrid.com/register/?%s" % urlparams) diff --git a/pyload/plugins/account/BayfilesCom.py b/pyload/plugins/account/BayfilesCom.py index af4f791cf..85dba44fb 100644 --- a/pyload/plugins/account/BayfilesCom.py +++ b/pyload/plugins/account/BayfilesCom.py @@ -7,29 +7,31 @@ from pyload.utils import json_loads class BayfilesCom(Account): - __name__ = "BayfilesCom" - __type__ = "account" + __name__ = "BayfilesCom" + __type__ = "account" __version__ = "0.03" __description__ = """Bayfiles.com account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def loadAccountInfo(self, user, req): - for _ in xrange(2): - response = json_loads(req.load("http://api.bayfiles.com/v1/account/info")) - self.logDebug(response) - if not response['error']: + for _i in xrange(2): + res = json_loads(req.load("http://api.bayfiles.com/v1/account/info")) + self.logDebug(res) + if not res['error']: break - self.logWarning(response['error']) + self.logWarning(res['error']) self.relogin(user) - return {"premium": bool(response['premium']), "trafficleft": -1, - "validuntil": response['expires'] if response['expires'] >= int(time()) else -1} + return {"premium": bool(res['premium']), "trafficleft": -1, + "validuntil": res['expires'] if res['expires'] >= int(time()) else -1} + def login(self, user, data, req): - response = json_loads(req.load("http://api.bayfiles.com/v1/account/login/%s/%s" % (user, data['password']))) - self.logDebug(response) - if response['error']: - self.logError(response['error']) + res = json_loads(req.load("http://api.bayfiles.com/v1/account/login/%s/%s" % (user, data['password']))) + self.logDebug(res) + if res['error']: + self.logError(res['error']) self.wrongPassword() diff --git a/pyload/plugins/account/BillionuploadsCom.py b/pyload/plugins/account/BillionuploadsCom.py index a8ad94bd3..11af36591 100644 --- a/pyload/plugins/account/BillionuploadsCom.py +++ b/pyload/plugins/account/BillionuploadsCom.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class BillionuploadsCom(XFSPAccount): - __name__ = "BillionuploadsCom" - __type__ = "account" - __version__ = "0.01" +class BillionuploadsCom(XFSAccount): + __name__ = "BillionuploadsCom" + __type__ = "account" + __version__ = "0.02" __description__ = """Billionuploads.com account plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_URL = "http://www.billionuploads.com/" + HOSTER_DOMAIN = "billionuploads.com" diff --git a/pyload/plugins/account/BitshareCom.py b/pyload/plugins/account/BitshareCom.py index a91c25982..d35f3ce29 100644 --- a/pyload/plugins/account/BitshareCom.py +++ b/pyload/plugins/account/BitshareCom.py @@ -4,12 +4,13 @@ from pyload.plugins.base.Account import Account class BitshareCom(Account): - __name__ = "BitshareCom" - __type__ = "account" + __name__ = "BitshareCom" + __type__ = "account" __version__ = "0.12" __description__ = """Bitshare account plugin""" - __authors__ = [("Paul King", None)] + __license__ = "GPLv3" + __authors__ = [("Paul King", None)] def loadAccountInfo(self, user, req): @@ -23,6 +24,7 @@ class BitshareCom(Account): return {"validuntil": -1, "trafficleft": -1, "premium": True} + def login(self, user, data, req): page = req.load("http://bitshare.com/login.html", post={"user": user, "password": data['password'], "submit": "Login"}, cookies=True) diff --git a/pyload/plugins/account/CramitIn.py b/pyload/plugins/account/CramitIn.py index 24acd2488..a9e2274a2 100644 --- a/pyload/plugins/account/CramitIn.py +++ b/pyload/plugins/account/CramitIn.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class CramitIn(XFSPAccount): - __name__ = "CramitIn" - __type__ = "account" - __version__ = "0.02" +class CramitIn(XFSAccount): + __name__ = "CramitIn" + __type__ = "account" + __version__ = "0.03" __description__ = """Cramit.in account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_URL = "http://www.cramit.in/" + HOSTER_DOMAIN = "cramit.in" diff --git a/pyload/plugins/account/CzshareCom.py b/pyload/plugins/account/CzshareCom.py index dc8d513a5..54163c425 100644 --- a/pyload/plugins/account/CzshareCom.py +++ b/pyload/plugins/account/CzshareCom.py @@ -7,16 +7,17 @@ from pyload.plugins.base.Account import Account class CzshareCom(Account): - __name__ = "CzshareCom" - __type__ = "account" + __name__ = "CzshareCom" + __type__ = "account" __version__ = "0.14" __description__ = """Czshare.com account plugin, now Sdilej.cz""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] - CREDIT_LEFT_PATTERN = r'<tr class="active">\s*<td>([0-9 ,]+) (KiB|MiB|GiB)</td>\s*<td>([^<]*)</td>\s*</tr>' + CREDIT_LEFT_PATTERN = r'<tr class="active">\s*<td>([\d ,]+) (KiB|MiB|GiB)</td>\s*<td>([^<]*)</td>\s*</tr>' def loadAccountInfo(self, user, req): @@ -31,6 +32,7 @@ class CzshareCom(Account): validuntil = mktime(strptime(m.group(3), '%d.%m.%y %H:%M')) return {"validuntil": validuntil, "trafficleft": credits} + def login(self, user, data, req): html = req.load('https://sdilej.cz/index.php', post={ "Prihlasit": "Prihlasit", diff --git a/pyload/plugins/account/DebridItaliaCom.py b/pyload/plugins/account/DebridItaliaCom.py index 850a9e60e..cdeb0a9f1 100644 --- a/pyload/plugins/account/DebridItaliaCom.py +++ b/pyload/plugins/account/DebridItaliaCom.py @@ -7,30 +7,34 @@ from pyload.plugins.base.Account import Account class DebridItaliaCom(Account): - __name__ = "DebridItaliaCom" - __type__ = "account" + __name__ = "DebridItaliaCom" + __type__ = "account" __version__ = "0.1" __description__ = """Debriditalia.com account plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] - WALID_UNTIL_PATTERN = r"Premium valid till: (?P<D>[^|]+) \|" + WALID_UNTIL_PATTERN = r'Premium valid till: (?P<D>[^|]+) \|' def loadAccountInfo(self, user, req): - if 'Account premium not activated' in self.html: + html = req.load("http://debriditalia.com/") + + if 'Account premium not activated' in html: return {"premium": False, "validuntil": None, "trafficleft": None} - m = re.search(self.WALID_UNTIL_PATTERN, self.html) + m = re.search(self.WALID_UNTIL_PATTERN, html) if m: validuntil = int(time.mktime(time.strptime(m.group('D'), "%d/%m/%Y %H:%M"))) return {"premium": True, "validuntil": validuntil, "trafficleft": -1} else: - self.logError("Unable to retrieve account information - Plugin may be out of date") + self.logError(_("Unable to retrieve account information")) + def login(self, user, data, req): - self.html = req.load("http://debriditalia.com/login.php", - get={"u": user, "p": data['password']}) - if 'NO' in self.html: + html = req.load("http://debriditalia.com/login.php", + get={"u": user, "p": data['password']}) + if 'NO' in html: self.wrongPassword() diff --git a/pyload/plugins/account/DepositfilesCom.py b/pyload/plugins/account/DepositfilesCom.py index 8d75c6344..47d720322 100644 --- a/pyload/plugins/account/DepositfilesCom.py +++ b/pyload/plugins/account/DepositfilesCom.py @@ -8,26 +8,28 @@ from pyload.plugins.base.Account import Account class DepositfilesCom(Account): - __name__ = "DepositfilesCom" - __type__ = "account" + __name__ = "DepositfilesCom" + __type__ = "account" __version__ = "0.3" __description__ = """Depositfiles.com account plugin""" - __authors__ = [("mkaay", "mkaay@mkaay.de"), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] def loadAccountInfo(self, user, req): - src = req.load("https://dfiles.eu/de/gold/") - validuntil = re.search(r"Sie haben Gold Zugang bis: <b>(.*?)</b></div>", src).group(1) + html = req.load("https://dfiles.eu/de/gold/") + validuntil = re.search(r"Sie haben Gold Zugang bis: <b>(.*?)</b></div>", html).group(1) validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) return {"validuntil": validuntil, "trafficleft": -1} + def login(self, user, data, req): - src = req.load("https://dfiles.eu/de/login.php", get={"return": "/de/gold/payment.php"}, - post={"login": user, "password": data['password']}) - if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in src: + html = req.load("https://dfiles.eu/de/login.php", get={"return": "/de/gold/payment.php"}, + post={"login": user, "password": data['password']}) + if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in html: self.wrongPassword() diff --git a/pyload/plugins/account/DevhostSt.py b/pyload/plugins/account/DevhostSt.py index 4d615cc68..07eaf339a 100644 --- a/pyload/plugins/account/DevhostSt.py +++ b/pyload/plugins/account/DevhostSt.py @@ -9,18 +9,19 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DevhostSt(SimpleHoster): - __name__ = "DevhostSt" - __type__ = "hoster" - __version__ = "0.02" + __name__ = "DevhostSt" + __type__ = "hoster" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?d-h\.st/(?!users/)\w{3}' __description__ = """d-h.st hoster plugin""" - __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - FILE_NAME_PATTERN = r'>Filename:</span> <div title="(?P<N>.+?)"' - FILE_SIZE_PATTERN = r'>Size:</span> (?P<S>[\d.]+) (?P<U>\w+)' + NAME_PATTERN = r'>Filename:</span> <div title="(?P<N>.+?)"' + SIZE_PATTERN = r'>Size:</span> (?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>File Not Found<' LINK_PATTERN = r'id="downloadfile" href="(.+?)"' @@ -34,15 +35,14 @@ class DevhostSt(SimpleHoster): def handleFree(self): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError("Download link not found") + self.error(_("Download link not found")) dl_url = m.group(1) - self.logDebug("Download URL = " + dl_url) self.download(dl_url, disposition=True) check = self.checkDownload({'html': re.compile("html")}) if check == "html": - self.parseError("Downloaded file is an html file") + self.error(_("Downloaded file is an html page")) getInfo = create_getInfo(DevhostSt) diff --git a/pyload/plugins/account/DevhostStFolder.py b/pyload/plugins/account/DevhostStFolder.py index 59d293182..51142fde9 100644 --- a/pyload/plugins/account/DevhostStFolder.py +++ b/pyload/plugins/account/DevhostStFolder.py @@ -11,22 +11,28 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class DevhostStFolder(SimpleCrypter): - __name__ = "DevhostStFolder" - __type__ = "crypter" - __version__ = "0.02" + __name__ = "DevhostStFolder" + __type__ = "crypter" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?d-h\.st/users/(?P<USER>\w+)(/\?fld_id=(?P<ID>\d+))?' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """d-h.st folder decrypter plugin""" - __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"), + ("Walter Purcaro", "vuolter@gmail.com")] LINK_PATTERN = r'(?:/> |;">)<a href="(.+?)"(?!>Back to \w+<)' OFFLINE_PATTERN = r'"/cHP">test\.png<' - def getPackageNameAndFolder(self): + def getFileInfo(self): + if re.search(self.OFFLINE_PATTERN, self.html): + self.offline() + try: id = re.match(self.__pattern__, self.pyfile.url).group('ID') if id == "0": @@ -42,10 +48,10 @@ class DevhostStFolder(SimpleCrypter): name = folder = m.group(1) except Exception, e: - self.logDebug(str(e)) + self.logDebug(e) name = folder = re.match(self.__pattern__, self.pyfile.url).group('USER') - return name, folder + return {'name': name, 'folder': folder} def getLinks(self): diff --git a/pyload/plugins/account/DropboxCom.py b/pyload/plugins/account/DropboxCom.py index 639e2be9c..03e654e89 100644 --- a/pyload/plugins/account/DropboxCom.py +++ b/pyload/plugins/account/DropboxCom.py @@ -6,18 +6,19 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DropboxCom(SimpleHoster): - __name__ = "DropboxCom" - __type__ = "hoster" - __version__ = "0.02" + __name__ = "DropboxCom" + __type__ = "hoster" + __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?dropbox\.com/.+' __description__ = """Dropbox.com hoster plugin""" - __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - FILE_NAME_PATTERN = r'<title>Dropbox - (?P<N>.+?)<' - FILE_SIZE_PATTERN = r' · (?P<S>[\d,]+) (?P<U>\w+)' + NAME_PATTERN = r'<title>Dropbox - (?P<N>.+?)<' + SIZE_PATTERN = r' · (?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'<title>Dropbox - (404|Shared link error)<' @@ -35,7 +36,7 @@ class DropboxCom(SimpleHoster): check = self.checkDownload({'html': re.compile("html")}) if check == "html": - self.parseError("Downloaded file is an html file") + self.error(_("Downloaded file is an html page")) getInfo = create_getInfo(DropboxCom) diff --git a/pyload/plugins/account/EasybytezCom.py b/pyload/plugins/account/EasybytezCom.py index bb4948811..f368840ef 100644 --- a/pyload/plugins/account/EasybytezCom.py +++ b/pyload/plugins/account/EasybytezCom.py @@ -4,53 +4,19 @@ import re from time import mktime, strptime, gmtime -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount from pyload.utils import parseFileSize -class EasybytezCom(XFSPAccount): - __name__ = "EasybytezCom" - __type__ = "account" - __version__ = "0.07" +class EasybytezCom(XFSAccount): + __name__ = "EasybytezCom" + __type__ = "account" + __version__ = "0.10" __description__ = """EasyBytez.com account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("guidobelix", "guidobelix@hotmail.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("guidobelix", "guidobelix@hotmail.it")] - HOSTER_URL = "http://www.easybytez.com/" - - - def loadAccountInfo(self, user, req): - html = req.load(self.HOSTER_URL, get={'op': "my_account"}, decode=True) - - validuntil = None - trafficleft = None - premium = False - - 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 %B %Y")) - except Exception, e: - self.logError(e) - - if validuntil > mktime(gmtime()): - premium = True - trafficleft = -1 - else: - premium = False - validuntil = -1 - - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - trafficleft = m.group(1) - if "Unlimited" in trafficleft: - trafficleft = -1 - else: - trafficleft = parseFileSize(trafficleft) / 1024 - - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + HOSTER_DOMAIN = "easybytez.com" diff --git a/pyload/plugins/account/EuroshareEu.py b/pyload/plugins/account/EuroshareEu.py index c1103afba..e3ed51464 100644 --- a/pyload/plugins/account/EuroshareEu.py +++ b/pyload/plugins/account/EuroshareEu.py @@ -7,12 +7,13 @@ from pyload.plugins.base.Account import Account class EuroshareEu(Account): - __name__ = "EuroshareEu" - __type__ = "account" + __name__ = "EuroshareEu" + __type__ = "account" __version__ = "0.01" __description__ = """Euroshare.eu account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def loadAccountInfo(self, user, req): @@ -28,8 +29,8 @@ class EuroshareEu(Account): return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} - def login(self, user, data, req): + def login(self, user, data, req): html = req.load('http://euroshare.eu/customer-zone/login/', post={ "trvale": "1", "login": user, diff --git a/pyload/plugins/account/FastixRu.py b/pyload/plugins/account/FastixRu.py index 2c7353920..6dacb8b11 100644 --- a/pyload/plugins/account/FastixRu.py +++ b/pyload/plugins/account/FastixRu.py @@ -5,12 +5,13 @@ from pyload.utils import json_loads class FastixRu(Account): - __name__ = "FastixRu" - __type__ = "account" + __name__ = "FastixRu" + __type__ = "account" __version__ = "0.02" __description__ = """Fastix account plugin""" - __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] + __license__ = "GPLv3" + __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] def loadAccountInfo(self, user, req): @@ -26,6 +27,7 @@ class FastixRu(Account): account_info = {"validuntil": None, "trafficleft": None, "premium": False} return account_info + def login(self, user, data, req): page = req.load("http://fastix.ru/api_v2/?sub=get_apikey&email=%s&password=%s" % (user, data['password'])) api = json_loads(page) diff --git a/pyload/plugins/account/FastshareCz.py b/pyload/plugins/account/FastshareCz.py index d4ef08c2b..1a7dff4b1 100644 --- a/pyload/plugins/account/FastshareCz.py +++ b/pyload/plugins/account/FastshareCz.py @@ -1,42 +1,53 @@ # -*- coding: utf-8 -*- import re + from pyload.plugins.base.Account import Account -from pyload.utils import parseFileSize +from module.utils import parseFileSize class FastshareCz(Account): - __name__ = "FastshareCz" - __type__ = "account" - __version__ = "0.03" + __name__ = "FastshareCz" + __type__ = "account" + __version__ = "0.05" __description__ = """Fastshare.cz account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] - CREDIT_PATTERN = r'(?:Kredit|Credit)\s*</td>\s*<td[^>]*>([\d. \w]+) ' + CREDIT_PATTERN = r'My account\s*\((.+?)\)' def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = None + premium = None + html = req.load("http://www.fastshare.cz/user", decode=True) m = re.search(self.CREDIT_PATTERN, html) if m: - trafficleft = parseFileSize(m.group(1)) / 1024 - premium = True if trafficleft else False + trafficleft = self.parseTraffic(m.group(1)) + + if trafficleft: + premium = True + validuntil = -1 else: - trafficleft = None premium = False - return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium} + return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + def login(self, user, data, req): + req.cj.setCookie(".fastshare.cz", "lang", "en") + req.load('http://www.fastshare.cz/login') # Do not remove or it will not login - html = req.load('http://www.fastshare.cz/sql.php', post={ - "heslo": data['password'], - "login": user - }, decode=True) - if u'>Å patné uÅŸivatelské jméno nebo heslo.<' in html: + html = req.load("http://www.fastshare.cz/sql.php", + post={'login': user, 'heslo': data['password']}, + decode=True) + + if ">Wrong username or password" in html: self.wrongPassword() diff --git a/pyload/plugins/account/File4safeCom.py b/pyload/plugins/account/File4safeCom.py index ffc2fc26d..20053d895 100644 --- a/pyload/plugins/account/File4safeCom.py +++ b/pyload/plugins/account/File4safeCom.py @@ -1,18 +1,18 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class File4safeCom(XFSPAccount): - __name__ = "File4safeCom" - __type__ = "account" - __version__ = "0.02" +class File4safeCom(XFSAccount): + __name__ = "File4safeCom" + __type__ = "account" + __version__ = "0.04" __description__ = """File4safe.com account plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] - HOSTER_URL = "http://www.file4safe.com/" + HOSTER_DOMAIN = "file4safe.com" LOGIN_FAIL_PATTERN = r'input_login' - PREMIUM_PATTERN = r'Extend Premium' diff --git a/pyload/plugins/account/FileParadoxIn.py b/pyload/plugins/account/FileParadoxIn.py index f36456da0..c12d99d6a 100644 --- a/pyload/plugins/account/FileParadoxIn.py +++ b/pyload/plugins/account/FileParadoxIn.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class FileParadoxIn(XFSPAccount): - __name__ = "FileParadoxIn" - __type__ = "account" - __version__ = "0.01" +class FileParadoxIn(XFSAccount): + __name__ = "FileParadoxIn" + __type__ = "account" + __version__ = "0.02" __description__ = """FileParadox.in account plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_URL = "http://www.fileparadox.in/" + HOSTER_DOMAIN = "fileparadox.in" diff --git a/pyload/plugins/account/FilecloudIo.py b/pyload/plugins/account/FilecloudIo.py index 49c74b93d..0d5126fc0 100644 --- a/pyload/plugins/account/FilecloudIo.py +++ b/pyload/plugins/account/FilecloudIo.py @@ -5,25 +5,26 @@ from pyload.utils import json_loads class FilecloudIo(Account): - __name__ = "FilecloudIo" - __type__ = "account" + __name__ = "FilecloudIo" + __type__ = "account" __version__ = "0.02" __description__ = """FilecloudIo account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] def loadAccountInfo(self, user, req): # It looks like the first API request always fails, so we retry 5 times, it should work on the second try - for _ in xrange(5): + for _i in xrange(5): rep = req.load("https://secure.filecloud.io/api-fetch_apikey.api", post={"username": user, "password": self.accounts[user]['password']}) rep = json_loads(rep) if rep['status'] == 'ok': break elif rep['status'] == 'error' and rep['message'] == 'no such user or wrong password': - self.logError("Wrong username or password") + self.logError(_("Wrong username or password")) return {"valid": False, "premium": False} else: return {"premium": False} @@ -39,8 +40,9 @@ class FilecloudIo(Account): else: return {"premium": False} + def login(self, user, data, req): - req.cj.setCookie("secure.filecloud.io", "lang", "en") + req.cj.setCookie(".secure.filecloud.io", "lang", "en") html = req.load('https://secure.filecloud.io/user-login.html') if not hasattr(self, "form_data"): diff --git a/pyload/plugins/account/FilefactoryCom.py b/pyload/plugins/account/FilefactoryCom.py index cf42f2666..7eedb59a1 100644 --- a/pyload/plugins/account/FilefactoryCom.py +++ b/pyload/plugins/account/FilefactoryCom.py @@ -9,13 +9,14 @@ from pyload.plugins.base.Account import Account class FilefactoryCom(Account): - __name__ = "FilefactoryCom" - __type__ = "account" + __name__ = "FilefactoryCom" + __type__ = "account" __version__ = "0.14" __description__ = """Filefactory.com account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] VALID_UNTIL_PATTERN = r'Premium valid until: <strong>(?P<d>\d{1,2})\w{1,2} (?P<m>\w{3}), (?P<y>\d{4})</strong>' @@ -35,6 +36,7 @@ class FilefactoryCom(Account): return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + def login(self, user, data, req): req.http.c.setopt(REFERER, "http://www.filefactory.com/member/login.php") diff --git a/pyload/plugins/account/FilejungleCom.py b/pyload/plugins/account/FilejungleCom.py index d63b0c273..c8b7bb655 100644 --- a/pyload/plugins/account/FilejungleCom.py +++ b/pyload/plugins/account/FilejungleCom.py @@ -7,18 +7,19 @@ from pyload.plugins.base.Account import Account class FilejungleCom(Account): - __name__ = "FilejungleCom" - __type__ = "account" + __name__ = "FilejungleCom" + __type__ = "account" __version__ = "0.11" __description__ = """Filejungle.com account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] login_timeout = 60 URL = "http://filejungle.com/" - TRAFFIC_LEFT_PATTERN = r'"/extend_premium\.php">Until (\d+ [A-Za-z]+ \d+)<br' + TRAFFIC_LEFT_PATTERN = r'"/extend_premium\.php">Until (\d+ \w+ \d+)<br' LOGIN_FAILED_PATTERN = r'<span htmlfor="loginUser(Name|Password)" generated="true" class="fail_info">' @@ -34,6 +35,7 @@ class FilejungleCom(Account): return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + def login(self, user, data, req): html = req.load(self.URL + "login.php", post={ "loginUserName": user, diff --git a/pyload/plugins/account/FileomCom.py b/pyload/plugins/account/FileomCom.py index 3ca32416d..7c743f56a 100644 --- a/pyload/plugins/account/FileomCom.py +++ b/pyload/plugins/account/FileomCom.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class FileomCom(XFSPAccount): - __name__ = "FileomCom" - __type__ = "account" - __version__ = "0.01" +class FileomCom(XFSAccount): + __name__ = "FileomCom" + __type__ = "account" + __version__ = "0.02" __description__ = """Fileom.com account plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_URL = "http://www.fileom.com/" + HOSTER_DOMAIN = "fileom.com" diff --git a/pyload/plugins/account/FilerNet.py b/pyload/plugins/account/FilerNet.py index 1f08d2c1a..193dd6eb3 100644 --- a/pyload/plugins/account/FilerNet.py +++ b/pyload/plugins/account/FilerNet.py @@ -4,20 +4,20 @@ import re import time from pyload.plugins.base.Account import Account -from pyload.utils import parseFileSize class FilerNet(Account): - __name__ = "FilerNet" - __type__ = "account" - __version__ = "0.01" + __name__ = "FilerNet" + __type__ = "account" + __version__ = "0.02" __description__ = """Filer.net account plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] TOKEN_PATTERN = r'_csrf_token" value="([^"]+)" />' - WALID_UNTIL_PATTERN = r"Der Premium-Zugang ist gÃŒltig bis (.+)\.\s*</td>" + WALID_UNTIL_PATTERN = r'Der Premium-Zugang ist gÃŒltig bis (.+)\.\s*</td>' TRAFFIC_PATTERN = r'Traffic</th>\s*<td>([^<]+)</td>' FREE_PATTERN = r'Account Status</th>\s*<td>\s*Free' @@ -33,12 +33,13 @@ class FilerNet(Account): traffic = re.search(self.TRAFFIC_PATTERN, html) if until and traffic: validuntil = int(time.mktime(time.strptime(until.group(1), "%d.%m.%Y %H:%M:%S"))) - trafficleft = parseFileSize(traffic.group(1)) / 1024 + trafficleft = self.parseTraffic(traffic.group(1)) return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} else: - self.logError("Unable to retrieve account information - Plugin may be out of date") + self.logError(_("Unable to retrieve account information")) return {"premium": False, "validuntil": None, "trafficleft": None} + def login(self, user, data, req): html = req.load("https://filer.net/login") token = re.search(self.TOKEN_PATTERN, html).group(1) diff --git a/pyload/plugins/account/FilerioCom.py b/pyload/plugins/account/FilerioCom.py index badc14a56..4c6755293 100644 --- a/pyload/plugins/account/FilerioCom.py +++ b/pyload/plugins/account/FilerioCom.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class FilerioCom(XFSPAccount): - __name__ = "FilerioCom" - __type__ = "account" - __version__ = "0.02" +class FilerioCom(XFSAccount): + __name__ = "FilerioCom" + __type__ = "account" + __version__ = "0.03" __description__ = """FileRio.in account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_URL = "http://www.filerio.in/" + HOSTER_DOMAIN = "filerio.in" diff --git a/pyload/plugins/account/FilesMailRu.py b/pyload/plugins/account/FilesMailRu.py index f258ead2f..c8d8d9270 100644 --- a/pyload/plugins/account/FilesMailRu.py +++ b/pyload/plugins/account/FilesMailRu.py @@ -4,17 +4,19 @@ from pyload.plugins.base.Account import Account class FilesMailRu(Account): - __name__ = "FilesMailRu" - __type__ = "account" + __name__ = "FilesMailRu" + __type__ = "account" __version__ = "0.1" __description__ = """Filesmail.ru account plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] def loadAccountInfo(self, user, req): return {"validuntil": None, "trafficleft": None} + def login(self, user, data, req): user, domain = user.split("@") diff --git a/pyload/plugins/account/FileserveCom.py b/pyload/plugins/account/FileserveCom.py index dd5132734..773fc9117 100644 --- a/pyload/plugins/account/FileserveCom.py +++ b/pyload/plugins/account/FileserveCom.py @@ -7,12 +7,13 @@ from pyload.utils import json_loads class FileserveCom(Account): - __name__ = "FileserveCom" - __type__ = "account" + __name__ = "FileserveCom" + __type__ = "account" __version__ = "0.2" __description__ = """Fileserve.com account plugin""" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] def loadAccountInfo(self, user, req): @@ -28,6 +29,7 @@ class FileserveCom(Account): else: return {"premium": False, "trafficleft": None, "validuntil": None} + def login(self, user, data, req): page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], "submit": "Submit+Query"}) diff --git a/pyload/plugins/account/FourSharedCom.py b/pyload/plugins/account/FourSharedCom.py index 6cc69a88d..766998ccc 100644 --- a/pyload/plugins/account/FourSharedCom.py +++ b/pyload/plugins/account/FourSharedCom.py @@ -5,28 +5,29 @@ from pyload.utils import json_loads class FourSharedCom(Account): - __name__ = "FourSharedCom" - __type__ = "account" + __name__ = "FourSharedCom" + __type__ = "account" __version__ = "0.03" __description__ = """FourShared.com account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] - + __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") - response = 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 response: + 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/pyload/plugins/account/FreakshareCom.py b/pyload/plugins/account/FreakshareCom.py index 85d813e58..742ede902 100644 --- a/pyload/plugins/account/FreakshareCom.py +++ b/pyload/plugins/account/FreakshareCom.py @@ -1,38 +1,43 @@ # -*- coding: utf-8 -*- import re + from time import strptime, mktime from pyload.plugins.base.Account import Account class FreakshareCom(Account): - __name__ = "FreakshareCom" - __type__ = "account" - __version__ = "0.1" + __name__ = "FreakshareCom" + __type__ = "account" + __version__ = "0.11" __description__ = """Freakshare.com account plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] def loadAccountInfo(self, user, req): page = req.load("http://freakshare.com/") - validuntil = r"ltig bis:</td>\s*<td><b>([0-9 \-:.]+)</b></td>" - validuntil = re.search(validuntil, page, re.MULTILINE) + validuntil = r'ltig bis:</td>\s*<td><b>([\d.:-]+)</b></td>' + validuntil = re.search(validuntil, page, re.M) validuntil = validuntil.group(1).strip() validuntil = mktime(strptime(validuntil, "%d.%m.%Y - %H:%M")) - traffic = r"Traffic verbleibend:</td>\s*<td>([^<]+)" - traffic = re.search(traffic, page, re.MULTILINE) + traffic = r'Traffic verbleibend:</td>\s*<td>([^<]+)' + traffic = re.search(traffic, page, re.M) traffic = traffic.group(1).strip() traffic = self.parseTraffic(traffic) return {"validuntil": validuntil, "trafficleft": traffic} + def login(self, user, data, req): + req.load("http://freakshare.com/index.php?language=EN") + page = req.load("http://freakshare.com/login.html", None, {"submit": "Login", "user": user, "pass": data['password']}, cookies=True) - if "Falsche Logindaten!" in page or "Wrong Username or Password!" in page: + if ">Wrong Username or Password" in page: self.wrongPassword() diff --git a/pyload/plugins/account/FreeWayMe.py b/pyload/plugins/account/FreeWayMe.py index 28e5c7b80..2c48d54f4 100644 --- a/pyload/plugins/account/FreeWayMe.py +++ b/pyload/plugins/account/FreeWayMe.py @@ -5,12 +5,13 @@ from pyload.utils import json_loads class FreeWayMe(Account): - __name__ = "FreeWayMe" - __type__ = "account" + __name__ = "FreeWayMe" + __type__ = "account" __version__ = "0.11" __description__ = """FreeWayMe account plugin""" - __authors__ = [("Nicolas Giese", "james@free-way.me")] + __license__ = "GPLv3" + __authors__ = [("Nicolas Giese", "james@free-way.me")] def loadAccountInfo(self, user, req): @@ -31,9 +32,11 @@ 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) @@ -41,6 +44,7 @@ class FreeWayMe(Account): if not status: self.wrongPassword() + 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']}) diff --git a/pyload/plugins/account/FshareVn.py b/pyload/plugins/account/FshareVn.py index 84130c11b..b449018bc 100644 --- a/pyload/plugins/account/FshareVn.py +++ b/pyload/plugins/account/FshareVn.py @@ -8,18 +8,19 @@ from pyload.plugins.base.Account import Account class FshareVn(Account): - __name__ = "FshareVn" - __type__ = "account" + __name__ = "FshareVn" + __type__ = "account" __version__ = "0.07" __description__ = """Fshare.vn account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] VALID_UNTIL_PATTERN = ur'<dt>Thá»i hạn dùng:</dt>\s*<dd>([^<]+)</dd>' LIFETIME_PATTERN = ur'<dt>Lần ÄÄng nháºp trÆ°á»c:</dt>\s*<dd>[^<]+</dd>' - TRAFFIC_LEFT_PATTERN = ur'<dt>Tá»ng Dung Lượng Tà i Khoản</dt>\s*<dd[^>]*>([0-9.]+) ([kKMG])B</dd>' + TRAFFIC_LEFT_PATTERN = ur'<dt>Tá»ng Dung Lượng Tà i Khoản</dt>\s*<dd[^>]*>([\d.]+) ([kKMG])B</dd>' DIRECT_DOWNLOAD_PATTERN = ur'<input type="checkbox"\s*([^=>]*)[^>]*/>KÃch hoạt download trá»±c tiếp</dt>' @@ -43,6 +44,7 @@ class FshareVn(Account): return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + def login(self, user, data, req): req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php") @@ -55,6 +57,7 @@ class FshareVn(Account): if not re.search(r'<img\s+alt="VIP"', html): self.wrongPassword() + def getTrafficLeft(self): m = re.search(self.TRAFFIC_LEFT_PATTERN, html) return float(m.group(1)) * 1024 ** {'k': 0, 'K': 0, 'M': 1, 'G': 2}[m.group(2)] if m else 0 diff --git a/pyload/plugins/account/Ftp.py b/pyload/plugins/account/Ftp.py index 3917b59e8..90a8a8768 100644 --- a/pyload/plugins/account/Ftp.py +++ b/pyload/plugins/account/Ftp.py @@ -4,12 +4,13 @@ from pyload.plugins.base.Account import Account class Ftp(Account): - __name__ = "Ftp" - __type__ = "account" + __name__ = "Ftp" + __type__ = "account" __version__ = "0.01" __description__ = """Ftp dummy account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] login_timeout = info_threshold = -1 #: Unlimited diff --git a/pyload/plugins/account/HellshareCz.py b/pyload/plugins/account/HellshareCz.py index 1d033e9f3..cd02c8462 100644 --- a/pyload/plugins/account/HellshareCz.py +++ b/pyload/plugins/account/HellshareCz.py @@ -7,12 +7,13 @@ from pyload.plugins.base.Account import Account class HellshareCz(Account): - __name__ = "HellshareCz" - __type__ = "account" + __name__ = "HellshareCz" + __type__ = "account" __version__ = "0.14" __description__ = """Hellshare.cz account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] CREDIT_LEFT_PATTERN = r'<div class="credit-link">\s*<table>\s*<tr>\s*<th>(\d+|\d\d\.\d\d\.)</th>' @@ -43,19 +44,20 @@ class HellshareCz(Account): trafficleft = int(credit) * 1024 validuntil = -1 except Exception, e: - self.logError("Unable to parse credit info", e) + self.logError(_("Unable to parse credit info"), e) validuntil = -1 trafficleft = -1 return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + def login(self, user, data, req): html = req.load('http://www.hellshare.com/') if req.lastEffectiveURL != 'http://www.hellshare.com/': #Switch to English self.logDebug("Switch lang - URL: %s" % req.lastEffectiveURL) json = req.load("%s?do=locRouter-show" % req.lastEffectiveURL) - hash = re.search(r"(--[0-9a-f]+-)", json).group(1) + hash = re.search(r"(\-\-[0-9a-f]+\-)", json).group(1) self.logDebug("Switch lang - HASH: %s" % hash) html = req.load('http://www.hellshare.com/%s/' % hash) diff --git a/pyload/plugins/account/Http.py b/pyload/plugins/account/Http.py index 798d154e0..3f3d4d66f 100644 --- a/pyload/plugins/account/Http.py +++ b/pyload/plugins/account/Http.py @@ -4,12 +4,13 @@ from pyload.plugins.base.Account import Account class Http(Account): - __name__ = "Http" - __type__ = "account" + __name__ = "Http" + __type__ = "account" __version__ = "0.01" __description__ = """Http dummy account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] login_timeout = info_threshold = -1 #: Unlimited diff --git a/pyload/plugins/account/HugefilesNet.py b/pyload/plugins/account/HugefilesNet.py index d9828e333..5da3bbc37 100644 --- a/pyload/plugins/account/HugefilesNet.py +++ b/pyload/plugins/account/HugefilesNet.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class HugefilesNet(XFSPAccount): - __name__ = "HugefilesNet" - __type__ = "account" - __version__ = "0.01" +class HugefilesNet(XFSAccount): + __name__ = "HugefilesNet" + __type__ = "account" + __version__ = "0.02" __description__ = """Hugefiles.net account plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_URL = "http://www.hugefiles.net/" + HOSTER_DOMAIN = "hugefiles.net" diff --git a/pyload/plugins/account/HundredEightyUploadCom.py b/pyload/plugins/account/HundredEightyUploadCom.py index 77768fbef..39f91a8af 100644 --- a/pyload/plugins/account/HundredEightyUploadCom.py +++ b/pyload/plugins/account/HundredEightyUploadCom.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class HundredEightyUploadCom(XFSPAccount): - __name__ = "HundredEightyUploadCom" - __type__ = "account" - __version__ = "0.01" +class HundredEightyUploadCom(XFSAccount): + __name__ = "HundredEightyUploadCom" + __type__ = "account" + __version__ = "0.02" __description__ = """180upload.com account plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_URL = "http://www.180upload.com/" + HOSTER_DOMAIN = "180upload.com" diff --git a/pyload/plugins/account/KingfilesNet.py b/pyload/plugins/account/KingfilesNet.py index 1ec0f8d8a..ebd5baec3 100644 --- a/pyload/plugins/account/KingfilesNet.py +++ b/pyload/plugins/account/KingfilesNet.py @@ -7,19 +7,20 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class KingfilesNet(SimpleHoster): - __name__ = "KingfilesNet" - __type__ = "hoster" - __version__ = "0.01" + __name__ = "KingfilesNet" + __type__ = "hoster" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?kingfiles\.net/(?P<ID>\w{12})' __description__ = """Kingfiles.net hoster plugin""" - __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"), + ("Walter Purcaro", "vuolter@gmail.com")] - FILE_NAME_PATTERN = r'name="fname" value="(?P<N>.+?)">' - FILE_SIZE_PATTERN = r'>Size: .+?">(?P<S>[\d.]+) (?P<U>\w+)' + NAME_PATTERN = r'name="fname" value="(?P<N>.+?)">' + SIZE_PATTERN = r'>Size: .+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>(File Not Found</b><br><br>|File Not Found</h2>)' @@ -37,31 +38,26 @@ class KingfilesNet(SimpleHoster): # Click the free user button post_data = {'op': "download1", 'usr_login': "", - 'id': file_info['ID'], + 'id': self.info['ID'], 'fname': self.pyfile.name, 'referer': "", 'method_free': "+"} - b = self.load(self.pyfile.url, post=post_data, cookies=True, decode=True) - solvemedia = SolveMedia(self) - - captcha_key = solvemedia.detect_key() - if captcha_key is None: - self.parseError("SolveMedia key not found") + self.html = self.load(self.pyfile.url, post=post_data, cookies=True, decode=True) - self.logDebug("captcha_key", captcha_key) - captcha_challenge, captcha_response = solvemedia.challenge(captcha_key) + solvemedia = SolveMedia(self) + captcha_challenge, captcha_response = solvemedia.challenge() # Make the downloadlink appear and load the file - m = re.search(self.RAND_ID_PATTERN, b) + m = re.search(self.RAND_ID_PATTERN, self.html) if m is None: - self.parseError("Random key not found") + self.error(_("Random key not found")) rand = m.group(1) - self.logDebug("rand", rand) + self.logDebug("rand = ", rand) post_data = {'op': "download2", - 'id': file_id, + 'id': self.info['ID'], 'rand': rand, 'referer': self.pyfile.url, 'method_free': "+", @@ -69,18 +65,18 @@ class KingfilesNet(SimpleHoster): 'adcopy_response': captcha_response, 'adcopy_challenge': captcha_challenge, 'down_direct': "1"} - c = self.load(self.pyfile.url, post=post_data, cookies=True, decode=True) - m = re.search(self.LINK_PATTERN, c) + self.html = self.load(self.pyfile.url, post=post_data, cookies=True, decode=True) + + m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError("Download url not found") + self.error(_("Download url not found")) - dl_url = m.group(1) - self.download(dl_url, cookies=True, disposition=True) + self.download(m.group(1), cookies=True, disposition=True) check = self.checkDownload({'html': re.compile("<html>")}) if check == "html": - self.parseError("Downloaded file is an html file") + self.error(_("Downloaded file is an html page")) getInfo = create_getInfo(KingfilesNet) diff --git a/pyload/plugins/account/LetitbitNet.py b/pyload/plugins/account/LetitbitNet.py index a914693fd..41823418d 100644 --- a/pyload/plugins/account/LetitbitNet.py +++ b/pyload/plugins/account/LetitbitNet.py @@ -5,12 +5,13 @@ from pyload.plugins.base.Account import Account class LetitbitNet(Account): - __name__ = "LetitbitNet" - __type__ = "account" + __name__ = "LetitbitNet" + __type__ = "account" __version__ = "0.01" __description__ = """Letitbit.net account plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def loadAccountInfo(self, user, req): @@ -27,6 +28,7 @@ class LetitbitNet(Account): return {"premium": True} + def login(self, user, data, req): # API_KEY is the username and the PREMIUM_KEY is the password - self.logInfo("You must use your API KEY as username and the PREMIUM KEY as password.") + self.logInfo(_("You must use your API KEY as username and the PREMIUM KEY as password")) diff --git a/pyload/plugins/account/LinksnappyCom.py b/pyload/plugins/account/LinksnappyCom.py index 3d0ef7bca..912c2b4cb 100644 --- a/pyload/plugins/account/LinksnappyCom.py +++ b/pyload/plugins/account/LinksnappyCom.py @@ -7,12 +7,13 @@ from pyload.utils import json_loads class LinksnappyCom(Account): - __name__ = "LinksnappyCom" - __type__ = "account" + __name__ = "LinksnappyCom" + __type__ = "account" __version__ = "0.02" __description__ = """Linksnappy.com account plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def loadAccountInfo(self, user, req): @@ -40,6 +41,7 @@ class LinksnappyCom(Account): return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} + 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()}) diff --git a/pyload/plugins/account/LomafileCom.py b/pyload/plugins/account/LomafileCom.py index b1faf3bf6..cfd21679c 100644 --- a/pyload/plugins/account/LomafileCom.py +++ b/pyload/plugins/account/LomafileCom.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class LomafileCom(XFSPAccount): - __name__ = "LomafileCom" - __type__ = "account" - __version__ = "0.01" +class LomafileCom(XFSAccount): + __name__ = "LomafileCom" + __type__ = "account" + __version__ = "0.02" __description__ = """Lomafile.com account plugin""" - __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_URL = "http://www.lomafile.com/" + HOSTER_DOMAIN = "lomafile.com" diff --git a/pyload/plugins/account/MegaDebridEu.py b/pyload/plugins/account/MegaDebridEu.py index a408690c6..50f24b83d 100644 --- a/pyload/plugins/account/MegaDebridEu.py +++ b/pyload/plugins/account/MegaDebridEu.py @@ -5,12 +5,13 @@ from pyload.utils import json_loads class MegaDebridEu(Account): - __name__ = "MegaDebridEu" - __type__ = "account" + __name__ = "MegaDebridEu" + __type__ = "account" __version__ = "0.2" __description__ = """mega-debrid.eu account plugin""" - __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] + __license__ = "GPLv3" + __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] # Define the base URL of MegaDebrid api @@ -21,17 +22,18 @@ class MegaDebridEu(Account): data = self.getAccountData(user) jsonResponse = req.load(self.API_URL, get={'action': 'connectUser', 'login': user, 'password': data['password']}) - response = json_loads(jsonResponse) + res = json_loads(jsonResponse) - if response['response_code'] == "ok": - return {"premium": True, "validuntil": float(response['vip_end']), "status": True} + if res['response_code'] == "ok": + return {"premium": True, "validuntil": float(res['vip_end']), "status": True} else: - self.logError(response) + self.logError(res) return {"status": False, "premium": False} + def login(self, user, data, req): jsonResponse = req.load(self.API_URL, get={'action': 'connectUser', 'login': user, 'password': data['password']}) - response = json_loads(jsonResponse) - if response['response_code'] != "ok": + res = json_loads(jsonResponse) + if res['response_code'] != "ok": self.wrongPassword() diff --git a/pyload/plugins/account/MegasharesCom.py b/pyload/plugins/account/MegasharesCom.py index f9bd6553d..5931e4e7e 100644 --- a/pyload/plugins/account/MegasharesCom.py +++ b/pyload/plugins/account/MegasharesCom.py @@ -7,12 +7,13 @@ from pyload.plugins.base.Account import Account class MegasharesCom(Account): - __name__ = "MegasharesCom" - __type__ = "account" + __name__ = "MegasharesCom" + __type__ = "account" __version__ = "0.02" __description__ = """Megashares.com account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] VALID_UNTIL_PATTERN = r'<p class="premium_info_box">Period Ends: (\w{3} \d{1,2}, \d{4})</p>' @@ -34,6 +35,7 @@ class MegasharesCom(Account): return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} + def login(self, user, data, req): html = req.load('http://d01.megashares.com/myms_login.php', post={ "httpref": "", diff --git a/pyload/plugins/account/MovReelCom.py b/pyload/plugins/account/MovReelCom.py index ba71bec2a..6128cddc8 100644 --- a/pyload/plugins/account/MovReelCom.py +++ b/pyload/plugins/account/MovReelCom.py @@ -1,18 +1,19 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class MovReelCom(XFSPAccount): - __name__ = "MovReelCom" - __type__ = "account" - __version__ = "0.02" +class MovReelCom(XFSAccount): + __name__ = "MovReelCom" + __type__ = "account" + __version__ = "0.03" __description__ = """Movreel.com account plugin""" - __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] + __license__ = "GPLv3" + __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] login_timeout = 60 info_threshold = 30 - HOSTER_URL = "http://www.movreel.com/" + HOSTER_DOMAIN = "movreel.com" diff --git a/pyload/plugins/account/MultishareCz.py b/pyload/plugins/account/MultishareCz.py index e882d0eab..9eb0b50b2 100644 --- a/pyload/plugins/account/MultishareCz.py +++ b/pyload/plugins/account/MultishareCz.py @@ -1,22 +1,21 @@ # -*- coding: utf-8 -*- -from pyload.plugins.base.Account import Account -#from time import mktime, strptime -#from pycurl import REFERER import re -from pyload.utils import parseFileSize + +from module.plugins.Account import Account class MultishareCz(Account): - __name__ = "MultishareCz" - __type__ = "account" - __version__ = "0.02" + __name__ = "MultishareCz" + __type__ = "account" + __version__ = "0.03" __description__ = """Multishare.cz account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - TRAFFIC_LEFT_PATTERN = r'<span class="profil-zvyrazneni">Kredit:</span>\s*<strong>(?P<S>[0-9,]+) (?P<U>\w+)</strong>' + TRAFFIC_LEFT_PATTERN = r'<span class="profil-zvyrazneni">Kredit:</span>\s*<strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' ACCOUNT_INFO_PATTERN = r'<input type="hidden" id="(u_ID|u_hash)" name="[^"]*" value="([^"]+)">' @@ -25,7 +24,7 @@ class MultishareCz(Account): html = req.load("http://www.multishare.cz/profil/", decode=True) m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - trafficleft = parseFileSize(m.group('S'), m.group('U')) / 1024 if m else 0 + trafficleft = self.parseTraffic(m.group('S'), m.group('U')) if m else 0 self.premium = True if trafficleft else False html = req.load("http://www.multishare.cz/", decode=True) @@ -33,6 +32,7 @@ class MultishareCz(Account): return dict(mms_info, **{"validuntil": -1, "trafficleft": trafficleft}) + def login(self, user, data, req): html = req.load('http://www.multishare.cz/html/prihlaseni_process.php', post={ "akce": "PÅihlásit", diff --git a/pyload/plugins/account/MyfastfileCom.py b/pyload/plugins/account/MyfastfileCom.py index 559b1bd3b..33cc3a694 100644 --- a/pyload/plugins/account/MyfastfileCom.py +++ b/pyload/plugins/account/MyfastfileCom.py @@ -7,13 +7,13 @@ from pyload.utils import json_loads class MyfastfileCom(Account): - __name__ = "MyfastfileCom" - __type__ = "account" + __name__ = "MyfastfileCom" + __type__ = "account" __version__ = "0.02" __description__ = """Myfastfile.com account plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def loadAccountInfo(self, user, req): @@ -21,7 +21,8 @@ class MyfastfileCom(Account): validuntil = int(time() + self.json_data['days_left'] * 24 * 60 * 60) return {"premium": True, "validuntil": validuntil, "trafficleft": -1} else: - self.logError("Unable to get account information") + self.logError(_("Unable to get account information")) + def login(self, user, data, req): # Password to use is the API-Password written in http://myfastfile.com/myaccount @@ -30,5 +31,5 @@ class MyfastfileCom(Account): 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') + self.logError(_('Invalid login. The password to use is the API-Password you find in your "My Account" page')) self.wrongPassword() diff --git a/pyload/plugins/account/NetloadIn.py b/pyload/plugins/account/NetloadIn.py index fc3c0ac60..2d6ae6eea 100644 --- a/pyload/plugins/account/NetloadIn.py +++ b/pyload/plugins/account/NetloadIn.py @@ -7,18 +7,19 @@ from pyload.plugins.base.Account import Account class NetloadIn(Account): - __name__ = "NetloadIn" - __type__ = "account" + __name__ = "NetloadIn" + __type__ = "account" __version__ = "0.22" __description__ = """Netload.in account plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("CryNickSystems", "webmaster@pcProfil.de")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("CryNickSystems", "webmaster@pcProfil.de")] def loadAccountInfo(self, user, req): page = req.load("http://netload.in/index.php?id=2&lang=de") - left = r">(\d+) (Tag|Tage), (\d+) Stunden<" + left = r'>(\d+) (Tag|Tage), (\d+) Stunden<' left = re.search(left, page) if left: validuntil = time() + int(left.group(1)) * 24 * 60 * 60 + int(left.group(3)) * 60 * 60 @@ -30,6 +31,7 @@ class NetloadIn(Account): trafficleft = None return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + def login(self, user, data, req): page = req.load("http://netload.in/index.php", None, {"txtuser": user, "txtpass": data['password'], "txtcheck": "login", "txtlogin": "Login"}, diff --git a/pyload/plugins/account/NosuploadCom.py b/pyload/plugins/account/NosuploadCom.py index b02ae50e8..e523ee2f4 100644 --- a/pyload/plugins/account/NosuploadCom.py +++ b/pyload/plugins/account/NosuploadCom.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class NosuploadCom(XFSPAccount): - __name__ = "NosuploadCom" - __type__ = "account" - __version__ = "0.01" +class NosuploadCom(XFSAccount): + __name__ = "NosuploadCom" + __type__ = "account" + __version__ = "0.02" __description__ = """Nosupload.com account plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_URL = "http://www.nosupload.com/" + HOSTER_DOMAIN = "nosupload.com" diff --git a/pyload/plugins/account/NovafileCom.py b/pyload/plugins/account/NovafileCom.py index fa5e28946..ab61bf0fc 100644 --- a/pyload/plugins/account/NovafileCom.py +++ b/pyload/plugins/account/NovafileCom.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class NovafileCom(XFSPAccount): - __name__ = "NovafileCom" - __type__ = "account" - __version__ = "0.01" +class NovafileCom(XFSAccount): + __name__ = "NovafileCom" + __type__ = "account" + __version__ = "0.02" __description__ = """Novafile.com account plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_URL = "http://www.novafile.com/" + HOSTER_DOMAIN = "novafile.com" diff --git a/pyload/plugins/account/OboomCom.py b/pyload/plugins/account/OboomCom.py index 205edad32..71663bc3f 100644 --- a/pyload/plugins/account/OboomCom.py +++ b/pyload/plugins/account/OboomCom.py @@ -9,12 +9,13 @@ from pyload.plugins.base.Account import Account class OboomCom(Account): - __name__ = "OboomCom" - __type__ = "account" + __name__ = "OboomCom" + __type__ = "account" __version__ = "0.2" __description__ = """Oboom.com account plugin""" - __authors__ = [("stanley", "stanley.foerster@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("stanley", "stanley.foerster@gmail.com")] def loadAccountData(self, user, req): @@ -23,7 +24,7 @@ class OboomCom(Account): 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.logWarning(_("Failed to log in: %s") % result[1]) self.wrongPassword() return result[1] @@ -52,8 +53,8 @@ class OboomCom(Account): return {'premium': premium, 'validuntil': validUntil, - 'trafficleft': trafficLeft / 1024, - 'maxtraffic': maxTraffic / 1024, + 'trafficleft': trafficLeft, + 'maxtraffic': maxTraffic, 'session': session} diff --git a/pyload/plugins/account/OneFichierCom.py b/pyload/plugins/account/OneFichierCom.py index 5d106a72a..857fd20b5 100644 --- a/pyload/plugins/account/OneFichierCom.py +++ b/pyload/plugins/account/OneFichierCom.py @@ -1,48 +1,55 @@ # -*- coding: utf-8 -*- import re + from time import strptime, mktime + from pycurl import REFERER from pyload.plugins.base.Account import Account class OneFichierCom(Account): - __name__ = "OneFichierCom" - __type__ = "account" - __version__ = "0.1" + __name__ = "OneFichierCom" + __type__ = "account" + __version__ = "0.11" __description__ = """1fichier.com account plugin""" - __authors__ = [("Elrick69", "elrick69[AT]rocketmail[DOT]com")] + __license__ = "GPLv3" + __authors__ = [("Elrick69", "elrick69[AT]rocketmail[DOT]com"), + ("Walter Purcaro", "vuolter@gmail.com")] - VALID_UNTIL_PATTERN = r'You are a premium user until (?P<d>\d{2})/(?P<m>\d{2})/(?P<y>\d{4})' + 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("http://1fichier.com/console/abo.pl") + html = req.load("https://1fichier.com/console/abo.pl") m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - premium = True - validuntil = re.sub(self.VALID_UNTIL_PATTERN, '\g<d>/\g<m>/\g<y>', m.group(0)) - validuntil = int(mktime(strptime(validuntil, "%d/%m/%Y"))) - else: - premium = False - validuntil = -1 + expiredate = m.group(1) + self.logDebug("Expire date: " + expiredate) - return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + 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, "http://1fichier.com/login.pl?lg=en") + def login(self, user, data, req): + req.http.c.setopt(REFERER, "https://1fichier.com/login.pl?lg=en") - html = req.load("http://1fichier.com/login.pl?lg=en", post={ - "mail": user, - "pass": data['password'], - "Login": "Login"}) + html = req.load("https://1fichier.com/login.pl?lg=en", + post={'mail': user, 'pass': data['password'], 'It': "on", 'purge': "off", 'valider': "Send"}) - if r'<div class="error_message">Invalid username or password.</div>' in html: + if '>Invalid email address' in html or '>Invalid password' in html: self.wrongPassword() diff --git a/pyload/plugins/account/OverLoadMe.py b/pyload/plugins/account/OverLoadMe.py index 514573dfb..d011cf063 100644 --- a/pyload/plugins/account/OverLoadMe.py +++ b/pyload/plugins/account/OverLoadMe.py @@ -5,12 +5,13 @@ from pyload.utils import json_loads class OverLoadMe(Account): - __name__ = "OverLoadMe" - __type__ = "account" + __name__ = "OverLoadMe" + __type__ = "account" __version__ = "0.01" __description__ = """Over-Load.me account plugin""" - __authors__ = [("marley", "marley@over-load.me")] + __license__ = "GPLv3" + __authors__ = [("marley", "marley@over-load.me")] def loadAccountInfo(self, user, req): @@ -25,6 +26,7 @@ class OverLoadMe(Account): account_info = {"validuntil": data['expirationunix'], "trafficleft": -1} return account_info + def login(self, user, data, req): jsondata = req.load("https://api.over-load.me/account.php", get={"user": user, "auth": data['password']}).strip() diff --git a/pyload/plugins/account/PremiumTo.py b/pyload/plugins/account/PremiumTo.py index ccb5c4c87..2943ba41c 100644 --- a/pyload/plugins/account/PremiumTo.py +++ b/pyload/plugins/account/PremiumTo.py @@ -4,14 +4,15 @@ from pyload.plugins.base.Account import Account class PremiumTo(Account): - __name__ = "PremiumTo" - __type__ = "account" + __name__ = "PremiumTo" + __type__ = "account" __version__ = "0.04" __description__ = """Premium.to account plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] @@ -20,7 +21,8 @@ class PremiumTo(Account): get={'username': self.username, 'password': self.password}) traffic = sum(map(int, api_r.split(';'))) - return {"trafficleft": int(traffic) / 1024, "validuntil": -1} + return {"trafficleft": int(traffic), "validuntil": -1} + def login(self, user, data, req): self.username = user diff --git a/pyload/plugins/account/PremiumizeMe.py b/pyload/plugins/account/PremiumizeMe.py index ebc488226..4071e0ad2 100644 --- a/pyload/plugins/account/PremiumizeMe.py +++ b/pyload/plugins/account/PremiumizeMe.py @@ -6,12 +6,13 @@ from pyload.utils import json_loads class PremiumizeMe(Account): - __name__ = "PremiumizeMe" - __type__ = "account" + __name__ = "PremiumizeMe" + __type__ = "account" __version__ = "0.11" __description__ = """Premiumize.me account plugin""" - __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] def loadAccountInfo(self, user, req): @@ -21,13 +22,14 @@ class PremiumizeMe(Account): # Parse account info account_info = {"validuntil": float(status['result']['expires']), - "trafficleft": max(0, status['result']['trafficleft_bytes'] / 1024)} + "trafficleft": max(0, status['result']['trafficleft_bytes'])} if status['result']['type'] == 'free': account_info['premium'] = False return account_info + def login(self, user, data, req): # Get user data from premiumize.me status = self.getAccountStatus(user, req) @@ -36,6 +38,7 @@ class PremiumizeMe(Account): if status['status'] != 200: self.wrongPassword() + def getAccountStatus(self, user, req): # Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api) # to retrieve account info and return the parsed json answer diff --git a/pyload/plugins/account/QuickshareCz.py b/pyload/plugins/account/QuickshareCz.py index 32d7f2d8e..18af5f736 100644 --- a/pyload/plugins/account/QuickshareCz.py +++ b/pyload/plugins/account/QuickshareCz.py @@ -1,25 +1,29 @@ # -*- coding: utf-8 -*- import re -from pyload.plugins.base.Account import Account -from pyload.utils import parseFileSize + +from module.plugins.Account import Account class QuickshareCz(Account): - __name__ = "QuickshareCz" - __type__ = "account" - __version__ = "0.01" + __name__ = "QuickshareCz" + __type__ = "account" + __version__ = "0.02" __description__ = """Quickshare.cz account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + + TRAFFIC_LEFT_PATTERN = r'Stav kreditu: <strong>(.+?)</strong>' def loadAccountInfo(self, user, req): html = req.load("http://www.quickshare.cz/premium", decode=True) - m = re.search(r'Stav kreditu: <strong>(.+?)</strong>', html) + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: - trafficleft = parseFileSize(m.group(1)) / 1024 + trafficleft = self.parseTraffic(m.group(1)) premium = True if trafficleft else False else: trafficleft = None @@ -27,6 +31,7 @@ class QuickshareCz(Account): return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium} + def login(self, user, data, req): html = req.load('http://www.quickshare.cz/html/prihlaseni_process.php', post={ "akce": u'PÅihlásit', diff --git a/pyload/plugins/account/RPNetBiz.py b/pyload/plugins/account/RPNetBiz.py index 6cd6b6d76..442355a8c 100644 --- a/pyload/plugins/account/RPNetBiz.py +++ b/pyload/plugins/account/RPNetBiz.py @@ -5,21 +5,22 @@ from pyload.utils import json_loads class RPNetBiz(Account): - __name__ = "RPNetBiz" - __type__ = "account" + __name__ = "RPNetBiz" + __type__ = "account" __version__ = "0.1" __description__ = """RPNet.biz account plugin""" - __authors__ = [("Dman", "dmanugm@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Dman", "dmanugm@gmail.com")] def loadAccountInfo(self, user, req): # Get account information from rpnet.biz - response = self.getAccountStatus(user, req) + res = self.getAccountStatus(user, req) try: - if response['accountInfo']['isPremium']: + if res['accountInfo']['isPremium']: # Parse account info. Change the trafficleft later to support per host info. - account_info = {"validuntil": int(response['accountInfo']['premiumExpiry']), + account_info = {"validuntil": int(res['accountInfo']['premiumExpiry']), "trafficleft": -1, "premium": True} else: account_info = {"validuntil": None, "trafficleft": None, "premium": False} @@ -30,19 +31,21 @@ class RPNetBiz(Account): return account_info + def login(self, user, data, req): # Get account information from rpnet.biz - response = self.getAccountStatus(user, req) + res = self.getAccountStatus(user, req) - # If we have an error in the response, we have wrong login information - if 'error' in response: + # If we have an error in the res, we have wrong login information + if 'error' in res: self.wrongPassword() + def getAccountStatus(self, user, req): # Using the rpnet API, check if valid premium account - response = req.load("https://premium.rpnet.biz/client_api.php", + res = req.load("https://premium.rpnet.biz/client_api.php", get={"username": user, "password": self.accounts[user]['password'], "action": "showAccountInformation"}) - self.logDebug("JSON data: %s" % response) + self.logDebug("JSON data: %s" % res) - return json_loads(response) + return json_loads(res) diff --git a/pyload/plugins/account/RapidgatorNet.py b/pyload/plugins/account/RapidgatorNet.py index 8e26a9df4..ec308e63c 100644 --- a/pyload/plugins/account/RapidgatorNet.py +++ b/pyload/plugins/account/RapidgatorNet.py @@ -5,12 +5,13 @@ from pyload.utils import json_loads class RapidgatorNet(Account): - __name__ = "RapidgatorNet" - __type__ = "account" + __name__ = "RapidgatorNet" + __type__ = "account" __version__ = "0.04" __description__ = """Rapidgator.net account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] API_URL = 'http://rapidgator.net/api/user' @@ -30,7 +31,7 @@ class RapidgatorNet(Account): self.scheduleRefresh(user, json['response']['reset_in']) return {"validuntil": json['response']['expire_date'], - "trafficleft": int(json['response']['traffic_left']) / 1024, + "trafficleft": int(json['response']['traffic_left']), "premium": True} else: self.logError(json['response_details']) @@ -39,6 +40,7 @@ class RapidgatorNet(Account): return {"validuntil": None, "trafficleft": None, "premium": False} + def login(self, user, data, req): try: json = req.load('%s/login' % self.API_URL, post={"username": user, "password": data['password']}) diff --git a/pyload/plugins/account/RapidshareCom.py b/pyload/plugins/account/RapidshareCom.py index cd4e313a1..9ebb9a568 100644 --- a/pyload/plugins/account/RapidshareCom.py +++ b/pyload/plugins/account/RapidshareCom.py @@ -4,12 +4,13 @@ from pyload.plugins.base.Account import Account class RapidshareCom(Account): - __name__ = "RapidshareCom" - __type__ = "account" + __name__ = "RapidshareCom" + __type__ = "account" __version__ = "0.22" __description__ = """Rapidshare.com account plugin""" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] def loadAccountInfo(self, user, req): @@ -17,10 +18,10 @@ class RapidshareCom(Account): api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" api_param_prem = {"sub": "getaccountdetails", "type": "prem", "login": user, "password": data['password'], "withcookie": 1} - src = req.load(api_url_base, cookies=False, get=api_param_prem) - if src.startswith("ERROR"): - raise Exception(src) - fields = src.split("\n") + html = req.load(api_url_base, cookies=False, get=api_param_prem) + if html.startswith("ERROR"): + raise Exception(html) + fields = html.split("\n") info = {} for t in fields: if not t.strip(): @@ -35,14 +36,15 @@ class RapidshareCom(Account): return tmp + def login(self, user, data, req): api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" api_param_prem = {"sub": "getaccountdetails", "type": "prem", "login": user, "password": data['password'], "withcookie": 1} - src = req.load(api_url_base, cookies=False, get=api_param_prem) - if src.startswith("ERROR"): - raise Exception(src + "### Note you have to use your account number for login, instead of name.") - fields = src.split("\n") + html = req.load(api_url_base, cookies=False, get=api_param_prem) + if html.startswith("ERROR"): + raise Exception(html + "### Note you have to use your account number for login, instead of name") + fields = html.split("\n") info = {} for t in fields: if not t.strip(): @@ -50,4 +52,4 @@ class RapidshareCom(Account): k, v = t.split("=") info[k] = v cj = self.getAccountCookies(user) - cj.setCookie("rapidshare.com", "enc", info['cookie']) + cj.setCookie(".rapidshare.com", "enc", info['cookie']) diff --git a/pyload/plugins/account/RarefileNet.py b/pyload/plugins/account/RarefileNet.py index ba2c7b95a..577a6c8f6 100644 --- a/pyload/plugins/account/RarefileNet.py +++ b/pyload/plugins/account/RarefileNet.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class RarefileNet(XFSPAccount): - __name__ = "RarefileNet" - __type__ = "account" - __version__ = "0.03" +class RarefileNet(XFSAccount): + __name__ = "RarefileNet" + __type__ = "account" + __version__ = "0.04" __description__ = """RareFile.net account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_URL = "http://www.rarefile.net/" + HOSTER_DOMAIN = "rarefile.net" diff --git a/pyload/plugins/account/RealdebridCom.py b/pyload/plugins/account/RealdebridCom.py index 70b99c906..ef96cca89 100644 --- a/pyload/plugins/account/RealdebridCom.py +++ b/pyload/plugins/account/RealdebridCom.py @@ -6,12 +6,13 @@ from pyload.plugins.base.Account import Account class RealdebridCom(Account): - __name__ = "RealdebridCom" - __type__ = "account" + __name__ = "RealdebridCom" + __type__ = "account" __version__ = "0.43" __description__ = """Real-Debrid.com account plugin""" - __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] + __license__ = "GPLv3" + __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] def loadAccountInfo(self, user, req): @@ -24,11 +25,12 @@ class RealdebridCom(Account): return account_info + def login(self, user, data, req): self.pin_code = False page = req.load("https://real-debrid.com/ajax/login.php", get={"user": user, "pass": data['password']}) if "Your login informations are incorrect" in page: self.wrongPassword() elif "PIN Code required" in page: - 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.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/pyload/plugins/account/RehostTo.py b/pyload/plugins/account/RehostTo.py index 0ade81540..6896555bf 100644 --- a/pyload/plugins/account/RehostTo.py +++ b/pyload/plugins/account/RehostTo.py @@ -4,12 +4,13 @@ from pyload.plugins.base.Account import Account class RehostTo(Account): - __name__ = "RehostTo" - __type__ = "account" + __name__ = "RehostTo" + __type__ = "account" __version__ = "0.1" __description__ = """Rehost.to account plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] def loadAccountInfo(self, user, req): @@ -29,6 +30,7 @@ class RehostTo(Account): return account_info + def login(self, user, data, req): page = req.load("http://rehost.to/api.php?cmd=login&user=%s&pass=%s" % (user, data['password'])) diff --git a/pyload/plugins/account/RyushareCom.py b/pyload/plugins/account/RyushareCom.py index 9c83dabec..ca476366b 100644 --- a/pyload/plugins/account/RyushareCom.py +++ b/pyload/plugins/account/RyushareCom.py @@ -1,19 +1,20 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class RyushareCom(XFSPAccount): - __name__ = "RyushareCom" - __type__ = "account" - __version__ = "0.04" +class RyushareCom(XFSAccount): + __name__ = "RyushareCom" + __type__ = "account" + __version__ = "0.05" __description__ = """Ryushare.com account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("trance4us", None)] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("trance4us", None)] - HOSTER_URL = "http://www.ryushare.com/" + HOSTER_DOMAIN = "ryushare.com" def login(self, user, data, req): diff --git a/pyload/plugins/account/SecureUploadEu.py b/pyload/plugins/account/SecureUploadEu.py index efcfabba0..b335c94da 100644 --- a/pyload/plugins/account/SecureUploadEu.py +++ b/pyload/plugins/account/SecureUploadEu.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class SecureUploadEu(XFSPAccount): - __name__ = "SecureUploadEu" - __type__ = "account" - __version__ = "0.01" +class SecureUploadEu(XFSAccount): + __name__ = "SecureUploadEu" + __type__ = "account" + __version__ = "0.02" __description__ = """SecureUpload.eu account plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_URL = "http://www.secureupload.eu/" + HOSTER_DOMAIN = "secureupload.eu" diff --git a/pyload/plugins/account/SendmywayCom.py b/pyload/plugins/account/SendmywayCom.py index 5a169dcc0..4fcbe0b7a 100644 --- a/pyload/plugins/account/SendmywayCom.py +++ b/pyload/plugins/account/SendmywayCom.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class SendmywayCom(XFSPAccount): - __name__ = "SendmywayCom" - __type__ = "account" - __version__ = "0.01" +class SendmywayCom(XFSAccount): + __name__ = "SendmywayCom" + __type__ = "account" + __version__ = "0.02" __description__ = """Sendmyway.com account plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_URL = "http://www.sendmyway.com/" + HOSTER_DOMAIN = "sendmyway.com" diff --git a/pyload/plugins/account/ShareRapidCom.py b/pyload/plugins/account/ShareRapidCom.py deleted file mode 100644 index 4c20770f4..000000000 --- a/pyload/plugins/account/ShareRapidCom.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import mktime, strptime -from pyload.plugins.base.Account import Account - - -class ShareRapidCom(Account): - __name__ = "ShareRapidCom" - __type__ = "account" - __version__ = "0.34" - - __description__ = """MegaRapid.cz account plugin""" - __authors__ = [("MikyWoW", "mikywow@seznam.cz"), - ("zoidberg", "zoidberg@mujmail.cz")] - - - login_timeout = 60 - - - def loadAccountInfo(self, user, req): - src = req.load("http://megarapid.cz/mujucet/", decode=True) - - m = re.search(ur'<td>Max. poÄet paralelnÃch stahovánÃ: </td><td>(\d+)', src) - if m: - data = self.getAccountData(user) - data['options']['limitDL'] = [int(m.group(1))] - - m = re.search(ur'<td>Paušálnà stahovánà aktivnÃ. VyprÅ¡Ã </td><td><strong>(.*?)</strong>', src) - if m: - validuntil = mktime(strptime(m.group(1), "%d.%m.%Y - %H:%M")) - return {"premium": True, "trafficleft": -1, "validuntil": validuntil} - - m = re.search(r'<tr><td>Kredit</td><td>(.*?) GiB', src) - if m: - trafficleft = float(m.group(1)) * (1 << 20) - return {"premium": True, "trafficleft": trafficleft, "validuntil": -1} - - return {"premium": False, "trafficleft": None, "validuntil": None} - - def login(self, user, data, req): - htm = req.load("http://megarapid.cz/prihlaseni/", cookies=True) - 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/", - post={"hash": hashes, - "login": user, - "pass1": data['password'], - "remember": 0, - "sbmt": u"PÅihlásit"}, cookies=True) diff --git a/pyload/plugins/account/ShareonlineBiz.py b/pyload/plugins/account/ShareonlineBiz.py index 681f1b5a8..31242e563 100644 --- a/pyload/plugins/account/ShareonlineBiz.py +++ b/pyload/plugins/account/ShareonlineBiz.py @@ -4,39 +4,42 @@ from pyload.plugins.base.Account import Account class ShareonlineBiz(Account): - __name__ = "ShareonlineBiz" - __type__ = "account" + __name__ = "ShareonlineBiz" + __type__ = "account" __version__ = "0.24" __description__ = """Share-online.biz account plugin""" - __authors__ = [("mkaay", "mkaay@mkaay.de"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de"), + ("zoidberg", "zoidberg@mujmail.cz")] def getUserAPI(self, user, req): return req.load("http://api.share-online.biz/account.php", {"username": user, "password": self.accounts[user]['password'], "act": "userDetails"}) + def loadAccountInfo(self, user, req): - src = self.getUserAPI(user, req) + html = self.getUserAPI(user, req) info = {} - for line in src.splitlines(): + for line in html.splitlines(): if "=" in line: key, value = line.split("=") info[key] = value self.logDebug(info) if "dl" in info and info['dl'].lower() != "not_available": - req.cj.setCookie("share-online.biz", "dl", info['dl']) + req.cj.setCookie(".share-online.biz", "dl", info['dl']) if "a" in info and info['a'].lower() != "not_available": - req.cj.setCookie("share-online.biz", "a", info['a']) + req.cj.setCookie(".share-online.biz", "a", info['a']) return {"validuntil": int(info['expire_date']) if "expire_date" in info else -1, "trafficleft": -1, "premium": True if ("dl" in info or "a" in info) and (info['group'] != "Sammler") else False} + def login(self, user, data, req): - src = self.getUserAPI(user, req) - if "EXCEPTION" in src: + html = self.getUserAPI(user, req) + if "EXCEPTION" in html: self.wrongPassword() diff --git a/pyload/plugins/account/SimplyPremiumCom.py b/pyload/plugins/account/SimplyPremiumCom.py index a601aa533..fd626b43c 100644 --- a/pyload/plugins/account/SimplyPremiumCom.py +++ b/pyload/plugins/account/SimplyPremiumCom.py @@ -5,12 +5,13 @@ from pyload.plugins.base.Account import Account class SimplyPremiumCom(Account): - __name__ = "SimplyPremiumCom" - __type__ = "account" + __name__ = "SimplyPremiumCom" + __type__ = "account" __version__ = "0.01" __description__ = """Simply-Premium.com account plugin""" - __authors__ = [("EvolutionClip", "evolutionclip@live.de")] + __license__ = "GPLv3" + __authors__ = [("EvolutionClip", "evolutionclip@live.de")] def loadAccountInfo(self, user, req): @@ -24,14 +25,15 @@ class SimplyPremiumCom(Account): #Time package validuntil = float(json_data['result']['timeend']) #Traffic package - # {"trafficleft": int(traffic) / 1024, "validuntil": -1} - #trafficleft = int(json_data['result']['traffic'] / 1024) + # {"trafficleft": int(traffic), "validuntil": -1} + #trafficleft = int(json_data['result']['traffic']) #return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} return {"premium": True, "validuntil": validuntil} + def login(self, user, data, req): - req.cj.setCookie("simply-premium.com", "lang", "EN") + req.cj.setCookie(".simply-premium.com", "lang", "EN") if data['password'] == '' or data['password'] == '0': post_data = {"key": user} diff --git a/pyload/plugins/account/SimplydebridCom.py b/pyload/plugins/account/SimplydebridCom.py index bf49b652b..a92e6ca95 100644 --- a/pyload/plugins/account/SimplydebridCom.py +++ b/pyload/plugins/account/SimplydebridCom.py @@ -6,27 +6,29 @@ from pyload.plugins.base.Account import Account class SimplydebridCom(Account): - __name__ = "SimplydebridCom" - __type__ = "account" + __name__ = "SimplydebridCom" + __type__ = "account" __version__ = "0.1" __description__ = """Simply-Debrid.com account plugin""" - __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] + __license__ = "GPLv3" + __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] def loadAccountInfo(self, user, req): get_data = {'login': 2, 'u': self.loginname, 'p': self.password} - response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) - data = [x.strip() for x in response.split(";")] + res = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) + data = [x.strip() for x in res.split(";")] if str(data[0]) != "1": return {"premium": False} else: return {"trafficleft": -1, "validuntil": mktime(strptime(str(data[2]), "%d/%m/%Y"))} + def login(self, user, data, req): self.loginname = user self.password = data['password'] get_data = {'login': 1, 'u': self.loginname, 'p': self.password} - response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) - if response != "02: loggin success": + res = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) + if res != "02: loggin success": self.wrongPassword() diff --git a/pyload/plugins/account/StahnuTo.py b/pyload/plugins/account/StahnuTo.py index fa08b234d..44884f835 100644 --- a/pyload/plugins/account/StahnuTo.py +++ b/pyload/plugins/account/StahnuTo.py @@ -2,27 +2,28 @@ import re -from pyload.plugins.base.Account import Account -from pyload.utils import parseFileSize +from module.plugins.Account import Account class StahnuTo(Account): - __name__ = "StahnuTo" - __type__ = "account" - __version__ = "0.02" + __name__ = "StahnuTo" + __type__ = "account" + __version__ = "0.03" __description__ = """StahnuTo account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def loadAccountInfo(self, user, req): html = req.load("http://www.stahnu.to/") m = re.search(r'>VIP: (\d+.*)<', html) - trafficleft = parseFileSize(m.group(1)) * 1024 if m else 0 + trafficleft = self.parseTraffic(m.group(1)) * 1024 if m else 0 return {"premium": trafficleft > (512 * 1024), "trafficleft": trafficleft, "validuntil": -1} + def login(self, user, data, req): html = req.load("http://www.stahnu.to/login.php", post={ "username": user, diff --git a/pyload/plugins/account/StreamcloudEu.py b/pyload/plugins/account/StreamcloudEu.py index 78d4179bf..aa1eafcbd 100644 --- a/pyload/plugins/account/StreamcloudEu.py +++ b/pyload/plugins/account/StreamcloudEu.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class StreamcloudEu(XFSPAccount): - __name__ = "StreamcloudEu" - __type__ = "account" - __version__ = "0.01" +class StreamcloudEu(XFSAccount): + __name__ = "StreamcloudEu" + __type__ = "account" + __version__ = "0.02" __description__ = """Streamcloud.eu account plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_URL = "http://www.streamcloud.eu/" + HOSTER_DOMAIN = "streamcloud.eu" diff --git a/pyload/plugins/account/TurbobitNet.py b/pyload/plugins/account/TurbobitNet.py index 48ed17d73..cb8975158 100644 --- a/pyload/plugins/account/TurbobitNet.py +++ b/pyload/plugins/account/TurbobitNet.py @@ -7,18 +7,19 @@ from pyload.plugins.base.Account import Account class TurbobitNet(Account): - __name__ = "TurbobitNet" - __type__ = "account" + __name__ = "TurbobitNet" + __type__ = "account" __version__ = "0.01" __description__ = """TurbobitNet account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def loadAccountInfo(self, user, req): html = req.load("http://turbobit.net") - m = re.search(r'<u>Turbo Access</u> to ([0-9.]+)', html) + m = re.search(r'<u>Turbo Access</u> to ([\d.]+)', html) if m: premium = True validuntil = mktime(strptime(m.group(1), "%d.%m.%Y")) @@ -28,8 +29,9 @@ class TurbobitNet(Account): return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + def login(self, user, data, req): - req.cj.setCookie("turbobit.net", "user_lang", "en") + req.cj.setCookie(".turbobit.net", "user_lang", "en") html = req.load("http://turbobit.net/user/login", post={ "user[login]": user, diff --git a/pyload/plugins/account/TusfilesNet.py b/pyload/plugins/account/TusfilesNet.py index 36110fca7..552047a64 100644 --- a/pyload/plugins/account/TusfilesNet.py +++ b/pyload/plugins/account/TusfilesNet.py @@ -4,54 +4,20 @@ import re from time import mktime, strptime, gmtime -from pyload.plugins.internal.XFSPAccount import XFSPAccount -from pyload.utils import parseFileSize +from module.plugins.internal.XFSAccount import XFSAccount -class TusfilesNet(XFSPAccount): - __name__ = "TusfilesNet" - __type__ = "account" - __version__ = "0.02" +class TusfilesNet(XFSAccount): + __name__ = "TusfilesNet" + __type__ = "account" + __version__ = "0.06" __description__ = """Tusfile.net account plugin""" - __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_URL = "http://www.tusfiles.net/" + HOSTER_DOMAIN = "tusfiles.net" VALID_UNTIL_PATTERN = r'<span class="label label-default">([^<]+)</span>' - TRAFFIC_LEFT_PATTERN = r'<td><img src="//www.tusfiles.net/i/icon/meter.png" alt=""/></td>\n<td> (?P<S>[^<]+)</td>' - - - def loadAccountInfo(self, user, req): - html = req.load(self.HOSTER_URL, get={'op': "my_account"}, decode=True) - - validuntil = None - trafficleft = None - premium = False - - 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 %B %Y")) - except Exception, e: - self.logError(e) - - if validuntil > mktime(gmtime()): - premium = True - else: - premium = False - validuntil = None - - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - trafficleft = m.group(1) - if "Unlimited" in trafficleft: - trafficleft = -1 - else: - trafficleft = parseFileSize(trafficleft) * 1024 - - return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} + TRAFFIC_LEFT_PATTERN = r'<td><img src="//www\.tusfiles\.net/i/icon/meter\.png" alt=""/></td>\n<td> (?P<S>[\d.,]+)' diff --git a/pyload/plugins/account/UlozTo.py b/pyload/plugins/account/UlozTo.py index 913ddc56f..105a962cd 100644 --- a/pyload/plugins/account/UlozTo.py +++ b/pyload/plugins/account/UlozTo.py @@ -6,23 +6,24 @@ from pyload.plugins.base.Account import Account class UlozTo(Account): - __name__ = "UlozTo" - __type__ = "account" + __name__ = "UlozTo" + __type__ = "account" __version__ = "0.06" __description__ = """Uloz.to account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("pulpe", None)] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("pulpe", None)] - TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a href="/kredit" title="[^"]*?GB = ([0-9.]+) MB"' + TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a href="/kredit" title="[^"]*?GB = ([\d.]+) MB"' def loadAccountInfo(self, user, req): #this cookie gets lost somehow after each request self.phpsessid = req.cj.getCookie("ULOSESSID") html = req.load("http://www.ulozto.net/", decode=True) - req.cj.setCookie("www.ulozto.net", "ULOSESSID", self.phpsessid) + req.cj.setCookie(".ulozto.net", "ULOSESSID", self.phpsessid) m = re.search(self.TRAFFIC_LEFT_PATTERN, html) trafficleft = int(float(m.group(1).replace(' ', '').replace(',', '.')) * 1000 * 1.048) if m else 0 @@ -30,6 +31,7 @@ class UlozTo(Account): return {"validuntil": -1, "trafficleft": trafficleft} + def login(self, user, data, req): login_page = req.load('http://www.ulozto.net/?do=web-login', decode=True) action = re.findall('<form action="(.+?)"', login_page)[1].replace('&', '&') diff --git a/pyload/plugins/account/UnrestrictLi.py b/pyload/plugins/account/UnrestrictLi.py index 179d2bd8a..b5ae43d72 100644 --- a/pyload/plugins/account/UnrestrictLi.py +++ b/pyload/plugins/account/UnrestrictLi.py @@ -5,12 +5,13 @@ from pyload.utils import json_loads class UnrestrictLi(Account): - __name__ = "UnrestrictLi" - __type__ = "account" + __name__ = "UnrestrictLi" + __type__ = "account" __version__ = "0.03" __description__ = """Unrestrict.li account plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def loadAccountInfo(self, user, req): @@ -22,16 +23,17 @@ class UnrestrictLi(Account): return {"premium": False} validuntil = json_data['result']['expires'] - trafficleft = int(json_data['result']['traffic'] / 1024) + trafficleft = int(json_data['result']['traffic']) return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} + def login(self, user, data, req): - req.cj.setCookie("unrestrict.li", "lang", "EN") + req.cj.setCookie(".unrestrict.li", "lang", "EN") html = req.load("https://unrestrict.li/sign_in") if 'solvemedia' in html: - self.logError("A Captcha is required. Go to http://unrestrict.li/sign_in and login, then retry") + self.logError(_("A Captcha is required. Go to http://unrestrict.li/sign_in and login, then retry")) return post_data = {"username": user, "password": data['password'], diff --git a/pyload/plugins/account/UploadedTo.py b/pyload/plugins/account/UploadedTo.py index 145205530..0054b60bf 100644 --- a/pyload/plugins/account/UploadedTo.py +++ b/pyload/plugins/account/UploadedTo.py @@ -7,46 +7,54 @@ from pyload.plugins.base.Account import Account class UploadedTo(Account): - __name__ = "UploadedTo" - __type__ = "account" - __version__ = "0.26" + __name__ = "UploadedTo" + __type__ = "account" + __version__ = "0.27" __description__ = """Uploaded.to account plugin""" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] + + + PREMIUM_PATTERN = r'<em>Premium</em>' + VALID_UNTIL_PATTERN = r'<td>Duration:</td>\s*<th>([^<]+)' + TRAFFIC_LEFT_PATTERN = r'<th colspan="2"><b class="cB">([^<]+)' def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = None + premium = None - req.load("http://uploaded.net/language/en") html = req.load("http://uploaded.net/me") - premium = '<a href="register"><em>Premium</em>' in html or '<em>Premium</em></th>' in html - - if premium: - raw_traffic = re.search(r'<th colspan="2"><b class="cB">([^<]+)', html).group(1).replace('.', '') - raw_valid = re.search(r"<td>Duration:</td>\s*<th>([^<]+)", html, re.MULTILINE).group(1).strip() + premium = True if re.search(self.PREMIUM_PATTERN, html) else False - traffic = int(self.parseTraffic(raw_traffic)) + m = re.search(self.VALID_UNTIL_PATTERN, html, re.M) + if m: + expiredate = m.group(1).strip() - if raw_valid == "unlimited": + if expiredate == "unlimited": validuntil = -1 else: - raw_valid = re.findall(r"(\d+) (Week|weeks|days|day|hours|hour)", raw_valid) - validuntil = time() - for n, u in raw_valid: - validuntil += int(n) * 60 * 60 * {"Week": 168, "weeks": 168, "days": 24, - "day": 24, "hours": 1, "hour": 1}[u] + m = re.findall(r'(\d+) (Week|weeks|day|hour)', expiredate) + if m: + validuntil = time() + for n, u in m: + validuntil += int(n) * 60 * 60 * {'Week': 168, 'weeks': 168, 'day': 24, 'hour': 1}[u] - return {"validuntil": validuntil, "trafficleft": traffic, "maxtraffic": 50 * 1024 * 1024} - else: - return {"premium": False, "validuntil": -1} + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + trafficleft = self.parseTraffic(m.group(1).replace('.', '')) + + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, data, req): - req.load("http://uploaded.net/language/en") - req.cj.setCookie("uploaded.net", "lang", "en") + def login(self, user, data, req): + req.cj.setCookie(".uploaded.net", "lang", "en") - page = req.load("http://uploaded.net/io/login", post={"id": user, "pw": data['password'], "_": ""}) + page = req.load("http://uploaded.net/io/login", + post={'id': user, 'pw': data['password'], '_': ""}) - if "User and password do not match!" in page: + if "User and password do not match" in page: self.wrongPassword() diff --git a/pyload/plugins/account/UploadheroCom.py b/pyload/plugins/account/UploadheroCom.py index ec3cdf906..c3a39e5dc 100644 --- a/pyload/plugins/account/UploadheroCom.py +++ b/pyload/plugins/account/UploadheroCom.py @@ -8,16 +8,17 @@ from pyload.plugins.base.Account import Account class UploadheroCom(Account): - __name__ = "UploadheroCom" - __type__ = "account" + __name__ = "UploadheroCom" + __type__ = "account" __version__ = "0.2" __description__ = """Uploadhero.co account plugin""" - __authors__ = [("mcmyst", "mcmyst@hotmail.fr")] + __license__ = "GPLv3" + __authors__ = [("mcmyst", "mcmyst@hotmail.fr")] def loadAccountInfo(self, user, req): - premium_pattern = re.compile('Il vous reste <span class="bleu">([0-9]+)</span> jours premium.') + premium_pattern = re.compile('Il vous reste <span class="bleu">(\d+)</span> jours premium') data = self.getAccountData(user) page = req.load("http://uploadhero.co/my-account") @@ -31,6 +32,7 @@ class UploadheroCom(Account): return account_info + def login(self, user, data, req): page = req.load("http://uploadhero.co/lib/connexion.php", post={"pseudo_login": user, "password_login": data['password']}) diff --git a/pyload/plugins/account/UploadingCom.py b/pyload/plugins/account/UploadingCom.py index a25281ca4..b5ea91119 100644 --- a/pyload/plugins/account/UploadingCom.py +++ b/pyload/plugins/account/UploadingCom.py @@ -1,39 +1,63 @@ # -*- coding: utf-8 -*- -from time import time, strptime, mktime import re +from time import time, strptime, mktime + from pyload.plugins.base.Account import Account +from module.plugins.internal.SimpleHoster import set_cookies class UploadingCom(Account): - __name__ = "UploadingCom" - __type__ = "account" - __version__ = "0.1" + __name__ = "UploadingCom" + __type__ = "account" + __version__ = "0.11" __description__ = """Uploading.com account plugin""" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] + + + PREMIUM_PATTERN = r'UPGRADE TO PREMIUM' + VALID_UNTIL_PATTERN = r'Valid Until:(.+?)<' def loadAccountInfo(self, user, req): - src = req.load("http://uploading.com/") - premium = True - if "UPGRADE TO PREMIUM" in src: - return {"validuntil": -1, "trafficleft": -1, "premium": False} + validuntil = None + trafficleft = None + premium = None + + html = req.load("http://uploading.com/") - m = re.search("Valid Until:(.*?)<", src) + premium = False if re.search(self.PREMIUM_PATTERN, html) else True + + m = re.search(self.VALID_UNTIL_PATTERN, html) if m: - validuntil = int(mktime(strptime(m.group(1).strip(), "%b %d, %Y"))) - else: - validuntil = -1 + expiredate = m.group(1).strip() + self.logDebug("Expire date: " + expiredate) + + try: + validuntil = mktime(strptime(expiredate, "%b %d, %Y")) + + except Exception, e: + self.logError(e) + + else: + if validuntil > mktime(gmtime()): + premium = True + else: + premium = False + validuntil = None + + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - return {"validuntil": validuntil, "trafficleft": -1, "premium": True} def login(self, user, data, req): - req.cj.setCookie("uploading.com", "lang", "1") - req.cj.setCookie("uploading.com", "language", "1") - req.cj.setCookie("uploading.com", "setlang", "en") - req.cj.setCookie("uploading.com", "_lang", "en") + set_cookies([(".uploading.com", "lang", "1"), + (".uploading.com", "language", "1"), + (".uploading.com", "setlang", "en"), + (".uploading.com", "_lang", "en")] + req.load("http://uploading.com/") req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time() * 1000), - post={"email": user, "password": data['password'], "remember": "on"}) + post={'email': user, 'password': data['password'], 'remember': "on"}) diff --git a/pyload/plugins/account/UptoboxCom.py b/pyload/plugins/account/UptoboxCom.py index 917663d63..d3fb4e559 100644 --- a/pyload/plugins/account/UptoboxCom.py +++ b/pyload/plugins/account/UptoboxCom.py @@ -1,17 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class UptoboxCom(XFSPAccount): - __name__ = "UptoboxCom" - __type__ = "account" - __version__ = "0.03" +class UptoboxCom(XFSAccount): + __name__ = "UptoboxCom" + __type__ = "account" + __version__ = "0.06" __description__ = """DDLStorage.com account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_URL = "http://www.uptobox.com/" - - VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire: ([^<]+)</strong>' + HOSTER_DOMAIN = "uptobox.com" diff --git a/pyload/plugins/account/VidPlayNet.py b/pyload/plugins/account/VidPlayNet.py index a7e71365e..5bfc24963 100644 --- a/pyload/plugins/account/VidPlayNet.py +++ b/pyload/plugins/account/VidPlayNet.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPAccount import XFSPAccount +from module.plugins.internal.XFSAccount import XFSAccount -class VidPlayNet(XFSPAccount): - __name__ = "VidPlayNet" - __type__ = "account" - __version__ = "0.01" +class VidPlayNet(XFSAccount): + __name__ = "VidPlayNet" + __type__ = "account" + __version__ = "0.02" __description__ = """VidPlay.net account plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_URL = "http://www.vidplay.net/" + HOSTER_DOMAIN = "vidplay.net" diff --git a/pyload/plugins/account/YibaishiwuCom.py b/pyload/plugins/account/YibaishiwuCom.py index e9fe0facf..d9a9f37ca 100644 --- a/pyload/plugins/account/YibaishiwuCom.py +++ b/pyload/plugins/account/YibaishiwuCom.py @@ -6,12 +6,13 @@ from pyload.plugins.base.Account import Account class YibaishiwuCom(Account): - __name__ = "YibaishiwuCom" - __type__ = "account" + __name__ = "YibaishiwuCom" + __type__ = "account" __version__ = "0.01" __description__ = """115.com account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] ACCOUNT_INFO_PATTERN = r'var USER_PERMISSION = {(.*?)}' @@ -26,6 +27,7 @@ class YibaishiwuCom(Account): validuntil = trafficleft = (-1 if m else 0) return dict({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) + def login(self, user, data, req): html = req.load('http://passport.115.com/?ac=login', post={ "back": "http://www.115.com/", diff --git a/pyload/plugins/account/ZeveraCom.py b/pyload/plugins/account/ZeveraCom.py index 17bfb114c..701198c84 100644 --- a/pyload/plugins/account/ZeveraCom.py +++ b/pyload/plugins/account/ZeveraCom.py @@ -6,12 +6,13 @@ from pyload.plugins.base.Account import Account class ZeveraCom(Account): - __name__ = "ZeveraCom" - __type__ = "account" + __name__ = "ZeveraCom" + __type__ = "account" __version__ = "0.21" __description__ = """Zevera.com account plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def loadAccountInfo(self, user, req): @@ -26,12 +27,14 @@ class ZeveraCom(Account): } return account_info + def login(self, user, data, req): self.loginname = user self.password = data['password'] if self.getAPIData(req) == "No traffic": self.wrongPassword() + def getAPIData(self, req, just_header=False, **kwargs): get_data = { 'cmd': 'accountinfo', @@ -40,14 +43,14 @@ class ZeveraCom(Account): } get_data.update(kwargs) - response = req.load("http://www.zevera.com/jDownloader.ashx", get=get_data, + res = req.load("http://www.zevera.com/jDownloader.ashx", get=get_data, decode=True, just_header=just_header) - self.logDebug(response) + self.logDebug(res) - if ':' in response: + if ':' in res: if not just_header: - response = response.replace(',', '\n') + res = res.replace(',', '\n') return dict((y.strip().lower(), z.strip()) for (y, z) in - [x.split(':', 1) for x in response.splitlines() if ':' in x]) + [x.split(':', 1) for x in res.splitlines() if ':' in x]) else: - return response + return res diff --git a/pyload/plugins/addon/Checksum.py b/pyload/plugins/addon/Checksum.py index 551ce7bd9..00c3d9cfd 100644 --- a/pyload/plugins/addon/Checksum.py +++ b/pyload/plugins/addon/Checksum.py @@ -18,7 +18,7 @@ def computeChecksum(local_file, algorithm): h = getattr(hashlib, algorithm)() with open(local_file, 'rb') as f: - for chunk in iter(lambda: f.read(128 * h.block_size), b''): + for chunk in iter(lambda: f.read(128 * h.block_size), ''): h.update(chunk) return h.hexdigest() @@ -28,7 +28,7 @@ def computeChecksum(local_file, algorithm): last = 0 with open(local_file, 'rb') as f: - for chunk in iter(lambda: f.read(8192), b''): + for chunk in iter(lambda: f.read(8192), ''): last = hf(chunk, last) return "%x" % last @@ -38,21 +38,21 @@ def computeChecksum(local_file, algorithm): class Checksum(Addon): - __name__ = "Checksum" - __type__ = "addon" - __version__ = "0.13" + __name__ = "Checksum" + __type__ = "addon" + __version__ = "0.14" - __config__ = [("activated", "bool", "Activated", False), - ("check_checksum", "bool", "Check checksum? (If False only size will be verified)", True), + __config__ = [("check_checksum", "bool", "Check checksum? (If False only size will be verified)", True), ("check_action", "fail;retry;nothing", "What to do if check fails?", "retry"), ("max_tries", "int", "Number of retries", 2), ("retry_action", "fail;nothing", "What to do if all retries fail?", "fail"), ("wait_time", "int", "Time to wait before each retry (seconds)", 1)] __description__ = """Verify downloaded file size and checksum""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com"), + ("stickell", "l.stickell@yahoo.it")] methods = {'sfv': 'crc32', 'crc': 'crc32', 'hash': 'md5'} @@ -66,12 +66,14 @@ class Checksum(Addon): if not self.getConfig("check_checksum"): self.logInfo(_("Checksum validation is disabled in plugin configuration")) + def setup(self): self.algorithms = sorted( getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")), reverse=True) self.algorithms.extend(["crc32", "adler32"]) self.formats = self.algorithms + ["sfv", "crc", "hash"] + def downloadFinished(self, pyfile): """ Compute checksum for the downloaded file and compare it with the hash provided by the hoster. @@ -117,7 +119,7 @@ class Checksum(Addon): checksum = computeChecksum(local_file, key.replace("-", "").lower()) if checksum: if checksum == data[key].lower(): - self.logInfo(_('File integrity of "%s" verified by %s checksum (%s).') % + self.logInfo(_('File integrity of "%s" verified by %s checksum (%s)') % (pyfile.name, key.upper(), checksum)) break else: @@ -127,7 +129,8 @@ class Checksum(Addon): else: self.logWarning(_("Unsupported hashing algorithm"), key.upper()) else: - self.logWarning(_("Unable to validate checksum for file"), pyfile.name) + self.logWarning(_("Unable to validate checksum for file: ") + pyfile.name) + def checkFailed(self, pyfile, local_file, msg): check_action = self.getConfig("check_action") @@ -137,13 +140,14 @@ class Checksum(Addon): if pyfile.plugin.retries < max_tries: if local_file: remove(local_file) - pyfile.plugin.retry(max_tries=max_tries, wait_time=self.getConfig("wait_time"), reason=msg) + pyfile.plugin.retry(max_tries, self.getConfig("wait_time"), msg) elif retry_action == "nothing": return elif check_action == "nothing": return pyfile.plugin.fail(reason=msg) + def packageFinished(self, pypack): download_folder = safe_join(self.config['general']['download_folder'], pypack.folder, "") @@ -169,7 +173,7 @@ class Checksum(Addon): algorithm = self.methods.get(file_type, file_type) checksum = computeChecksum(local_file, algorithm) if checksum == data['hash']: - self.logInfo(_('File integrity of "%s" verified by %s checksum (%s).') % + self.logInfo(_('File integrity of "%s" verified by %s checksum (%s)') % (data['name'], algorithm, checksum)) else: self.logWarning(_("%s checksum for file %s does not match (%s != %s)") % diff --git a/pyload/plugins/addon/ClickAndLoad.py b/pyload/plugins/addon/ClickAndLoad.py index 7a90b8f04..c45a1ef2d 100644 --- a/pyload/plugins/addon/ClickAndLoad.py +++ b/pyload/plugins/addon/ClickAndLoad.py @@ -6,33 +6,6 @@ import thread from pyload.plugins.base.Addon import Addon -class ClickAndLoad(Addon): - __name__ = "ClickAndLoad" - __type__ = "addon" - __version__ = "0.22" - - __config__ = [("activated", "bool", "Activated", True), - ("extern", "bool", "Allow external link adding", False)] - - __description__ = """Gives abillity to use jd's click and load. depends on webinterface""" - __authors__ = [("RaNaN", "RaNaN@pyload.de"), - ("mkaay", "mkaay@mkaay.de")] - - - def coreReady(self): - self.port = int(self.config['webinterface']['port']) - if self.config['webinterface']['activated']: - try: - if self.getConfig("extern"): - ip = "0.0.0.0" - else: - ip = "127.0.0.1" - - thread.start_new_thread(proxy, (self, ip, self.port, 9666)) - except: - self.logError(_("ClickAndLoad port already in use")) - - def proxy(self, *settings): thread.start_new_thread(server, (self,) + settings) lock = thread.allocate_lock() @@ -74,3 +47,31 @@ def forward(source, destination): else: #source.shutdown(socket.SHUT_RD) destination.shutdown(socket.SHUT_WR) + + +class ClickAndLoad(Addon): + __name__ = "ClickAndLoad" + __type__ = "addon" + __version__ = "0.22" + + __config__ = [("activated", "bool", "Activated", True), + ("extern", "bool", "Allow external link adding", False)] + + __description__ = """Click'N'Load hook plugin""" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.de"), + ("mkaay", "mkaay@mkaay.de")] + + + def coreReady(self): + self.port = int(self.config['webinterface']['port']) + if self.config['webinterface']['activated']: + try: + if self.getConfig("extern"): + ip = "0.0.0.0" + else: + ip = "127.0.0.1" + + thread.start_new_thread(proxy, (self, ip, self.port, 9666)) + except: + self.logError(_("ClickAndLoad port already in use")) diff --git a/pyload/plugins/addon/DeleteFinished.py b/pyload/plugins/addon/DeleteFinished.py index 25e49dec5..719de143a 100644 --- a/pyload/plugins/addon/DeleteFinished.py +++ b/pyload/plugins/addon/DeleteFinished.py @@ -5,16 +5,20 @@ from pyload.plugins.base.Addon import Addon class DeleteFinished(Addon): - __name__ = "DeleteFinished" - __type__ = "addon" - __version__ = "1.09" + __name__ = "DeleteFinished" + __type__ = "addon" + __version__ = "1.11" __config__ = [('activated', 'bool', 'Activated', 'False'), ('interval', 'int', 'Delete every (hours)', '72'), ('deloffline', 'bool', 'Delete packages with offline links', 'False')] __description__ = """Automatically delete all finished packages from queue""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + # event_list = ["pluginConfigChanged"] ## overwritten methods ## @@ -28,30 +32,36 @@ class DeleteFinished(Addon): self.info['sleep'] = True self.addEvent('packageFinished', self.wakeup) + def pluginConfigChanged(self, plugin, name, value): - if name == 'interval' and value != self.interval: + if name == "interval" and value != self.interval: self.interval = value * 3600 self.initPeriodical() + def unload(self): self.removeEvent('packageFinished', self.wakeup) + def coreReady(self): self.info = {'sleep': True} interval = self.getConfig('interval') - self.pluginConfigChanged('DeleteFinished', 'interval', interval) + self.pluginConfigChanged(self.__name__, 'interval', interval) self.addEvent('packageFinished', self.wakeup) + ## own methods ## @style.queue def deleteFinished(self, mode): self.c.execute('DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE package=packages.id AND status NOT IN (%s))' % mode) self.c.execute('DELETE FROM links WHERE NOT EXISTS(SELECT 1 FROM packages WHERE id=links.package)') + def wakeup(self, pypack): self.removeEvent('packageFinished', self.wakeup) self.info['sleep'] = False + ## event managing ## def addEvent(self, event, func): """Adds an event listener for event name""" @@ -63,6 +73,7 @@ class DeleteFinished(Addon): else: self.m.events[event] = [func] + def setup(self): self.m = self.manager self.removeEvent = self.m.removeEvent diff --git a/pyload/plugins/addon/DownloadScheduler.py b/pyload/plugins/addon/DownloadScheduler.py index 48bbeb3af..ef15a859f 100644 --- a/pyload/plugins/addon/DownloadScheduler.py +++ b/pyload/plugins/addon/DownloadScheduler.py @@ -8,26 +8,28 @@ from pyload.plugins.base.Addon import Addon class DownloadScheduler(Addon): - __name__ = "DownloadScheduler" - __type__ = "addon" + __name__ = "DownloadScheduler" + __type__ = "addon" __version__ = "0.21" - __config__ = [("activated", "bool", "Activated", False), - ("timetable", "str", "List time periods as hh:mm full or number(kB/s)", + __config__ = [("timetable", "str", "List time periods as hh:mm full or number(kB/s)", "0:00 full, 7:00 250, 10:00 0, 17:00 150"), ("abort", "bool", "Abort active downloads when start period with speed 0", False)] __description__ = """Download Scheduler""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] def setup(self): - self.cb = None # callback to scheduler job; will be by removed AddonManager when addon unloaded + self.cb = None #: callback to scheduler job; will be by removed AddonManager when addon unloaded + def coreReady(self): self.updateSchedule() + def updateSchedule(self, schedule=None): if schedule is None: schedule = self.getConfig("timetable") @@ -55,6 +57,7 @@ class DownloadScheduler(Addon): self.core.scheduler.removeJob(self.cb) self.cb = self.core.scheduler.addJob(next_time, self.updateSchedule, threaded=False) + def setDownloadSpeed(self, speed): if speed == 0: abort = self.getConfig("abort") diff --git a/pyload/plugins/addon/ExternalScripts.py b/pyload/plugins/addon/ExternalScripts.py index 52d14c9d3..122de00c5 100644 --- a/pyload/plugins/addon/ExternalScripts.py +++ b/pyload/plugins/addon/ExternalScripts.py @@ -11,17 +11,18 @@ from pyload.utils import safe_join class ExternalScripts(Addon): - __name__ = "ExternalScripts" - __type__ = "addon" + __name__ = "ExternalScripts" + __type__ = "addon" __version__ = "0.24" __config__ = [("activated", "bool", "Activated", True)] __description__ = """Run external scripts""" - __authors__ = [("mkaay", "mkaay@mkaay.de"), - ("RaNaN", "ranan@pyload.org"), - ("spoob", "spoob@pyload.org"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de"), + ("RaNaN", "ranan@pyload.org"), + ("spoob", "spoob@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] event_list = ["archive_extracted", "package_extracted", "all_archives_extracted", "all_archives_processed", diff --git a/pyload/plugins/addon/ExtractArchive.py b/pyload/plugins/addon/ExtractArchive.py index cdf2eecee..a53d2f951 100644 --- a/pyload/plugins/addon/ExtractArchive.py +++ b/pyload/plugins/addon/ExtractArchive.py @@ -14,6 +14,7 @@ if sys.version_info < (2, 7) and os.name != "nt": import errno from subprocess import Popen + def _eintr_retry_call(func, *args): while True: try: @@ -23,6 +24,7 @@ if sys.version_info < (2, 7) and os.name != "nt": continue raise + # unsued timeout option for older python version def wait(self, timeout=0): """Wait for child process to terminate. Returns returncode @@ -53,8 +55,8 @@ from pyload.utils import safe_join, fs_encode class ExtractArchive(Addon): - __name__ = "ExtractArchive" - __type__ = "addon" + __name__ = "ExtractArchive" + __type__ = "addon" __version__ = "0.17" __config__ = [("activated", "bool", "Activated", True), @@ -70,9 +72,10 @@ class ExtractArchive(Addon): ("renice", "int", "CPU Priority", 0)] __description__ = """Extract different kind of archives""" - __authors__ = [("RaNaN", "ranan@pyload.org"), - ("AndroKev", None), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "ranan@pyload.org"), + ("AndroKev", None), + ("Walter Purcaro", "vuolter@gmail.com")] event_list = ["allDownloadsProcessed"] @@ -307,16 +310,18 @@ class ExtractArchive(Addon): def reloadPasswords(self): passwordfile = self.getConfig("passwordfile") - if not exists(passwordfile): - open(passwordfile, "wb").close() - passwords = [] - f = open(passwordfile, "rb") - for pw in f.read().splitlines(): - passwords.append(pw) - f.close() + try: + passwords = [] + with open(passwordfile, "a+") as f: + for pw in f.read().splitlines(): + passwords.append(pw) - self.passwords = passwords + except IOError, e: + self.logError(e) + + else: + self.passwords = passwords @Expose @@ -326,12 +331,15 @@ class ExtractArchive(Addon): if pw in self.passwords: self.passwords.remove(pw) + self.passwords.insert(0, pw) - f = open(passwordfile, "wb") - for pw in self.passwords: - f.write(pw + "\n") - f.close() + try: + with open(passwordfile, "wb") as f: + for pw in self.passwords: + f.write(pw + "\n") + except IOError, e: + self.logError(e) def setPermissions(self, files): diff --git a/pyload/plugins/addon/HotFolder.py b/pyload/plugins/addon/HotFolder.py index cceb71ca7..0bce193ce 100644 --- a/pyload/plugins/addon/HotFolder.py +++ b/pyload/plugins/addon/HotFolder.py @@ -7,58 +7,58 @@ from os.path import exists, isfile, join from shutil import move from pyload.plugins.base.Addon import Addon +from module.utils import fs_encode, save_join class HotFolder(Addon): - __name__ = "HotFolder" - __type__ = "addon" + __name__ = "HotFolder" + __type__ = "addon" __version__ = "0.11" - __config__ = [("activated", "bool", "Activated", False), - ("folder", "str", "Folder to observe", "container"), + __config__ = [("folder", "str", "Folder to observe", "container"), ("watch_file", "bool", "Observe link file", False), ("keep", "bool", "Keep added containers", True), ("file", "str", "Link file", "links.txt")] __description__ = """Observe folder and file for changes and add container and links""" - __authors__ = [("RaNaN", "RaNaN@pyload.de")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.de")] def setup(self): self.interval = 10 + def periodical(self): - if not exists(join(self.getConfig("folder"), "finished")): - makedirs(join(self.getConfig("folder"), "finished")) + folder = fs_encode(self.getConfig("folder")) + + try: + if not exists(join(folder, "finished")): + makedirs(join(folder, "finished")) - if self.getConfig("watch_file"): + if self.getConfig("watch_file"): + with open(fs_encode(self.getConfig("file")), "a+") as f: + content = f.read().strip() - if not exists(self.getConfig("file")): - f = open(self.getConfig("file"), "wb") - f.close() + if content: + name = "%s_%s.txt" % (self.getConfig("file"), time.strftime("%H-%M-%S_%d%b%Y")) - f = open(self.getConfig("file"), "rb") - content = f.read().strip() - f.close() - f = open(self.getConfig("file"), "wb") - f.close() - if content: - name = "%s_%s.txt" % (self.getConfig("file"), time.strftime("%H-%M-%S_%d%b%Y")) + with open(save_join(folder, "finished", name), "wb") as f: + f.write(content) - f = open(join(self.getConfig("folder"), "finished", name), "wb") - f.write(content) - f.close() + self.core.api.addPackage(f.name, [f.name], 1) - self.core.api.addPackage(f.name, [f.name], 1) + for f in listdir(folder): + path = join(folder, f) - for f in listdir(self.getConfig("folder")): - path = join(self.getConfig("folder"), f) + if not isfile(path) or f.endswith("~") or f.startswith("#") or f.startswith("."): + continue - if not isfile(path) or f.endswith("~") or f.startswith("#") or f.startswith("."): - continue + newpath = join(folder, "finished", f if self.getConfig("keep") else "tmp_" + f) + move(path, newpath) - newpath = join(self.getConfig("folder"), "finished", f if self.getConfig("keep") else "tmp_" + f) - move(path, newpath) + self.logInfo(_("Added %s from HotFolder") % f) + self.core.api.addPackage(f, [newpath], 1) - self.logInfo(_("Added %s from HotFolder") % f) - self.core.api.addPackage(f, [newpath], 1) + except IOError, e: + self.logError(e) diff --git a/pyload/plugins/addon/IRCInterface.py b/pyload/plugins/addon/IRCInterface.py index 9f77bfc7e..041c8b07b 100644 --- a/pyload/plugins/addon/IRCInterface.py +++ b/pyload/plugins/addon/IRCInterface.py @@ -2,6 +2,7 @@ import re import socket +import ssl import time from pycurl import FORM_FILE @@ -17,15 +18,15 @@ from pyload.utils import formatSize class IRCInterface(Thread, Addon): - __name__ = "IRCInterface" - __type__ = "addon" - __version__ = "0.11" + __name__ = "IRCInterface" + __type__ = "addon" + __version__ = "0.12" - __config__ = [("activated", "bool", "Activated", False), - ("host", "str", "IRC-Server Address", "Enter your server here!"), + __config__ = [("host", "str", "IRC-Server Address", "Enter your server here!"), ("port", "int", "IRC-Server Port", 6667), ("ident", "str", "Clients ident", "pyload-irc"), ("realname", "str", "Realname", "pyload-irc"), + ("ssl", "bool", "Use SSL", False), ("nick", "str", "Nickname the Client will take", "pyLoad-IRC"), ("owner", "str", "Nickname the Client will accept commands from", "Enter your nick here!"), ("info_file", "bool", "Inform about every file finished", False), @@ -33,15 +34,15 @@ class IRCInterface(Thread, Addon): ("captcha", "bool", "Send captcha requests", True)] __description__ = """Connect to irc and let owner perform different tasks""" - __authors__ = [("Jeix", "Jeix@hasnomail.com")] + __license__ = "GPLv3" + __authors__ = [("Jeix", "Jeix@hasnomail.com")] def __init__(self, core, manager): Thread.__init__(self) Addon.__init__(self, core, manager) self.setDaemon(True) - # self.sm = core.server_methods - self.api = core.api # todo, only use api + def coreReady(self): self.abort = False @@ -50,6 +51,7 @@ class IRCInterface(Thread, Addon): self.start() + def packageFinished(self, pypack): try: if self.getConfig("info_pack"): @@ -57,6 +59,7 @@ class IRCInterface(Thread, Addon): except: pass + def downloadFinished(self, pyfile): try: if self.getConfig("info_file"): @@ -65,6 +68,7 @@ class IRCInterface(Thread, Addon): except: pass + def newCaptchaTask(self, task): if self.getConfig("captcha") and task.isTextual(): task.handler.append(self) @@ -77,11 +81,16 @@ class IRCInterface(Thread, Addon): self.response(_("New Captcha Request: %s") % url) self.response(_("Answer with 'c %s text on the captcha'") % task.id) + def run(self): # connect to IRC etc. self.sock = socket.socket() host = self.getConfig("host") self.sock.connect((host, self.getConfig("port"))) + + if self.getConfig("ssl"): + self.sock = ssl.wrap_socket(self.sock, cert_reqs=ssl.CERT_NONE) #@TODO: support certificate + nick = self.getConfig("nick") self.sock.send("NICK %s\r\n" % nick) self.sock.send("USER %s %s bla :%s\r\n" % (nick, host, nick)) @@ -98,6 +107,7 @@ class IRCInterface(Thread, Addon): print_exc() self.sock.close() + def main_loop(self): readbuffer = "" while True: @@ -136,6 +146,7 @@ class IRCInterface(Thread, Addon): self.handle_events(msg) + def handle_events(self, msg): if not msg['origin'].split("!", 1)[0] in self.getConfig("owner").split(): return @@ -148,15 +159,15 @@ class IRCInterface(Thread, Addon): # HANDLE CTCP ANTI FLOOD/BOT PROTECTION if msg['text'] == "\x01VERSION\x01": - self.logDebug("Sending CTCP VERSION.") + self.logDebug("Sending CTCP VERSION") self.sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) return elif msg['text'] == "\x01TIME\x01": - self.logDebug("Sending CTCP TIME.") + self.logDebug("Sending CTCP TIME") self.sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) return elif msg['text'] == "\x01LAG\x01": - self.logDebug("Received CTCP LAG.") # don't know how to answer + self.logDebug("Received CTCP LAG") #: don't know how to answer return trigger = "pass" @@ -176,7 +187,8 @@ class IRCInterface(Thread, Addon): for line in res: self.response(line, msg['origin']) except Exception, e: - self.logError(repr(e)) + self.logError(e) + def response(self, msg, origin=""): if origin == "": @@ -185,13 +197,15 @@ class IRCInterface(Thread, Addon): else: self.sock.send("PRIVMSG %s :%s\r\n" % (origin.split("!", 1)[0], msg)) + #### Events def event_pass(self, args): return [] + def event_status(self, args): - downloads = self.api.statusDownloads() + downloads = self.core.api.statusDownloads() if not downloads: return ["INFO: There are no active downloads currently."] @@ -215,8 +229,9 @@ class IRCInterface(Thread, Addon): )) return lines + def event_queue(self, args): - ps = self.api.getQueueData() + ps = self.core.api.getQueueData() if not ps: return ["INFO: There are no packages in queue."] @@ -227,8 +242,9 @@ class IRCInterface(Thread, Addon): return lines + def event_collector(self, args): - ps = self.api.getCollectorData() + ps = self.core.api.getCollectorData() if not ps: return ["INFO: No packages in collector!"] @@ -238,19 +254,21 @@ class IRCInterface(Thread, Addon): return lines + def event_info(self, args): if not args: return ["ERROR: Use info like this: info <id>"] info = None try: - info = self.api.getFileData(int(args[0])) + info = self.core.api.getFileData(int(args[0])) except FileDoesNotExists: return ["ERROR: Link doesn't exists."] return ['LINK #%s: %s (%s) [%s][%s]' % (info.fid, info.name, info.format_size, info.statusmsg, info.plugin)] + def event_packinfo(self, args): if not args: return ["ERROR: Use packinfo like this: packinfo <id>"] @@ -258,7 +276,7 @@ class IRCInterface(Thread, Addon): lines = [] pack = None try: - pack = self.api.getPackageData(int(args[0])) + pack = self.core.api.getPackageData(int(args[0])) except PackageDoesNotExists: return ["ERROR: Package doesn't exists."] @@ -282,6 +300,7 @@ class IRCInterface(Thread, Addon): return lines + def event_more(self, args): if not self.more: return ["No more information to display."] @@ -292,14 +311,17 @@ class IRCInterface(Thread, Addon): return lines + def event_start(self, args): - self.api.unpauseServer() + self.core.api.unpauseServer() return ["INFO: Starting downloads."] + def event_stop(self, args): - self.api.pauseServer() + self.core.api.pauseServer() return ["INFO: No new downloads will be started."] + def event_add(self, args): if len(args) < 2: return ['ERROR: Add links like this: "add <packagename|id> links". ', @@ -312,7 +334,7 @@ class IRCInterface(Thread, Addon): count_failed = 0 try: id = int(pack) - pack = self.api.getPackageData(id) + pack = self.core.api.getPackageData(id) if not pack: return ["ERROR: Package doesn't exists."] @@ -322,48 +344,52 @@ class IRCInterface(Thread, Addon): except: # create new package - id = self.api.addPackage(pack, links, 1) + id = self.core.api.addPackage(pack, links, 1) return ["INFO: Created new Package %s [#%d] with %d links." % (pack, id, len(links))] + def event_del(self, args): if len(args) < 2: return ["ERROR: Use del command like this: del -p|-l <id> [...] (-p indicates that the ids are from packages, -l indicates that the ids are from links)"] if args[0] == "-p": - ret = self.api.deletePackages(map(int, args[1:])) + ret = self.core.api.deletePackages(map(int, args[1:])) return ["INFO: Deleted %d packages!" % len(args[1:])] elif args[0] == "-l": - ret = self.api.delLinks(map(int, args[1:])) + ret = self.core.api.delLinks(map(int, args[1:])) return ["INFO: Deleted %d links!" % len(args[1:])] else: return ["ERROR: Use del command like this: del <-p|-l> <id> [...] (-p indicates that the ids are from packages, -l indicates that the ids are from links)"] + def event_push(self, args): if not args: return ["ERROR: Push package to queue like this: push <package id>"] id = int(args[0]) try: - info = self.api.getPackageInfo(id) + info = self.core.api.getPackageInfo(id) except PackageDoesNotExists: return ["ERROR: Package #%d does not exist." % id] - self.api.pushToQueue(id) + self.core.api.pushToQueue(id) return ["INFO: Pushed package #%d to queue." % id] + def event_pull(self, args): if not args: return ["ERROR: Pull package from queue like this: pull <package id>."] id = int(args[0]) - if not self.api.getPackageData(id): + if not self.core.api.getPackageData(id): return ["ERROR: Package #%d does not exist." % id] - self.api.pullFromQueue(id) + self.core.api.pullFromQueue(id) return ["INFO: Pulled package #%d from queue to collector." % id] + def event_c(self, args): """ captcha answer """ if not args: @@ -376,6 +402,7 @@ class IRCInterface(Thread, Addon): task.setResult(" ".join(args[1:])) return ["INFO: Result %s saved." % " ".join(args[1:])] + def event_help(self, args): lines = ["The following commands are available:", "add <package|packid> <links> [...] Adds link to package. (creates new package if it does not exist)", @@ -399,5 +426,6 @@ class IRCError(Exception): def __init__(self, value): self.value = value + def __str__(self): return repr(self.value) diff --git a/pyload/plugins/addon/MergeFiles.py b/pyload/plugins/addon/MergeFiles.py index 1edbf119a..e67f87f56 100644 --- a/pyload/plugins/addon/MergeFiles.py +++ b/pyload/plugins/addon/MergeFiles.py @@ -2,21 +2,23 @@ import os import re -import traceback + +from traceback import print_exc from pyload.plugins.base.Addon import Addon, threaded from pyload.utils import safe_join, fs_encode class MergeFiles(Addon): - __name__ = "MergeFiles" - __type__ = "addon" + __name__ = "MergeFiles" + __type__ = "addon" __version__ = "0.12" - __config__ = [("activated", "bool", "Activated", False)] + __config__ = [("activated", "bool", "Activated", True)] __description__ = """Merges parts splitted with hjsplit""" - __authors__ = [("and9000", "me@has-no-mail.com")] + __license__ = "GPLv3" + __authors__ = [("and9000", "me@has-no-mail.com")] BUFFER_SIZE = 4096 @@ -26,12 +28,13 @@ class MergeFiles(Addon): # nothing to do pass + @threaded def packageFinished(self, pack): files = {} fid_dict = {} for fid, data in pack.getChildren().iteritems(): - if re.search("\.[0-9]{3}$", data['name']): + if re.search("\.\d{3}$", data['name']): if data['name'][:-4] not in files: files[data['name'][:-4]] = [] files[data['name'][:-4]].append(data['name']) @@ -55,6 +58,7 @@ class MergeFiles(Addon): s_file = open(os.path.join(download_folder, splitted_file), "rb") size_written = 0 s_file_size = int(os.path.getsize(os.path.join(download_folder, splitted_file))) + while True: f_buffer = s_file.read(self.BUFFER_SIZE) if f_buffer: @@ -63,10 +67,13 @@ class MergeFiles(Addon): pyfile.setProgress((size_written * 100) / s_file_size) else: break + s_file.close() self.logDebug("Finished merging part", splitted_file) + except Exception, e: - print traceback.print_exc() + print_exc() + finally: pyfile.setProgress(100) pyfile.setStatus("finished") diff --git a/pyload/plugins/addon/MultiHome.py b/pyload/plugins/addon/MultiHome.py index f7bca4843..a808802ba 100644 --- a/pyload/plugins/addon/MultiHome.py +++ b/pyload/plugins/addon/MultiHome.py @@ -6,15 +6,15 @@ from pyload.plugins.base.Addon import Addon class MultiHome(Addon): - __name__ = "MultiHome" - __type__ = "addon" + __name__ = "MultiHome" + __type__ = "addon" __version__ = "0.11" - __config__ = [("activated", "bool", "Activated", False), - ("interfaces", "str", "Interfaces", "None")] + __config__ = [("interfaces", "str", "Interfaces", "None")] __description__ = """Ip address changer""" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] def setup(self): @@ -25,15 +25,18 @@ class MultiHome(Addon): self.parseInterfaces([self.config['download']['interface']]) self.setConfig("interfaces", self.toConfig()) + def toConfig(self): return ";".join([i.adress for i in self.interfaces]) + def parseInterfaces(self, interfaces): for interface in interfaces: if not interface or str(interface).lower() == "none": continue self.interfaces.append(Interface(interface)) + def coreReady(self): requestFactory = self.core.requestFactory oldGetRequest = requestFactory.getRequest @@ -48,6 +51,7 @@ class MultiHome(Addon): requestFactory.getRequest = getRequest + def bestInterface(self, pluginName, account): best = None for interface in self.interfaces: @@ -62,13 +66,16 @@ class Interface(object): self.adress = adress self.history = {} + def lastPluginAccess(self, pluginName, account): if (pluginName, account) in self.history: return self.history[(pluginName, account)] return 0 + def useFor(self, pluginName, account): self.history[(pluginName, account)] = time() + def __repr__(self): return "<Interface - %s>" % self.adress diff --git a/pyload/plugins/addon/RestartFailed.py b/pyload/plugins/addon/RestartFailed.py index 7d736db46..879836bcf 100644 --- a/pyload/plugins/addon/RestartFailed.py +++ b/pyload/plugins/addon/RestartFailed.py @@ -4,18 +4,18 @@ from pyload.plugins.base.Addon import Addon class RestartFailed(Addon): - __name__ = "RestartFailed" - __type__ = "addon" - __version__ = "1.55" + __name__ = "RestartFailed" + __type__ = "addon" + __version__ = "1.57" - __config__ = [("activated", "bool", "Activated", False), - ("interval", "int", "Check interval in minutes", 90)] + __config__ = [("interval", "int", "Check interval in minutes", 90)] __description__ = """Periodically restart all failed downloads in queue""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - event_list = ["pluginConfigChanged"] + # event_list = ["pluginConfigChanged"] MIN_INTERVAL = 15 * 60 #: 15m minimum check interval (value is in seconds) @@ -30,13 +30,15 @@ class RestartFailed(Addon): else: self.logDebug("Invalid interval value, kept current") + def periodical(self): - self.logInfo(_("Restart failed downloads")) - self.api.restartFailed() + self.logDebug(_("Restart failed downloads")) + self.core.api.restartFailed() + def setup(self): - self.api = self.core.api self.interval = self.MIN_INTERVAL + def coreReady(self): self.pluginConfigChanged(self.__name__, "interval", self.getConfig("interval")) diff --git a/pyload/plugins/addon/UnSkipOnFail.py b/pyload/plugins/addon/UnSkipOnFail.py index 7ab069e93..5122e21eb 100644 --- a/pyload/plugins/addon/UnSkipOnFail.py +++ b/pyload/plugins/addon/UnSkipOnFail.py @@ -8,14 +8,15 @@ from pyload.utils import fs_encode class UnSkipOnFail(Addon): - __name__ = "UnSkipOnFail" - __type__ = "addon" + __name__ = "UnSkipOnFail" + __type__ = "addon" __version__ = "0.01" __config__ = [("activated", "bool", "Activated", True)] __description__ = """When a download fails, restart skipped duplicates""" - __authors__ = [("hagg", None)] + __license__ = "GPLv3" + __authors__ = [("hagg", None)] def downloadFailed(self, pyfile): @@ -31,6 +32,7 @@ class UnSkipOnFail(Addon): self.logInfo(_('restart "%s" (pid:%s)') % (pyfile_name, lpid)) self.setLinkStatus(link, "queued") + def findDuplicates(self, pyfile): """ Search all packages for duplicate links to "pyfile". Duplicates are links that would overwrite "pyfile". @@ -60,6 +62,7 @@ class UnSkipOnFail(Addon): dups.append(link) return dups + def setLinkStatus(self, link, new_status): """ Change status of "link" to "new_status". "link" has to be a valid FileData object, diff --git a/pyload/plugins/addon/WindowsPhoneToastNotify.py b/pyload/plugins/addon/WindowsPhoneToastNotify.py index e6605dfb2..e35f74e84 100644 --- a/pyload/plugins/addon/WindowsPhoneToastNotify.py +++ b/pyload/plugins/addon/WindowsPhoneToastNotify.py @@ -7,22 +7,23 @@ from pyload.plugins.base.Addon import Addon class WindowsPhoneToastNotify(Addon): - __name__ = "WindowsPhoneToastNotify" - __type__ = "addon" + __name__ = "WindowsPhoneToastNotify" + __type__ = "addon" __version__ = "0.02" - __config__ = [("activated", "bool", "Activated", False), - ("force", "bool", "Force even if client is connected", False), + __config__ = [("force", "bool", "Force even if client is connected", False), ("pushId", "str", "pushId", ""), ("pushUrl", "str", "pushUrl", ""), ("pushTimeout", "int", "Timeout between notifications in seconds", 0)] __description__ = """Send push notifications to Windows Phone""" - __authors__ = [("Andy Voigt", "phone-support@hotmail.de")] + __license__ = "GPLv3" + __authors__ = [("Andy Voigt", "phone-support@hotmail.de")] def setup(self): - self.info = {} + self.info = {} #@TODO: Remove in 0.4.10 + def getXmlData(self): myxml = ("<?xml version='1.0' encoding='utf-8'?> <wp:Notification xmlns:wp='WPNotification'> " @@ -30,6 +31,7 @@ class WindowsPhoneToastNotify(Addon): "</wp:Toast> </wp:Notification>") return myxml + def doRequest(self): URL = self.getConfig("pushUrl") request = self.getXmlData() @@ -45,6 +47,7 @@ class WindowsPhoneToastNotify(Addon): webservice.close() self.setStorage("LAST_NOTIFY", time.time()) + def newCaptchaTask(self, task): if not self.getConfig("pushId") or not self.getConfig("pushUrl"): return False diff --git a/pyload/plugins/addon/XMPPInterface.py b/pyload/plugins/addon/XMPPInterface.py index de04f05fb..07db5c66a 100644 --- a/pyload/plugins/addon/XMPPInterface.py +++ b/pyload/plugins/addon/XMPPInterface.py @@ -10,12 +10,11 @@ from pyload.plugins.addon.IRCInterface import IRCInterface class XMPPInterface(IRCInterface, JabberClient): - __name__ = "XMPPInterface" - __type__ = "addon" + __name__ = "XMPPInterface" + __type__ = "addon" __version__ = "0.11" - __config__ = [("activated", "bool", "Activated", False), - ("jid", "str", "Jabber ID", "user@exmaple-jabber-server.org"), + __config__ = [("jid", "str", "Jabber ID", "user@exmaple-jabber-server.org"), ("pw", "str", "Password", ""), ("tls", "bool", "Use TLS", False), ("owners", "str", "List of JIDs accepting commands from", "me@icq-gateway.org;some@msn-gateway.org"), @@ -24,11 +23,13 @@ class XMPPInterface(IRCInterface, JabberClient): ("captcha", "bool", "Send captcha requests", True)] __description__ = """Connect to jabber and let owner perform different tasks""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] implements(IMessageHandlersProvider) + def __init__(self, core, manager): IRCInterface.__init__(self, core, manager) @@ -57,11 +58,13 @@ class XMPPInterface(IRCInterface, JabberClient): self, ] + def coreReady(self): self.new_package = {} self.start() + def packageFinished(self, pypack): try: if self.getConfig("info_pack"): @@ -69,6 +72,7 @@ class XMPPInterface(IRCInterface, JabberClient): except: pass + def downloadFinished(self, pyfile): try: if self.getConfig("info_file"): @@ -77,6 +81,7 @@ class XMPPInterface(IRCInterface, JabberClient): except: pass + def run(self): # connect to IRC etc. self.connect() @@ -85,21 +90,26 @@ class XMPPInterface(IRCInterface, JabberClient): except Exception, ex: self.logError(ex) + def stream_state_changed(self, state, arg): """This one is called when the state of stream connecting the component to a server changes. This will usually be used to let the user know what is going on.""" self.logDebug("*** State changed: %s %r ***" % (state, arg)) + def disconnected(self): self.logDebug("Client was disconnected") + def stream_closed(self, stream): self.logDebug("Stream was closed", stream) + def stream_error(self, err): self.logDebug("Stream Error", err) + def get_message_handlers(self): """Return list of (message_type, message_handler) tuples. @@ -107,6 +117,7 @@ class XMPPInterface(IRCInterface, JabberClient): in a client session.""" return [("normal", self.message)] + def message(self, stanza): """Message handler for the component.""" subject = stanza.get_subject() @@ -157,16 +168,18 @@ class XMPPInterface(IRCInterface, JabberClient): messages.append(m) except Exception, e: - self.logError(repr(e)) + self.logError(e) return messages else: return True + def response(self, msg, origin=""): return self.announce(msg) + def announce(self, message): """ send message to all owners""" for user in self.getConfig("owners").split(";"): @@ -186,9 +199,11 @@ class XMPPInterface(IRCInterface, JabberClient): stream.send(m) + def beforeReconnecting(self, ip): self.disconnect() + def afterReconnecting(self, ip): self.connect() @@ -201,24 +216,29 @@ class VersionHandler(object): implements(IIqHandlersProvider, IFeaturesProvider) + def __init__(self, client): """Just remember who created this.""" self.client = client + def get_features(self): """Return namespace which should the client include in its reply to a disco#info query.""" return ["jabber:iq:version"] + def get_iq_get_handlers(self): """Return list of tuples (element_name, namespace, handler) describing handlers of <iq type='get'/> stanzas""" return [("query", "jabber:iq:version", self.get_version)] + def get_iq_set_handlers(self): """Return empty list, as this class provides no <iq type='set'/> stanza handler.""" return [] + def get_version(self, iq): """Handler for jabber:iq:version queries. diff --git a/pyload/plugins/base/Account.py b/pyload/plugins/base/Account.py index 687803d2e..acb5c7d8b 100644 --- a/pyload/plugins/base/Account.py +++ b/pyload/plugins/base/Account.py @@ -19,12 +19,13 @@ class Account(Base): Just overwrite `login` and cookies will be stored and account becomes accessible in\ associated hoster plugin. Plugin should also provide `loadAccountInfo` """ - __name__ = "Account" - __type__ = "account" - __version__ = "0.3" + __name__ = "Account" + __type__ = "account" + __version__ = "0.03" __description__ = """Base account plugin""" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] #: after that time (in minutes) pyload will relogin the account @@ -38,16 +39,19 @@ class Account(Base): self.manager = manager self.accounts = {} - self.infos = {} # cache for account information + self.infos = {} #: cache for account information self.lock = RLock() - self.timestamps = {} - self.setAccounts(accounts) + self.init() + self.setAccounts(accounts) + + def init(self): pass + def login(self, user, data, req): """login into account, the cookies will be saved so user can be recognized @@ -57,6 +61,7 @@ class Account(Base): """ pass + @lock def _login(self, user, data): # set timestamp for login @@ -84,6 +89,7 @@ class Account(Base): req.close() return success + def relogin(self, user): req = self.getAccountRequest(user) if req: @@ -94,12 +100,14 @@ class Account(Base): return self._login(user, self.accounts[user]) + def setAccounts(self, accounts): self.accounts = accounts for user, data in self.accounts.iteritems(): self._login(user, data) self.infos[user] = {} + def updateAccounts(self, user, password=None, options={}): """ updates account and return true if anything changed """ @@ -118,6 +126,7 @@ class Account(Base): self._login(user, self.accounts[user]) return True + def removeAccount(self, user): if user in self.accounts: del self.accounts[user] @@ -126,6 +135,7 @@ class Account(Base): if user in self.timestamps: del self.timestamps[user] + @lock def getAccountInfo(self, name, force=False): """retrieve account infos for an user, do **not** overwrite this method!\\ @@ -164,10 +174,12 @@ class Account(Base): data.update(self.infos[name]) return data + def isPremium(self, user): info = self.getAccountInfo(user) return info['premium'] + def loadAccountInfo(self, name, req=None): """this should be overwritten in account plugin,\ and retrieving account information for user @@ -176,22 +188,22 @@ class Account(Base): :param req: `Request` instance :return: """ - return { - "validuntil": None, # -1 for unlimited - "login": name, - #"password": self.accounts[name]['password'], #@XXX: security - "options": self.accounts[name]['options'], - "valid": self.accounts[name]['valid'], - "trafficleft": None, # in kb, -1 for unlimited - "maxtraffic": None, - "premium": True, #useful for free accounts - "timestamp": 0, #time this info was retrieved - "type": self.__name__, - } + return {"validuntil": None, #: -1 for unlimited + "login": name, + # "password": self.accounts[name]['password'], #: commented due security reason + "options": self.accounts[name]['options'], + "valid": self.accounts[name]['valid'], + "trafficleft": None, #: in kb, -1 for unlimited + "maxtraffic": None, + "premium": None, + "timestamp": 0, #: time this info was retrieved + "type": self.__name__} + def getAllAccounts(self, force=False): return [self.getAccountInfo(user, force) for user, data in self.accounts.iteritems()] + def getAccountRequest(self, user=None): if not user: user, data = self.selectAccount() @@ -201,6 +213,7 @@ class Account(Base): req = self.core.requestFactory.getRequest(self.__name__, user) return req + def getAccountCookies(self, user=None): if not user: user, data = self.selectAccount() @@ -210,9 +223,11 @@ class Account(Base): cj = self.core.requestFactory.getCookieJar(self.__name__, user) return cj + def getAccountData(self, user): return self.accounts[user] + def selectAccount(self): """ returns an valid account name and data""" usable = [] @@ -242,15 +257,19 @@ class Account(Base): if not usable: return None, None return choice(usable) + def canUse(self): return False if self.selectAccount() == (None, None) else True + def parseTraffic(self, string): #returns kbyte - return parseFileSize(string) / 1024 + return parseFileSize(string) + def wrongPassword(self): raise WrongPassword + def empty(self, user): if user in self.infos: self.logWarning(_("Account %s has not enough traffic, checking again in 30min") % user) @@ -258,6 +277,7 @@ class Account(Base): self.infos[user].update({"trafficleft": 0}) self.scheduleRefresh(user, 30 * 60) + def expired(self, user): if user in self.infos: self.logWarning(_("Account %s is expired, checking again in 1h") % user) @@ -265,11 +285,13 @@ class Account(Base): self.infos[user].update({"validuntil": time() - 1}) self.scheduleRefresh(user, 60 * 60) + def scheduleRefresh(self, user, time=0, force=True): """ add task to refresh account info to sheduler """ self.logDebug("Scheduled Account refresh for %s in %s seconds." % (user, time)) self.core.scheduler.addJob(time, self.getAccountInfo, [user, force]) + @lock def checkLogin(self, user): """ checks if user is still logged in """ diff --git a/pyload/plugins/base/Container.py b/pyload/plugins/base/Container.py index 40cc25195..1bb2e204b 100644 --- a/pyload/plugins/base/Container.py +++ b/pyload/plugins/base/Container.py @@ -10,14 +10,16 @@ from pyload.utils import safe_join class Container(Crypter): - __name__ = "Container" - __type__ = "container" - __version__ = "0.1" + __name__ = "Container" + __type__ = "container" + __version__ = "0.01" __pattern__ = None + __config__ = [] #: [("name", "type", "desc", "default")] __description__ = """Base container decrypter plugin""" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] def preprocessing(self, thread): @@ -42,9 +44,11 @@ class Container(Crypter): self.pyfile.name = re.findall("([^\/=]+)", self.pyfile.url)[-1] content = self.load(self.pyfile.url) self.pyfile.url = safe_join(self.config['general']['download_folder'], self.pyfile.name) - f = open(self.pyfile.url, "wb" ) - f.write(content) - f.close() + try: + with open(self.pyfile.url, "wb") as f: + f.write(content) + except IOError, e: + self.fail(str(e)) else: self.pyfile.name = basename(self.pyfile.url) @@ -52,7 +56,7 @@ class Container(Crypter): if exists(safe_join(pypath, self.pyfile.url)): self.pyfile.url = safe_join(pypath, self.pyfile.url) else: - self.fail(_("File not exists.")) + self.fail(_("File not exists")) def deleteTmp(self): diff --git a/pyload/plugins/base/Crypter.py b/pyload/plugins/base/Crypter.py index 8d269c75d..0a79300dd 100644 --- a/pyload/plugins/base/Crypter.py +++ b/pyload/plugins/base/Crypter.py @@ -1,35 +1,47 @@ # -*- coding: utf-8 -*- from pyload.plugins.Plugin import Plugin +from module.utils import save_path class Crypter(Plugin): - __name__ = "Crypter" - __type__ = "crypter" - __version__ = "0.1" + __name__ = "Crypter" + __type__ = "crypter" + __version__ = "0.05" __pattern__ = None + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package'] + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Base decrypter plugin""" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - def __init__(self, pyfile): - Plugin.__init__(self, pyfile) + html = None #: last html loaded + + def __init__(self, pyfile): #: Put all packages here. It's a list of tuples like: ( name, [list of links], folder ) self.packages = [] #: List of urls, pyLoad will generate packagenames self.urls = [] - self.multiDL = True - self.limitDL = 0 + Plugin.__init__(self, pyfile) def process(self, pyfile): """ main method """ + self.decrypt(pyfile) + + if self.urls: + self.generatePackages() + + elif not self.packages: + self.error(_("No link extracted"), "decrypt") + self.createPackages() @@ -37,24 +49,59 @@ class Crypter(Plugin): raise NotImplementedError + def generatePackages(self): + """ generate new packages from self.urls """ + + packages = map(lambda name, links: (name, links, None), self.core.api.generatePackages(self.urls).iteritems()) + self.packages.extend(packages) + + def createPackages(self): """ create new packages from self.packages """ - for pack in self.packages: + package_folder = self.pyfile.package().folder + package_password = self.pyfile.package().password + package_queue = self.pyfile.package().queue + + folder_per_package = self.config['general']['folder_per_package'] + try: + use_subfolder = self.getConfig('use_subfolder') + except: + use_subfolder = folder_per_package + try: + subfolder_per_package = self.getConfig('subfolder_per_package') + except: + subfolder_per_package = True + + for pack in self.packages: name, links, folder = pack - self.logDebug("Parsed package %(name)s with %(len)d links" % {"name": name, "len": len(links)}) + self.logDebug("Parsed package: %s" % name, + "%d links" % len(links), + "Saved to folder: %s" % folder if folder else "Saved to download folder") - links = [x.decode("utf-8") for x in links] + links = map(lambda x: x.decode("utf-8"), links) - pid = self.api.addPackage(name, links, self.pyfile.package().queue) + pid = self.core.api.addPackage(name, links, package_queue) - if name != folder is not None: - self.api.setPackageData(pid, {"folder": folder}) #: Due to not break API addPackage method right now - self.logDebug("Set package %(name)s folder to %(folder)s" % {"name": name, "folder": folder}) + if package_password: + self.core.api.setPackageData(pid, {"password": package_password}) - if self.pyfile.package().password: - self.api.setPackageData(pid, {"password": self.pyfile.package().password}) + setFolder = lambda x: self.core.api.setPackageData(pid, {"folder": x or ""}) #: Workaround to do not break API addPackage method - if self.urls: - self.api.generateAndAddPackages(self.urls) + if use_subfolder: + if not subfolder_per_package: + setFolder(package_folder) + self.logDebug("Set package %(name)s folder to: %(folder)s" % {"name": name, "folder": folder}) + + elif not folder_per_package or name != folder: + if not folder: + folder = name.replace("http://", "").replace(":", "").replace("/", "_").replace("\\", "_") + + folder = save_path(folder) #@TODO: move to core code + + setFolder(folder) + self.logDebug("Set package %(name)s folder to: %(folder)s" % {"name": name, "folder": folder}) + + elif folder_per_package: + setFolder(None) diff --git a/pyload/plugins/base/Hook.py b/pyload/plugins/base/Hook.py index 718802ad8..5cd528b7e 100644 --- a/pyload/plugins/base/Hook.py +++ b/pyload/plugins/base/Hook.py @@ -24,15 +24,16 @@ class Hook(Base): """ Base class for hook plugins. """ - __name__ = "Hook" - __type__ = "hook" - __version__ = "0.2" + __name__ = "Hook" + __type__ = "hook" + __version__ = "0.03" - __config__ = [("name", "type", "desc", "default")] + __config__ = [] #: [("name", "type", "desc", "default")] __description__ = """Interface for hook""" - __authors__ = [("mkaay", "mkaay@mkaay.de"), - ("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de"), + ("RaNaN", "RaNaN@pyload.org")] #: automatically register event listeners for functions, attribute will be deleted dont use it yourself @@ -50,7 +51,7 @@ class Hook(Base): Base.__init__(self, core) #: Provide information in dict here, usable by API `getInfo` - self.info = None + self.info = {} #: Callback of periodical job task, used by AddonManager self.cb = None @@ -84,6 +85,7 @@ class Hook(Base): if self.interval >=1: self.cb = self.core.scheduler.addJob(0, self._periodical, threaded=False) + def _periodical(self): try: if self.isActivated(): self.periodical() @@ -98,14 +100,17 @@ class Hook(Base): def __repr__(self): return "<Hook %s>" % self.__name__ + def setup(self): """ more init stuff if needed """ pass + def unload(self): """ called when hook was deactivated """ pass + def isActivated(self): """ checks if hook is activated""" return self.config.getPlugin(self.__name__, "activated") @@ -115,36 +120,47 @@ class Hook(Base): def coreReady(self): pass + def coreExiting(self): pass + def downloadPreparing(self, pyfile): pass + def downloadFinished(self, pyfile): pass + def downloadFailed(self, pyfile): pass + def packageFinished(self, pypack): pass + def beforeReconnecting(self, ip): pass + def afterReconnecting(self, ip): pass + def periodical(self): pass + def newCaptchaTask(self, task): """ new captcha task for the plugin, it MUST set the handler and timeout or will be ignored """ pass + def captchaCorrect(self, task): pass + def captchaInvalid(self, task): pass diff --git a/pyload/plugins/base/Hoster.py b/pyload/plugins/base/Hoster.py index 8f0bdb727..a89727ba7 100644 --- a/pyload/plugins/base/Hoster.py +++ b/pyload/plugins/base/Hoster.py @@ -9,11 +9,13 @@ def getInfo(self): class Hoster(Plugin): - __name__ = "Hoster" - __type__ = "hoster" - __version__ = "0.1" + __name__ = "Hoster" + __type__ = "hoster" + __version__ = "0.02" __pattern__ = None + __config__ = [] #: [("name", "type", "desc", "default")] __description__ = """Base hoster plugin""" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] diff --git a/pyload/plugins/base/OCR.py b/pyload/plugins/base/OCR.py index 5ce85aef6..c3a47e7ef 100644 --- a/pyload/plugins/base/OCR.py +++ b/pyload/plugins/base/OCR.py @@ -14,29 +14,34 @@ from os.path import abspath, join class OCR(object): - __name__ = "OCR" - __type__ = "ocr" + __name__ = "OCR" + __type__ = "ocr" __version__ = "0.1" __description__ = """OCR base plugin""" - __authors__ = [("pyLoad Team", "admin@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] def __init__(self): self.logger = logging.getLogger("log") + def load_image(self, image): self.image = Image.open(image) self.pixels = self.image.load() self.result_captcha = '' + def unload(self): """delete all tmp images""" pass + def threshold(self, value): self.image = self.image.point(lambda a: a * value + 10) + def run(self, command): """Run a command""" @@ -47,28 +52,32 @@ class OCR(object): popen.stderr.close() self.logger.debug("Tesseract ReturnCode %s Output: %s" % (popen.returncode, output)) + def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True): - #self.logger.debug("create tmp tif") - #tmp = tempfile.NamedTemporaryFile(suffix=".tif") - tmp = open(join("tmp", "tmpTif_%s.tif" % self.__name__), "wb") - tmp.close() - #self.logger.debug("create tmp txt") - #tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") - tmpTxt = open(join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb") - tmpTxt.close() + #tmpTif = tempfile.NamedTemporaryFile(suffix=".tif") + try: + tmpTif = open(join("tmp", "tmpTif_%s.tif" % self.__name__), "wb") + tmpTif.close() + + #tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") + tmpTxt = open(join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb") + tmpTxt.close() + + except IOError, e: + self.logError(e) + return self.logger.debug("save tiff") - self.image.save(tmp.name, 'TIFF') + self.image.save(tmpTif.name, 'TIFF') if os.name == "nt": tessparams = [join(pypath, "tesseract", "tesseract.exe")] else: tessparams = ['tesseract'] - tessparams.extend([abspath(tmp.name), abspath(tmpTxt.name).replace(".txt", "")]) + tessparams.extend([abspath(tmpTif.name), abspath(tmpTxt.name).replace(".txt", "")] ) if subset and (digits or lowercase or uppercase): - #self.logger.debug("create temp subset config") #tmpSub = tempfile.NamedTemporaryFile(suffix=".subset") tmpSub = open(join("tmp", "tmpSub_%s.subset" % self.__name__), "wb") tmpSub.write("tessedit_char_whitelist ") @@ -95,22 +104,25 @@ class OCR(object): self.logger.debug(self.result_captcha) try: - os.remove(tmp.name) + os.remove(tmpTif.name) os.remove(tmpTxt.name) if subset and (digits or lowercase or uppercase): os.remove(tmpSub.name) except: pass + def get_captcha(self, name): raise NotImplementedError + def to_greyscale(self): if self.image.mode != 'L': self.image = self.image.convert('L') self.pixels = self.image.load() + def eval_black_white(self, limit): self.pixels = self.image.load() w, h = self.image.size @@ -121,6 +133,7 @@ class OCR(object): else: self.pixels[x, y] = 0 + def clean(self, allowed): pixels = self.pixels @@ -166,6 +179,7 @@ class OCR(object): self.pixels = pixels + def derotate_by_average(self): """rotate by checking each angle and guess most suitable""" @@ -239,6 +253,7 @@ class OCR(object): self.pixels = pixels + def split_captcha_letters(self): captcha = self.image started = False @@ -278,6 +293,7 @@ class OCR(object): return letters + def correct(self, values, var=None): if var: result = var diff --git a/pyload/plugins/container/CCF.py b/pyload/plugins/container/CCF.py index fe43bda7c..b21339bec 100644 --- a/pyload/plugins/container/CCF.py +++ b/pyload/plugins/container/CCF.py @@ -13,17 +13,17 @@ from pyload.utils import safe_join class CCF(Container): - __name__ = "CCF" + __name__ = "CCF" __version__ = "0.2" __pattern__ = r'.+\.ccf' __description__ = """CCF container decrypter plugin""" - __authors__ = [("Willnix", "Willnix@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("Willnix", "Willnix@pyload.org")] def decrypt(self, pyfile): - infile = pyfile.url.replace("\n", "") opener = build_opener(MultipartPostHandler) @@ -36,7 +36,7 @@ class CCF(Container): tempdlc_name = safe_join(download_folder, "tmp_%s.dlc" % pyfile.name) tempdlc = open(tempdlc_name, "w") - tempdlc.write(re.search(r'<dlc>(.*)</dlc>', tempdlc_content, re.DOTALL).group(1)) + tempdlc.write(re.search(r'<dlc>(.*)</dlc>', tempdlc_content, re.S).group(1)) tempdlc.close() self.urls = [tempdlc_name] diff --git a/pyload/plugins/container/DLC_25.pyc b/pyload/plugins/container/DLC_25.pyc Binary files differindex b8fde0051..409264902 100644 --- a/pyload/plugins/container/DLC_25.pyc +++ b/pyload/plugins/container/DLC_25.pyc diff --git a/pyload/plugins/container/DLC_26.pyc b/pyload/plugins/container/DLC_26.pyc Binary files differindex 41a4e0cb8..685995fc2 100644 --- a/pyload/plugins/container/DLC_26.pyc +++ b/pyload/plugins/container/DLC_26.pyc diff --git a/pyload/plugins/container/DLC_27.pyc b/pyload/plugins/container/DLC_27.pyc Binary files differindex a6bffaf74..6c6d663e5 100644 --- a/pyload/plugins/container/DLC_27.pyc +++ b/pyload/plugins/container/DLC_27.pyc diff --git a/pyload/plugins/container/LinkList.py b/pyload/plugins/container/LinkList.py index a4de13f2d..621574ab1 100644 --- a/pyload/plugins/container/LinkList.py +++ b/pyload/plugins/container/LinkList.py @@ -7,7 +7,7 @@ from pyload.utils import fs_encode class LinkList(Container): - __name__ = "LinkList" + __name__ = "LinkList" __version__ = "0.12" __pattern__ = r'.+\.txt' @@ -15,8 +15,9 @@ class LinkList(Container): ("encoding", "string", "File encoding (default utf-8)", "")] __description__ = """Read link lists in txt format""" - __authors__ = [("spoob", "spoob@pyload.org"), - ("jeix", "jeix@hasnomail.com")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org"), + ("jeix", "jeix@hasnomail.com")] def decrypt(self, pyfile): @@ -25,9 +26,6 @@ class LinkList(Container): except: file_enc = "utf-8" - print repr(pyfile.url) - print pyfile.url - file_name = fs_encode(pyfile.url) txt = codecs.open(file_name, 'r', file_enc) @@ -67,7 +65,7 @@ class LinkList(Container): txt = open(file_name, 'wb') txt.close() except: - self.logWarning(_("LinkList could not be cleared.")) + self.logWarning(_("LinkList could not be cleared")) for name, links in packages.iteritems(): self.packages.append((name, links, name)) diff --git a/pyload/plugins/container/RSDF.py b/pyload/plugins/container/RSDF.py index 1fe2974a2..14f355e85 100644 --- a/pyload/plugins/container/RSDF.py +++ b/pyload/plugins/container/RSDF.py @@ -5,24 +5,26 @@ import binascii import re from pyload.plugins.base.Container import Container +from module.utils import fs_encode class RSDF(Container): - __name__ = "RSDF" - __version__ = "0.22" + __name__ = "RSDF" + __version__ = "0.23" __pattern__ = r'.+\.rsdf' __description__ = """RSDF container decrypter plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("spoob", "spoob@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("spoob", "spoob@pyload.org")] def decrypt(self, pyfile): from Crypto.Cipher import AES - infile = pyfile.url.replace("\n", "") + infile = fs_encode(pyfile.url.replace("\n", "")) Key = binascii.unhexlify('8C35192D964DC3182C6F84F3252239EB4A320D2500000000') IV = binascii.unhexlify('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF') @@ -31,10 +33,11 @@ class RSDF(Container): obj = AES.new(Key, AES.MODE_CFB, IV) - rsdf = open(infile, 'r') - - data = rsdf.read() - rsdf.close() + try: + with open(infile, 'r') as rsdf: + data = rsdf.read() + except IOError, e: + self.fail(str(e)) if re.search(r"<title>404 - Not Found</title>", data) is None: data = binascii.unhexlify(''.join(data.split())) @@ -48,4 +51,4 @@ class RSDF(Container): decryptedUrl = link.replace('CCF: ', '') self.urls.append(decryptedUrl) - self.log.debug("%s: adding package %s with %d links" % (self.__name__,pyfile.package().name,len(links))) + self.logDebug("Adding package %s with %d links" % (pyfile.package().name, len(self.urls))) diff --git a/pyload/plugins/crypter/BitshareComFolder.py b/pyload/plugins/crypter/BitshareComFolder.py index 6cdb43339..4dbeafdb3 100644 --- a/pyload/plugins/crypter/BitshareComFolder.py +++ b/pyload/plugins/crypter/BitshareComFolder.py @@ -4,15 +4,18 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class BitshareComFolder(SimpleCrypter): - __name__ = "BitshareComFolder" - __type__ = "crypter" - __version__ = "0.02" + __name__ = "BitshareComFolder" + __type__ = "crypter" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?bitshare\.com/\?d=\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Bitshare.com folder decrypter plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] - LINK_PATTERN = r'<a href="(http://bitshare.com/files/.+)">.+</a></td>' - TITLE_PATTERN = r'View public folder "(.+)"</h1>' + LINK_PATTERN = r'<a href="(http://bitshare\.com/files/.+)">.+</a></td>' + NAME_PATTERN = r'View public folder "(?P<N>.+)"</h1>' diff --git a/pyload/plugins/crypter/C1neonCom.py b/pyload/plugins/crypter/C1neonCom.py index bb5b48cc2..91a22ea39 100644 --- a/pyload/plugins/crypter/C1neonCom.py +++ b/pyload/plugins/crypter/C1neonCom.py @@ -4,11 +4,13 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class C1neonCom(DeadCrypter): - __name__ = "C1neonCom" - __type__ = "crypter" + __name__ = "C1neonCom" + __type__ = "crypter" __version__ = "0.05" - __pattern__ = r'http://(?:www\.)?c1neon.com/.*?' + __pattern__ = r'http://(?:www\.)?c1neon\.com/.*?' + __config__ = [] __description__ = """C1neon.com decrypter plugin""" - __authors__ = [("godofdream", "soilfiction@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("godofdream", "soilfiction@gmail.com")] diff --git a/pyload/plugins/crypter/ChipDe.py b/pyload/plugins/crypter/ChipDe.py index 7740e8e09..97a39f6d2 100644 --- a/pyload/plugins/crypter/ChipDe.py +++ b/pyload/plugins/crypter/ChipDe.py @@ -5,22 +5,25 @@ from pyload.plugins.base.Crypter import Crypter class ChipDe(Crypter): - __name__ = "ChipDe" - __type__ = "crypter" + __name__ = "ChipDe" + __type__ = "crypter" __version__ = "0.1" - __pattern__ = r'http://(?:www\.)?chip.de/video/.*\.html' + __pattern__ = r'http://(?:www\.)?chip\.de/video/.*\.html' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Chip.de decrypter plugin""" - __authors__ = [("4Christopher", "4Christopher@gmx.de")] + __license__ = "GPLv3" + __authors__ = [("4Christopher", "4Christopher@gmx.de")] def decrypt(self, pyfile): self.html = self.load(pyfile.url) try: - f = re.search(r'"(http://video.chip.de/\d+?/.*)"', self.html) + f = re.search(r'"(http://video\.chip\.de/.+)"', self.html) except: - self.fail('Failed to find the URL') + self.fail(_("Failed to find the URL")) else: self.urls = [f.group(1)] self.logDebug("The file URL is %s" % self.urls[0]) diff --git a/pyload/plugins/crypter/CrockoComFolder.py b/pyload/plugins/crypter/CrockoComFolder.py index 9fc8d2d30..7c96161a5 100644 --- a/pyload/plugins/crypter/CrockoComFolder.py +++ b/pyload/plugins/crypter/CrockoComFolder.py @@ -4,14 +4,17 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class CrockoComFolder(SimpleCrypter): - __name__ = "CrockoComFolder" - __type__ = "crypter" + __name__ = "CrockoComFolder" + __type__ = "crypter" __version__ = "0.01" - __pattern__ = r'http://(?:www\.)?crocko.com/f/.*' + __pattern__ = r'http://(?:www\.)?crocko\.com/f/.*' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Crocko.com folder decrypter plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] LINK_PATTERN = r'<td class="last"><a href="([^"]+)">download</a>' diff --git a/pyload/plugins/crypter/CryptItCom.py b/pyload/plugins/crypter/CryptItCom.py index 99f8b1730..9ca6f2bc3 100644 --- a/pyload/plugins/crypter/CryptItCom.py +++ b/pyload/plugins/crypter/CryptItCom.py @@ -4,11 +4,13 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class CryptItCom(DeadCrypter): - __name__ = "CryptItCom" - __type__ = "crypter" + __name__ = "CryptItCom" + __type__ = "crypter" __version__ = "0.11" - __pattern__ = r'http://(?:www\.)?crypt-it\.com/(s|e|d|c)/[\w]+' + __pattern__ = r'http://(?:www\.)?crypt-it\.com/(s|e|d|c)/\w+' + __config__ = [] __description__ = """Crypt-it.com decrypter plugin""" - __authors__ = [("jeix", "jeix@hasnomail.de")] + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de")] diff --git a/pyload/plugins/crypter/CzshareComFolder.py b/pyload/plugins/crypter/CzshareComFolder.py index ac47aa17e..23c17e64a 100644 --- a/pyload/plugins/crypter/CzshareComFolder.py +++ b/pyload/plugins/crypter/CzshareComFolder.py @@ -5,14 +5,17 @@ from pyload.plugins.base.Crypter import Crypter class CzshareComFolder(Crypter): - __name__ = "CzshareComFolder" - __type__ = "crypter" + __name__ = "CzshareComFolder" + __type__ = "crypter" __version__ = "0.2" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/folders/.*' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Czshare.com folder decrypter plugin, now Sdilej.cz""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] FOLDER_PATTERN = r'<tr class="subdirectory">\s*<td>\s*<table>(.*?)</table>' @@ -22,10 +25,8 @@ class CzshareComFolder(Crypter): def decrypt(self, pyfile): html = self.load(pyfile.url) - m = re.search(self.FOLDER_PATTERN, html, re.DOTALL) + m = re.search(self.FOLDER_PATTERN, html, re.S) if m is None: - self.fail("Parse error (FOLDER)") + self.error(_("FOLDER_PATTERN not found")) self.urls.extend(re.findall(self.LINK_PATTERN, m.group(1))) - if not self.urls: - self.fail('Could not extract any links') diff --git a/pyload/plugins/crypter/DDLMusicOrg.py b/pyload/plugins/crypter/DDLMusicOrg.py index c4dbe0186..ff2faef2c 100644 --- a/pyload/plugins/crypter/DDLMusicOrg.py +++ b/pyload/plugins/crypter/DDLMusicOrg.py @@ -8,26 +8,30 @@ from pyload.plugins.base.Crypter import Crypter class DDLMusicOrg(Crypter): - __name__ = "DDLMusicOrg" - __type__ = "crypter" + __name__ = "DDLMusicOrg" + __type__ = "crypter" __version__ = "0.3" __pattern__ = r'http://(?:www\.)?ddl-music\.org/captcha/ddlm_cr\d\.php\?\d+\?\d+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Ddl-music.org decrypter plugin""" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] def setup(self): self.multiDL = False + def decrypt(self, pyfile): html = self.load(pyfile.url, cookies=True) if re.search(r"Wer dies nicht rechnen kann", html) is not None: self.offline() - math = re.search(r"(\d+) ([\+-]) (\d+) =\s+<inp", self.html) + math = re.search(r"(\d+) ([+-]) (\d+) =\s+<inp", self.html) id = re.search(r"name=\"id\" value=\"(\d+)\"", self.html).group(1) linknr = re.search(r"name=\"linknr\" value=\"(\d+)\"", self.html).group(1) diff --git a/pyload/plugins/crypter/DailymotionBatch.py b/pyload/plugins/crypter/DailymotionBatch.py index 41bec2203..fd43cd49a 100644 --- a/pyload/plugins/crypter/DailymotionBatch.py +++ b/pyload/plugins/crypter/DailymotionBatch.py @@ -10,14 +10,17 @@ from pyload.utils import safe_join class DailymotionBatch(Crypter): - __name__ = "DailymotionBatch" - __type__ = "crypter" + __name__ = "DailymotionBatch" + __type__ = "crypter" __version__ = "0.01" __pattern__ = r'https?://(?:www\.)?dailymotion\.com/((playlists/)?(?P<TYPE>playlist|user)/)?(?P<ID>[\w^_]+)(?(TYPE)|#)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Dailymotion.com channel & playlist decrypter""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] def api_response(self, ref, req=None): @@ -25,6 +28,7 @@ class DailymotionBatch(Crypter): page = self.load(url, get=req) return json_loads(page) + def getPlaylistInfo(self, id): ref = "playlist/" + id req = {"fields": "name,owner.screenname"} @@ -37,6 +41,7 @@ class DailymotionBatch(Crypter): owner = playlist['owner.screenname'] return name, owner + def _getPlaylists(self, user_id, page=1): ref = "user/%s/playlists" % user_id req = {"fields": "id", "page": page, "limit": 100} @@ -52,9 +57,11 @@ class DailymotionBatch(Crypter): for item in self._getPlaylists(user_id, page + 1): yield item + def getPlaylists(self, user_id): return [(id,) + self.getPlaylistInfo(id) for id in self._getPlaylists(user_id)] + def _getVideos(self, id, page=1): ref = "playlist/%s/videos" % id req = {"fields": "url", "page": page, "limit": 100} @@ -70,9 +77,11 @@ class DailymotionBatch(Crypter): for item in self._getVideos(id, page + 1): yield item + def getVideos(self, playlist_id): return list(self._getVideos(playlist_id))[::-1] + def decrypt(self, pyfile): m = re.match(self.__pattern__, pyfile.url) m_id = m.group("ID") @@ -88,7 +97,7 @@ class DailymotionBatch(Crypter): self.logDebug("%s playlist\s found on channel \"%s\"" % (len(playlists), m_id)) if not playlists: - self.fail("No playlist available") + self.fail(_("No playlist available")) for p_id, p_name, p_owner in playlists: p_videos = self.getVideos(p_id) diff --git a/pyload/plugins/crypter/DataHuFolder.py b/pyload/plugins/crypter/DataHuFolder.py index 29f38c3b7..b65c39904 100644 --- a/pyload/plugins/crypter/DataHuFolder.py +++ b/pyload/plugins/crypter/DataHuFolder.py @@ -6,39 +6,35 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class DataHuFolder(SimpleCrypter): - __name__ = "DataHuFolder" - __type__ = "crypter" - __version__ = "0.04" + __name__ = "DataHuFolder" + __type__ = "crypter" + __version__ = "0.06" - __pattern__ = r'http://(?:www\.)?data.hu/dir/\w+' + __pattern__ = r'http://(?:www\.)?data\.hu/dir/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Data.hu folder decrypter plugin""" - __authors__ = [("crash", None), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("crash", None), + ("stickell", "l.stickell@yahoo.it")] - LINK_PATTERN = r"<a href='(http://data\.hu/get/.+)' target='_blank'>\1</a>" - TITLE_PATTERN = ur'<title>(.+) Let\xf6lt\xe9se</title>' + LINK_PATTERN = r'<a href=\'(http://data\.hu/get/.+)\' target=\'_blank\'>\1</a>' + NAME_PATTERN = ur'<title>(?P<N>.+) Let\xf6lt\xe9se</title>' - def decrypt(self, pyfile): - self.html = self.load(pyfile.url, decode=True) + def prepare(self): + super(DataHuFolder, self).prepare() if u'K\xe9rlek add meg a jelsz\xf3t' in self.html: # Password protected password = self.getPassword() - if password is '': - self.fail("No password specified, please set right password on Add package form and retry") - self.logDebug("The folder is password protected', 'Using password: " + password) - self.html = self.load(pyfile.url, post={'mappa_pass': password}, decode=True) - if u'Hib\xe1s jelsz\xf3' in self.html: # Wrong password - self.fail("Incorrect password, please set right password on Add package form and retry") + if not password: + self.fail(_("Password required")) - package_name, folder_name = self.getPackageNameAndFolder() + self.logDebug("The folder is password protected', 'Using password: " + password) - package_links = re.findall(self.LINK_PATTERN, self.html) - self.logDebug("Package has %d links" % len(package_links)) + self.html = self.load(self.pyfile.url, post={'mappa_pass': password}, decode=True) - if package_links: - self.packages = [(package_name, package_links, folder_name)] - else: - self.fail('Could not extract any links') + if u'Hib\xe1s jelsz\xf3' in self.html: # Wrong password + self.fail(_("Wrong password")) diff --git a/pyload/plugins/crypter/DdlstorageComFolder.py b/pyload/plugins/crypter/DdlstorageComFolder.py index c7e2538ff..9851f92c1 100644 --- a/pyload/plugins/crypter/DdlstorageComFolder.py +++ b/pyload/plugins/crypter/DdlstorageComFolder.py @@ -4,15 +4,17 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo class DdlstorageComFolder(DeadCrypter): - __name__ = "DdlstorageComFolder" - __type__ = "crypter" + __name__ = "DdlstorageComFolder" + __type__ = "crypter" __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?ddlstorage\.com/folder/\w+' + __config__ = [] __description__ = """DDLStorage.com folder decrypter plugin""" - __authors__ = [("godofdream", "soilfiction@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("godofdream", "soilfiction@gmail.com"), + ("stickell", "l.stickell@yahoo.it")] getInfo = create_getInfo(SpeedLoadOrg) diff --git a/pyload/plugins/crypter/DepositfilesComFolder.py b/pyload/plugins/crypter/DepositfilesComFolder.py index db87f1c45..65d73afa8 100644 --- a/pyload/plugins/crypter/DepositfilesComFolder.py +++ b/pyload/plugins/crypter/DepositfilesComFolder.py @@ -4,14 +4,17 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class DepositfilesComFolder(SimpleCrypter): - __name__ = "DepositfilesComFolder" - __type__ = "crypter" + __name__ = "DepositfilesComFolder" + __type__ = "crypter" __version__ = "0.01" - __pattern__ = r'http://(?:www\.)?depositfiles.com/folders/\w+' + __pattern__ = r'http://(?:www\.)?depositfiles\.com/folders/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Depositfiles.com folder decrypter plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] LINK_PATTERN = r'<div class="progressName"[^>]*>\s*<a href="([^"]+)" title="[^"]*" target="_blank">' diff --git a/pyload/plugins/crypter/Dereferer.py b/pyload/plugins/crypter/Dereferer.py index 78ad300bb..41da3dc1e 100644 --- a/pyload/plugins/crypter/Dereferer.py +++ b/pyload/plugins/crypter/Dereferer.py @@ -8,14 +8,17 @@ from pyload.plugins.base.Crypter import Crypter class Dereferer(Crypter): - __name__ = "Dereferer" - __type__ = "crypter" + __name__ = "Dereferer" + __type__ = "crypter" __version__ = "0.1" __pattern__ = r'https?://([^/]+)/.*?(?P<url>(ht|f)tps?(://|%3A%2F%2F).*)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Crypter for dereferers""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def decrypt(self, pyfile): diff --git a/pyload/plugins/crypter/DlProtectCom.py b/pyload/plugins/crypter/DlProtectCom.py index a53a46992..4f96a1d13 100644 --- a/pyload/plugins/crypter/DlProtectCom.py +++ b/pyload/plugins/crypter/DlProtectCom.py @@ -9,14 +9,17 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class DlProtectCom(SimpleCrypter): - __name__ = "DlProtectCom" - __type__ = "crypter" + __name__ = "DlProtectCom" + __type__ = "crypter" __version__ = "0.01" __pattern__ = r'http://(?:www\.)?dl-protect\.com/((en|fr)/)?(?P<ID>\w+)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Dl-protect.com decrypter plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] OFFLINE_PATTERN = r'>Unfortunately, the link you are looking for is not found' @@ -56,7 +59,7 @@ class DlProtectCom(SimpleCrypter): for errmsg in (">The password is incorrect", ">The security code is incorrect"): if errmsg in self.html: - self.fail(errmsg[1:]) + self.fail(_(errmsg[1:])) pattern = r'<a href="([^/].+?)" target="_blank">' return re.findall(pattern, self.html) diff --git a/pyload/plugins/crypter/DontKnowMe.py b/pyload/plugins/crypter/DontKnowMe.py index 4abc03bcd..53a1b3997 100644 --- a/pyload/plugins/crypter/DontKnowMe.py +++ b/pyload/plugins/crypter/DontKnowMe.py @@ -8,17 +8,20 @@ from pyload.plugins.base.Crypter import Crypter class DontKnowMe(Crypter): - __name__ = "DontKnowMe" - __type__ = "crypter" + __name__ = "DontKnowMe" + __type__ = "crypter" __version__ = "0.1" - __pattern__ = r'http://(?:www\.)?dontknow.me/at/\?.+$' + __pattern__ = r'http://(?:www\.)?dontknow\.me/at/\?.+$' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """DontKnow.me decrypter plugin""" - __authors__ = [("selaux", None)] + __license__ = "GPLv3" + __authors__ = [("selaux", None)] - LINK_PATTERN = r'http://dontknow.me/at/\?(.+)$' + LINK_PATTERN = r'http://dontknow\.me/at/\?(.+)$' def decrypt(self, pyfile): diff --git a/pyload/plugins/crypter/DuckCryptInfo.py b/pyload/plugins/crypter/DuckCryptInfo.py index fc917929a..6873fd5d3 100644 --- a/pyload/plugins/crypter/DuckCryptInfo.py +++ b/pyload/plugins/crypter/DuckCryptInfo.py @@ -8,14 +8,17 @@ from pyload.plugins.base.Crypter import Crypter class DuckCryptInfo(Crypter): - __name__ = "DuckCryptInfo" - __type__ = "crypter" + __name__ = "DuckCryptInfo" + __type__ = "crypter" __version__ = "0.02" - __pattern__ = r'http://(?:www\.)?duckcrypt.info/(folder|wait|link)/(\w+)/?(\w*)' + __pattern__ = r'http://(?:www\.)?duckcrypt\.info/(folder|wait|link)/(\w+)/?(\w*)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """DuckCrypt.info decrypter plugin""" - __authors__ = [("godofdream", "soilfiction@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("godofdream", "soilfiction@gmail.com")] TIMER_PATTERN = r'<span id="timer">(.*)</span>' @@ -26,29 +29,31 @@ class DuckCryptInfo(Crypter): m = re.match(self.__pattern__, url) if m is None: - self.fail('Weird error in link') + self.fail(_("Weird error in link")) if str(m.group(1)) == "link": self.handleLink(url) else: self.handleFolder(m) + def handleFolder(self, m): - src = self.load("http://duckcrypt.info/ajax/auth.php?hash=" + str(m.group(2))) - m = re.match(self.__pattern__, src) + html = self.load("http://duckcrypt.info/ajax/auth.php?hash=" + str(m.group(2))) + m = re.match(self.__pattern__, html) self.logDebug("Redirectet to " + str(m.group(0))) - src = self.load(str(m.group(0))) - soup = BeautifulSoup(src) + html = self.load(str(m.group(0))) + soup = BeautifulSoup(html) cryptlinks = soup.findAll("div", attrs={"class": "folderbox"}) self.logDebug("Redirectet to " + str(cryptlinks)) if not cryptlinks: - self.fail('no links m - (Plugin out of date?)') + self.error(_("No link found")) for clink in cryptlinks: if clink.find("a"): self.handleLink(clink.find("a")['href']) + def handleLink(self, url): - src = self.load(url) - soup = BeautifulSoup(src) + html = self.load(url) + soup = BeautifulSoup(html) self.urls = [soup.find("iframe")['src']] if not self.urls: - self.logDebug("No link found - (Plugin out of date?)") + self.logInfo(_("No link found")) diff --git a/pyload/plugins/crypter/DuploadOrgFolder.py b/pyload/plugins/crypter/DuploadOrgFolder.py index 23f439f68..af83dffd0 100644 --- a/pyload/plugins/crypter/DuploadOrgFolder.py +++ b/pyload/plugins/crypter/DuploadOrgFolder.py @@ -1,17 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.SimpleCrypter import SimpleCrypter +from module.plugins.internal.DeadCrypter import DeadCrypter -class DuploadOrgFolder(SimpleCrypter): - __name__ = "DuploadOrgFolder" - __type__ = "crypter" - __version__ = "0.01" +class DuploadOrgFolder(DeadCrypter): + __name__ = "DuploadOrgFolder" + __type__ = "crypter" + __version__ = "0.02" - __pattern__ = r'http://(?:www\.)?dupload\.org/folder/\d+/' + __pattern__ = r'http://(?:www\.)?dupload\.org/folder/\d+' + __config__ = [] __description__ = """Dupload.org folder decrypter plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - LINK_PATTERN = r'<td style="[^"]+"><a href="(http://[^"]+)" target="_blank">[^<]+</a></td>' + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugins/crypter/EasybytezComFolder.py b/pyload/plugins/crypter/EasybytezComFolder.py index 26ac5a72b..fa3e6165c 100644 --- a/pyload/plugins/crypter/EasybytezComFolder.py +++ b/pyload/plugins/crypter/EasybytezComFolder.py @@ -1,22 +1,22 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.SimpleCrypter import SimpleCrypter +from module.plugins.internal.XFSCrypter import XFSCrypter -class EasybytezComFolder(SimpleCrypter): - __name__ = "EasybytezComFolder" - __type__ = "crypter" - __version__ = "0.08" +class EasybytezComFolder(XFSCrypter): + __name__ = "EasybytezComFolder" + __type__ = "crypter" + __version__ = "0.10" - __pattern__ = r'http://(?:www\.)?easybytez\.com/users/(?P<ID>\d+/\d+)' + __pattern__ = r'http://(?:www\.)?easybytez\.com/users/\d+/\d+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Easybytez.com folder decrypter plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] - URL_REPLACEMENTS = [(__pattern__, r"http://www.easybytez.com/users/\g<ID>?per_page=10000")] - - LINK_PATTERN = r'<td><a href="(http://www\.easybytez\.com/\w+)" target="_blank">.+(?:</a>)?</td>' - TITLE_PATTERN = r'<Title>Files of \d+: (.+) folder</Title>' + HOSTER_DOMAIN = "easybytez.com" LOGIN_ACCOUNT = True diff --git a/pyload/plugins/crypter/EmbeduploadCom.py b/pyload/plugins/crypter/EmbeduploadCom.py index 5d9369d9d..136d99f9e 100644 --- a/pyload/plugins/crypter/EmbeduploadCom.py +++ b/pyload/plugins/crypter/EmbeduploadCom.py @@ -6,16 +6,19 @@ from pyload.network.HTTPRequest import BadHeader class EmbeduploadCom(Crypter): - __name__ = "EmbeduploadCom" - __type__ = "crypter" + __name__ = "EmbeduploadCom" + __type__ = "crypter" __version__ = "0.02" - __pattern__ = r'http://(?:www\.)?embedupload.com/\?d=.*' - __config__ = [("preferedHoster", "str", "Prefered hoster list (bar-separated) ", "embedupload"), - ("ignoredHoster", "str", "Ignored hoster list (bar-separated) ", "")] + __pattern__ = r'http://(?:www\.)?embedupload\.com/\?d=.*' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True), + ("preferedHoster", "str", "Prefered hoster list (bar-separated)", "embedupload"), + ("ignoredHoster", "str", "Ignored hoster list (bar-separated)", "")] __description__ = """EmbedUpload.com decrypter plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] LINK_PATTERN = r'<div id="([^"]+)"[^>]*>\s*<a href="([^"]+)" target="_blank" (?:class="DownloadNow"|style="color:red")>' @@ -29,26 +32,28 @@ class EmbeduploadCom(Crypter): if m: prefered_set = set(self.getConfig("preferedHoster").split('|')) prefered_set = map(lambda s: s.lower().split('.')[0], prefered_set) - print "PF", prefered_set + + self.logDebug("PF: %s" % prefered_set) + tmp_links.extend([x[1] for x in m if x[0] in prefered_set]) self.urls = self.getLocation(tmp_links) if not self.urls: ignored_set = set(self.getConfig("ignoredHoster").split('|')) ignored_set = map(lambda s: s.lower().split('.')[0], ignored_set) - print "IG", ignored_set + + self.logDebug("IG: %s" % ignored_set) + tmp_links.extend([x[1] for x in m if x[0] not in ignored_set]) self.urls = self.getLocation(tmp_links) - if not self.urls: - self.fail('Could not extract any links') def getLocation(self, tmp_links): new_links = [] for link in tmp_links: try: header = self.load(link, just_header=True) - if "location" in header: + if 'location' in header: new_links.append(header['location']) except BadHeader: pass diff --git a/pyload/plugins/crypter/FilebeerInfoFolder.py b/pyload/plugins/crypter/FilebeerInfoFolder.py index 0dbd8dc2e..e361b4e1d 100644 --- a/pyload/plugins/crypter/FilebeerInfoFolder.py +++ b/pyload/plugins/crypter/FilebeerInfoFolder.py @@ -4,11 +4,13 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class FilebeerInfoFolder(DeadCrypter): - __name__ = "FilebeerInfoFolder" - __type__ = "crypter" + __name__ = "FilebeerInfoFolder" + __type__ = "crypter" __version__ = "0.02" __pattern__ = r'http://(?:www\.)?filebeer\.info/(\d+~f).*' + __config__ = [] __description__ = """Filebeer.info folder decrypter plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugins/crypter/FilecloudIoFolder.py b/pyload/plugins/crypter/FilecloudIoFolder.py index feb2ccbc6..c470cef03 100644 --- a/pyload/plugins/crypter/FilecloudIoFolder.py +++ b/pyload/plugins/crypter/FilecloudIoFolder.py @@ -4,15 +4,18 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class FilecloudIoFolder(SimpleCrypter): - __name__ = "FilecloudIoFolder" - __type__ = "crypter" - __version__ = "0.02" + __name__ = "FilecloudIoFolder" + __type__ = "crypter" + __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?(filecloud\.io|ifile\.it)/_\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Filecloud.io folder decrypter plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - LINK_PATTERN = r'href="(http://filecloud.io/\w+)" title' - TITLE_PATTERN = r'>(.+?) - filecloud.io<' + LINK_PATTERN = r'href="(http://filecloud\.io/\w+)" title' + NAME_PATTERN = r'>(?P<N>.+?) - filecloud\.io<' diff --git a/pyload/plugins/crypter/FilefactoryComFolder.py b/pyload/plugins/crypter/FilefactoryComFolder.py index 51b2c4533..8fb3efc72 100644 --- a/pyload/plugins/crypter/FilefactoryComFolder.py +++ b/pyload/plugins/crypter/FilefactoryComFolder.py @@ -4,21 +4,24 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class FilefactoryComFolder(SimpleCrypter): - __name__ = "FilefactoryComFolder" - __type__ = "crypter" - __version__ = "0.3" + __name__ = "FilefactoryComFolder" + __type__ = "crypter" + __version__ = "0.31" __pattern__ = r'https?://(?:www\.)?filefactory\.com/(?:f|folder)/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Filefactory.com folder decrypter plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] LINK_PATTERN = r'<td><a href="([^"]+)">' - TITLE_PATTERN = r'<h1>Files in <span>(.+)</span></h1>' + NAME_PATTERN = r'<h1>Files in <span>(?P<N>.+)</span></h1>' PAGES_PATTERN = r'data-paginator-totalPages="(\d+)"' - COOKIES = [('.filefactory.com', 'locale', 'en_US.utf8')] + COOKIES = [(".filefactory.com", "locale", "en_US.utf8")] def loadPage(self, page_n): diff --git a/pyload/plugins/crypter/FilerNetFolder.py b/pyload/plugins/crypter/FilerNetFolder.py index d1c93a5c2..5e43fda91 100644 --- a/pyload/plugins/crypter/FilerNetFolder.py +++ b/pyload/plugins/crypter/FilerNetFolder.py @@ -4,19 +4,22 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class FilerNetFolder(SimpleCrypter): - __name__ = "FilerNetFolder" - __type__ = "crypter" - __version__ = "0.4" + __name__ = "FilerNetFolder" + __type__ = "crypter" + __version__ = "0.41" __pattern__ = r'https?://filer\.net/folder/\w{16}' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Filer.net decrypter plugin""" - __authors__ = [("nath_schwarz", "nathan.notwhite@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("nath_schwarz", "nathan.notwhite@gmail.com"), + ("stickell", "l.stickell@yahoo.it")] LINK_PATTERN = r'href="(/get/\w{16})">(?!<)' - TITLE_PATTERN = r'<h3>(.+?) - <small' + NAME_PATTERN = r'<h3>(?P<N>.+?) - <small' def getLinks(self): diff --git a/pyload/plugins/crypter/FileserveComFolder.py b/pyload/plugins/crypter/FileserveComFolder.py index 23aa3a14a..d601e2365 100644 --- a/pyload/plugins/crypter/FileserveComFolder.py +++ b/pyload/plugins/crypter/FileserveComFolder.py @@ -6,14 +6,17 @@ from pyload.plugins.base.Crypter import Crypter class FileserveComFolder(Crypter): - __name__ = "FileserveComFolder" - __type__ = "crypter" + __name__ = "FileserveComFolder" + __type__ = "crypter" __version__ = "0.11" - __pattern__ = r'http://(?:www\.)?fileserve.com/list/\w+' + __pattern__ = r'http://(?:www\.)?fileserve\.com/list/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """FileServe.com folder decrypter plugin""" - __authors__ = [("fionnc", "fionnc@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("fionnc", "fionnc@gmail.com")] FOLDER_PATTERN = r'<table class="file_list">(.*?)</table>' @@ -25,13 +28,11 @@ class FileserveComFolder(Crypter): new_links = [] - folder = re.search(self.FOLDER_PATTERN, html, re.DOTALL) + folder = re.search(self.FOLDER_PATTERN, html, re.S) if folder is None: - self.fail("Parse error (FOLDER)") + self.error(_("FOLDER_PATTERN not found")) new_links.extend(re.findall(self.LINK_PATTERN, folder.group(1))) if new_links: self.urls = [map(lambda s: "http://fileserve.com%s" % s, new_links)] - else: - self.fail('Could not extract any links') diff --git a/pyload/plugins/crypter/FilestubeCom.py b/pyload/plugins/crypter/FilestubeCom.py index 56714f677..5c97bca9e 100644 --- a/pyload/plugins/crypter/FilestubeCom.py +++ b/pyload/plugins/crypter/FilestubeCom.py @@ -4,15 +4,18 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class FilestubeCom(SimpleCrypter): - __name__ = "FilestubeCom" - __type__ = "crypter" - __version__ = "0.04" + __name__ = "FilestubeCom" + __type__ = "crypter" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?filestube\.(?:com|to)/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Filestube.com decrypter plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] LINK_PATTERN = r'<a class=\"file-link-main(?: noref)?\" [^>]* href=\"(http://[^\"]+)' - TITLE_PATTERN = r'<h1\s*> (.+) download\s*</h1>' + NAME_PATTERN = r'<h1\s*> (?P<N>.+) download\s*</h1>' diff --git a/pyload/plugins/crypter/FiletramCom.py b/pyload/plugins/crypter/FiletramCom.py index 53c43b6d2..289642494 100644 --- a/pyload/plugins/crypter/FiletramCom.py +++ b/pyload/plugins/crypter/FiletramCom.py @@ -4,16 +4,19 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class FiletramCom(SimpleCrypter): - __name__ = "FiletramCom" - __type__ = "crypter" - __version__ = "0.02" + __name__ = "FiletramCom" + __type__ = "crypter" + __version__ = "0.03" - __pattern__ = r'http://(?:www\.)?filetram.com/[^/]+/.+' + __pattern__ = r'http://(?:www\.)?filetram\.com/[^/]+/.+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Filetram.com decrypter plugin""" - __authors__ = [("igel", "igelkun@myopera.com"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("igel", "igelkun@myopera.com"), + ("stickell", "l.stickell@yahoo.it")] LINK_PATTERN = r'\s+(http://.+)' - TITLE_PATTERN = r'<title>(.+?) - Free Download' + NAME_PATTERN = r'<title>(?P<N>.+?) - Free Download' diff --git a/pyload/plugins/crypter/FiredriveComFolder.py b/pyload/plugins/crypter/FiredriveComFolder.py index 4fb572ec3..b6b22a4e1 100644 --- a/pyload/plugins/crypter/FiredriveComFolder.py +++ b/pyload/plugins/crypter/FiredriveComFolder.py @@ -1,28 +1,16 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.DeadCrypter import DeadCrypter -from pyload.plugins.internal.SimpleCrypter import SimpleCrypter - -class FiredriveComFolder(SimpleCrypter): - __name__ = "FiredriveComFolder" - __type__ = "crypter" - __version__ = "0.02" +class FiredriveComFolder(DeadCrypter): + __name__ = "FiredriveComFolder" + __type__ = "crypter" + __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?(firedrive|putlocker)\.com/share/.+' + __config__ = [] __description__ = """Firedrive.com folder decrypter plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - LINK_PATTERN = r'<div class="pf_item pf_(file|folder).+?public=\'(.+?)\'' - TITLE_PATTERN = r'>Shared Folder "(.+)" | Firedrive<' - OFFLINE_PATTERN = r'class="sad_face_image"|>No such page here.<' - TEMP_OFFLINE_PATTERN = r'>(File Temporarily Unavailable|Server Error. Try again later)' - - - def getLinks(self): - return map(lambda x: "http://www.firedrive.com/%s/%s" % - ("share" if x[0] == "folder" else "file", x[1]), - re.findall(self.LINK_PATTERN, self.html)) + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/pyload/plugins/crypter/FourChanOrg.py b/pyload/plugins/crypter/FourChanOrg.py index a6b50387f..c418d20b0 100644 --- a/pyload/plugins/crypter/FourChanOrg.py +++ b/pyload/plugins/crypter/FourChanOrg.py @@ -8,14 +8,17 @@ from pyload.plugins.base.Crypter import Crypter class FourChanOrg(Crypter): - __name__ = "FourChanOrg" - __type__ = "crypter" + __name__ = "FourChanOrg" + __type__ = "crypter" __version__ = "0.3" - __pattern__ = r'http://(?:www\.)?boards\.4chan.org/\w+/res/(\d+)' + __pattern__ = r'http://(?:www\.)?boards\.4chan\.org/\w+/res/(\d+)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """4chan.org folder decrypter plugin""" - __authors__ = [] + __license__ = "GPLv3" + __authors__ = [] def decrypt(self, pyfile): diff --git a/pyload/plugins/crypter/FreakhareComFolder.py b/pyload/plugins/crypter/FreakhareComFolder.py index 6cd4e7a7b..f5e31ea42 100644 --- a/pyload/plugins/crypter/FreakhareComFolder.py +++ b/pyload/plugins/crypter/FreakhareComFolder.py @@ -6,18 +6,21 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class FreakhareComFolder(SimpleCrypter): - __name__ = "FreakhareComFolder" - __type__ = "crypter" - __version__ = "0.02" + __name__ = "FreakhareComFolder" + __type__ = "crypter" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?freakshare\.com/folder/.+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Freakhare.com folder decrypter plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] - LINK_PATTERN = r'<a href="(http://freakshare.com/files/[^"]+)" target="_blank">' - TITLE_PATTERN = r'Folder:</b> (.+)' + LINK_PATTERN = r'<a href="(http://freakshare\.com/files/[^"]+)" target="_blank">' + NAME_PATTERN = r'Folder:</b> (?P<N>.+)' PAGES_PATTERN = r'Pages: +(\d+)' diff --git a/pyload/plugins/crypter/FreetexthostCom.py b/pyload/plugins/crypter/FreetexthostCom.py index d8dcc5fd8..13cb33f84 100644 --- a/pyload/plugins/crypter/FreetexthostCom.py +++ b/pyload/plugins/crypter/FreetexthostCom.py @@ -6,19 +6,22 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class FreetexthostCom(SimpleCrypter): - __name__ = "FreetexthostCom" - __type__ = "crypter" + __name__ = "FreetexthostCom" + __type__ = "crypter" __version__ = "0.01" __pattern__ = r'http://(?:www\.)?freetexthost\.com/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Freetexthost.com decrypter plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def getLinks(self): - m = re.search(r'<div id="contentsinner">\s*(.+)<div class="viewcount">', self.html, re.DOTALL) + m = re.search(r'<div id="contentsinner">\s*(.+)<div class="viewcount">', self.html, re.S) if m is None: - self.fail('Unable to extract links | Plugin may be out-of-date') + self.error(_("Unable to extract links")) links = m.group(1) return links.strip().split("<br />\r\n") diff --git a/pyload/plugins/crypter/FshareVnFolder.py b/pyload/plugins/crypter/FshareVnFolder.py index a94071f30..0c0a79495 100644 --- a/pyload/plugins/crypter/FshareVnFolder.py +++ b/pyload/plugins/crypter/FshareVnFolder.py @@ -4,14 +4,17 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class FshareVnFolder(SimpleCrypter): - __name__ = "FshareVnFolder" - __type__ = "crypter" + __name__ = "FshareVnFolder" + __type__ = "crypter" __version__ = "0.01" - __pattern__ = r'http://(?:www\.)?fshare.vn/folder/.*' + __pattern__ = r'http://(?:www\.)?fshare\.vn/folder/.*' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Fshare.vn folder decrypter plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] LINK_PATTERN = r'<li class="w_80pc"><a href="([^"]+)" target="_blank">' diff --git a/pyload/plugins/crypter/GooGl.py b/pyload/plugins/crypter/GooGl.py index 8c3c2c9d8..b3e55688e 100644 --- a/pyload/plugins/crypter/GooGl.py +++ b/pyload/plugins/crypter/GooGl.py @@ -5,14 +5,17 @@ from pyload.utils import json_loads class GooGl(Crypter): - __name__ = "GooGl" - __type__ = "crypter" + __name__ = "GooGl" + __type__ = "crypter" __version__ = "0.01" __pattern__ = r'https?://(?:www\.)?goo\.gl/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Goo.gl decrypter plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] API_URL = "https://www.googleapis.com/urlshortener/v1/url" @@ -26,4 +29,4 @@ class GooGl(Crypter): if 'longUrl' in rep: self.urls = [rep['longUrl']] else: - self.fail('Unable to expand shortened link') + self.fail(_("Unable to expand shortened link")) diff --git a/pyload/plugins/crypter/HoerbuchIn.py b/pyload/plugins/crypter/HoerbuchIn.py index 4c2852567..f8185275a 100644 --- a/pyload/plugins/crypter/HoerbuchIn.py +++ b/pyload/plugins/crypter/HoerbuchIn.py @@ -8,15 +8,18 @@ from pyload.plugins.base.Crypter import Crypter class HoerbuchIn(Crypter): - __name__ = "HoerbuchIn" - __type__ = "crypter" + __name__ = "HoerbuchIn" + __type__ = "crypter" __version__ = "0.6" - __pattern__ = r'http://(?:www\.)?hoerbuch\.in/(wp/horbucher/\d+/.+/|tp/out.php\?.+|protection/folder_\d+\.html)' + __pattern__ = r'http://(?:www\.)?hoerbuch\.in/(wp/horbucher/\d+/.+/|tp/out\.php\?.+|protection/folder_\d+\.html)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Hoerbuch.in decrypter plugin""" - __authors__ = [("spoob", "spoob@pyload.org"), - ("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org"), + ("mkaay", "mkaay@mkaay.de")] article = re.compile("http://(?:www\.)?hoerbuch\.in/wp/horbucher/\d+/.+/") @@ -27,8 +30,8 @@ class HoerbuchIn(Crypter): self.pyfile = pyfile if self.article.match(pyfile.url): - src = self.load(pyfile.url) - soup = BeautifulSoup(src, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) + html = self.load(pyfile.url) + soup = BeautifulSoup(html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) abookname = soup.find("a", attrs={"rel": "bookmark"}).text for a in soup.findAll("a", attrs={"href": self.protection}): @@ -39,18 +42,19 @@ class HoerbuchIn(Crypter): else: self.urls = self.decryptFolder(pyfile.url) + def decryptFolder(self, url): m = self.protection.search(url) if m is None: - self.fail("Bad URL") + self.fail(_("Bad URL")) url = m.group(0) self.pyfile.url = url - src = self.load(url, post={"viewed": "adpg"}) + html = self.load(url, post={"viewed": "adpg"}) links = [] pattern = re.compile("http://www\.hoerbuch\.in/protection/(\w+)/(.*?)\"") - for hoster, lid in pattern.findall(src): + for hoster, lid in pattern.findall(html): self.req.lastURL = url self.load("http://www.hoerbuch.in/protection/%s/%s" % (hoster, lid)) links.append(self.req.lastEffectiveURL) diff --git a/pyload/plugins/crypter/HotfileFolderCom.py b/pyload/plugins/crypter/HotfileFolderCom.py deleted file mode 100644 index 8c9b5a0da..000000000 --- a/pyload/plugins/crypter/HotfileFolderCom.py +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugins.internal.DeadCrypter import DeadCrypter - - -class HotfileFolderCom(DeadCrypter): - __name__ = "HotfileFolderCom" - __type__ = "crypter" - __version__ = "0.3" - - __pattern__ = r'https?://(?:www\.)?hotfile\.com/list/\w+/\w+' - - __description__ = """Hotfile.com folder decrypter plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] diff --git a/pyload/plugins/crypter/ILoadTo.py b/pyload/plugins/crypter/ILoadTo.py index 6f4f98fe4..e04e43a00 100644 --- a/pyload/plugins/crypter/ILoadTo.py +++ b/pyload/plugins/crypter/ILoadTo.py @@ -4,11 +4,13 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class ILoadTo(DeadCrypter): - __name__ = "ILoadTo" - __type__ = "crypter" + __name__ = "ILoadTo" + __type__ = "crypter" __version__ = "0.11" - __pattern__ = r'http://(?:www\.)?iload\.to/go/\d+-[\w\.-]+/' + __pattern__ = r'http://(?:www\.)?iload\.to/go/\d+-[\w.-]+/' + __config__ = [] __description__ = """Iload.to decrypter plugin""" - __authors__ = [("hzpz", None)] + __license__ = "GPLv3" + __authors__ = [("hzpz", None)] diff --git a/pyload/plugins/crypter/ImgurComAlbum.py b/pyload/plugins/crypter/ImgurComAlbum.py index 417a36837..1dc717ca9 100644 --- a/pyload/plugins/crypter/ImgurComAlbum.py +++ b/pyload/plugins/crypter/ImgurComAlbum.py @@ -5,17 +5,20 @@ from pyload.utils import uniqify class ImgurComAlbum(SimpleCrypter): - __name__ = "ImgurComAlbum" - __type__ = "crypter" - __version__ = "0.5" + __name__ = "ImgurComAlbum" + __type__ = "crypter" + __version__ = "0.51" __pattern__ = r'https?://(?:www\.|m\.)?imgur\.com/(a|gallery|)/?\w{5,7}' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Imgur.com decrypter plugin""" - __authors__ = [("nath_schwarz", "nathan.notwhite@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("nath_schwarz", "nathan.notwhite@gmail.com")] - TITLE_PATTERN = r'(.+?) - Imgur' + NAME_PATTERN = r'(?P<N>.+?) - Imgur' LINK_PATTERN = r'i\.imgur\.com/\w{7}s?\.(?:jpeg|jpg|png|gif|apng)' diff --git a/pyload/plugins/crypter/LetitbitNetFolder.py b/pyload/plugins/crypter/LetitbitNetFolder.py index b40e3ed8c..b2e1d7f7b 100644 --- a/pyload/plugins/crypter/LetitbitNetFolder.py +++ b/pyload/plugins/crypter/LetitbitNetFolder.py @@ -5,15 +5,18 @@ from pyload.plugins.base.Crypter import Crypter class LetitbitNetFolder(Crypter): - __name__ = "LetitbitNetFolder" - __type__ = "crypter" + __name__ = "LetitbitNetFolder" + __type__ = "crypter" __version__ = "0.1" - __pattern__ = r'http://(?:www\.)?letitbit.net/folder/\w+' + __pattern__ = r'http://(?:www\.)?letitbit\.net/folder/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Letitbit.net folder decrypter plugin""" - __authors__ = [("DHMH", "webmaster@pcProfil.de"), - ("z00nx", "z00nx0@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("DHMH", "webmaster@pcProfil.de"), + ("z00nx", "z00nx0@gmail.com")] FOLDER_PATTERN = r'<table>(.*)</table>' @@ -23,11 +26,8 @@ class LetitbitNetFolder(Crypter): def decrypt(self, pyfile): html = self.load(pyfile.url) - folder = re.search(self.FOLDER_PATTERN, html, re.DOTALL) + folder = re.search(self.FOLDER_PATTERN, html, re.S) if folder is None: - self.fail("Parse error (FOLDER)") + self.error(_("FOLDER_PATTERN not found")) self.urls.extend(re.findall(self.LINK_PATTERN, folder.group(0))) - - if not self.urls: - self.fail('Could not extract any links') diff --git a/pyload/plugins/crypter/LinkSaveIn.py b/pyload/plugins/crypter/LinkSaveIn.py index ad9468ae6..d6ad6abb7 100644 --- a/pyload/plugins/crypter/LinkSaveIn.py +++ b/pyload/plugins/crypter/LinkSaveIn.py @@ -9,19 +9,22 @@ import re from Crypto.Cipher import AES -from pyload.plugins.internal.SimpleCrypter import SimpleCrypter +from module.plugins.internal.SimpleCrypter import SimpleCrypter from pyload.utils import html_unescape class LinkSaveIn(SimpleCrypter): - __name__ = "LinkSaveIn" - __type__ = "crypter" + __name__ = "LinkSaveIn" + __type__ = "crypter" __version__ = "2.02" - __pattern__ = r'http://(?:www\.)?linksave.in/(?P<id>\w+)$' + __pattern__ = r'http://(?:www\.)?linksave\.in/(?P<id>\w+)$' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """LinkSave.in decrypter plugin""" - __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es")] + __license__ = "GPLv3" + __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es")] COOKIES = [(".linksave.in", "Linksave_Language", "english")] @@ -32,7 +35,6 @@ class LinkSaveIn(SimpleCrypter): def setup(self): - self.html = None self.fileid = None self.captcha = False self.package = None @@ -73,8 +75,6 @@ class LinkSaveIn(SimpleCrypter): # Pack if package_links: self.packages = [(package_name, package_links, folder_name)] - else: - self.fail('Could not extract any links') def isOnline(self): @@ -121,11 +121,10 @@ class LinkSaveIn(SimpleCrypter): def handleErrors(self): if "The visitorpassword you have entered is wrong" in self.html: self.logDebug("Incorrect password, please set right password on 'Edit package' form and retry") - self.fail("Incorrect password, please set right password on 'Edit package' form and retry") + self.fail(_("Incorrect password, please set right password on 'Edit package' form and retry")) if self.captcha: if "Wrong code. Please retry" in self.html: - self.logDebug("Invalid captcha, retrying") self.invalidCaptcha() self.retry() else: @@ -140,7 +139,7 @@ class LinkSaveIn(SimpleCrypter): elif type_ == "web": return self.handleWebLinks() else: - self.fail('unknown source type "%s" (this is probably a bug)' % type_) + self.error('Unknown source type "%s" (this is probably a bug)' % type_) def handleWebLinks(self): @@ -156,18 +155,25 @@ class LinkSaveIn(SimpleCrypter): for i, weblink_id in enumerate(ids): try: webLink = "http://linksave.in/%s" % weblink_id + self.logDebug("Decrypting Web link %d, %s" % (i + 1, webLink)) + fwLink = "http://linksave.in/fw-%s" % weblink_id - response = self.load(fwLink) - jscode = re.findall(r'<script type="text/javascript">(.*)</script>', response)[-1] + res = self.load(fwLink) + + jscode = re.findall(r'<script type="text/javascript">(.*)</script>', res)[-1] jseval = self.js.eval("document = { write: function(e) { return e; } }; %s" % jscode) dlLink = re.search(r'http://linksave\.in/dl-\w+', jseval).group(0) self.logDebug("JsEngine returns value [%s] for redirection link" % dlLink) - response = self.load(dlLink) - link = html_unescape(re.search(r'<iframe src="(.+?)"', response).group(1)) + + res = self.load(dlLink) + link = html_unescape(re.search(r'<iframe src="(.+?)"', res).group(1)) + package_links.append(link) + except Exception, detail: self.logDebug("Error decrypting Web link %s, %s" % (webLink, detail)) + return package_links @@ -176,8 +182,8 @@ class LinkSaveIn(SimpleCrypter): type_ = type_.lower() self.logDebug("Seach for %s Container links" % type_.upper()) if not type_.isalnum(): # check to prevent broken re-pattern (cnl2,rsdf,ccf,dlc,web are all alpha-numeric) - self.fail('unknown container type "%s" (this is probably a bug)' % type_) - pattern = r"\('%s_link'\).href=unescape\('(.*?\.%s)'\)" % (type_, type_) + self.error('Unknown container type "%s" (this is probably a bug)' % type_) + pattern = r'\(\'%s_link\'\).href=unescape\(\'(.*?\.%s)\'\)' % (type_, type_) containersLinks = re.findall(pattern, self.html) self.logDebug("Found %d %s Container links" % (len(containersLinks), type_.upper())) for containerLink in containersLinks: @@ -197,7 +203,7 @@ class LinkSaveIn(SimpleCrypter): for (crypted, jk) in zip(vcrypted, vjk): package_links.extend(self._getLinks(crypted, jk)) except: - self.fail("Unable to decrypt CNL2 links") + self.fail(_("Unable to decrypt CNL2 links")) return package_links diff --git a/pyload/plugins/crypter/LinkdecrypterCom.py b/pyload/plugins/crypter/LinkdecrypterCom.py index 1573bd8c9..9c0d364e6 100644 --- a/pyload/plugins/crypter/LinkdecrypterCom.py +++ b/pyload/plugins/crypter/LinkdecrypterCom.py @@ -5,15 +5,18 @@ from pyload.plugins.base.Crypter import Crypter class LinkdecrypterCom(Crypter): - __name__ = "LinkdecrypterCom" - __type__ = "crypter" + __name__ = "LinkdecrypterCom" + __type__ = "crypter" __version__ = "0.27" - __pattern__ = None + __pattern__ = r'^unmatchable$' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Linkdecrypter.com""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("flowlee", None)] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("flowlee", None)] TEXTAREA_PATTERN = r'<textarea name="links" wrap="off" readonly="1" class="caja_des">(.+)</textarea>' @@ -23,16 +26,13 @@ class LinkdecrypterCom(Crypter): def decrypt(self, pyfile): - self.passwords = self.getPassword().splitlines() # API not working anymore self.urls = self.decryptHTML() - if not self.urls: - self.fail('Could not extract any links') - def decryptAPI(self): + def decryptAPI(self): get_dict = {"t": "link", "url": self.pyfile.url, "lcache": "1"} self.html = self.load('http://linkdecrypter.com/api', get=get_dict) if self.html.startswith('http://'): @@ -46,19 +46,19 @@ class LinkdecrypterCom(Crypter): self.logError("API", self.html) if self.html == 'INTERRUPTION(PASSWORD)': - self.fail("No or incorrect password") + self.fail(_("No or incorrect password")) return None - def decryptHTML(self): + def decryptHTML(self): retries = 5 post_dict = {"link_cache": "on", "pro_links": self.pyfile.url, "modo_links": "text"} self.html = self.load('http://linkdecrypter.com/', post=post_dict, cookies=True, decode=True) while self.passwords or retries: - m = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.DOTALL) + m = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.S) if m: return [x for x in m.group(1).splitlines() if '[LINK-ERROR]' not in x] @@ -69,7 +69,7 @@ class LinkdecrypterCom(Crypter): m = re.search(r"<p><i><b>([^<]+)</b></i></p>", self.html) msg = m.group(1) if m else "" - self.logInfo("Captcha protected link", result_type, msg) + self.logInfo(_("Captcha protected link"), result_type, msg) captcha = self.decryptCaptcha(captcha_url, result_type=result_type) if result_type == "positional": @@ -80,10 +80,10 @@ class LinkdecrypterCom(Crypter): elif self.PASSWORD_PATTERN in self.html: if self.passwords: password = self.passwords.pop(0) - self.logInfo("Password protected link, trying " + password) + self.logInfo(_("Password protected link, trying ") + password) self.html = self.load('http://linkdecrypter.com/', post={'password': password}, decode=True) else: - self.fail("No or incorrect password") + self.fail(_("No or incorrect password")) else: retries -= 1 diff --git a/pyload/plugins/crypter/LixIn.py b/pyload/plugins/crypter/LixIn.py index 2f1331833..6d0494c57 100644 --- a/pyload/plugins/crypter/LixIn.py +++ b/pyload/plugins/crypter/LixIn.py @@ -6,18 +6,21 @@ from pyload.plugins.base.Crypter import Crypter class LixIn(Crypter): - __name__ = "LixIn" - __type__ = "crypter" + __name__ = "LixIn" + __type__ = "crypter" __version__ = "0.22" __pattern__ = r'http://(?:www\.)?lix\.in/(?P<ID>.+)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Lix.in decrypter plugin""" - __authors__ = [("spoob", "spoob@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org")] - CAPTCHA_PATTERN = r'<img src="(?P<image>captcha_img.php\?.*?)"' - SUBMIT_PATTERN = r"value='continue.*?'" + CAPTCHA_PATTERN = r'<img src="(?P<image>captcha_img\.php\?.*?)"' + SUBMIT_PATTERN = r'value=\'continue.*?\'' LINK_PATTERN = r'name="ifram" src="(?P<link>.*?)"' @@ -26,7 +29,7 @@ class LixIn(Crypter): m = re.match(self.__pattern__, url) if m is None: - self.fail("couldn't identify file id") + self.error(_("Unable to identify file ID")) id = m.group("ID") self.logDebug("File id is %s" % id) @@ -35,11 +38,11 @@ class LixIn(Crypter): m = re.search(self.SUBMIT_PATTERN, self.html) if m is None: - self.fail("link doesn't seem valid") + self.error(_("Link doesn't seem valid")) m = re.search(self.CAPTCHA_PATTERN, self.html) if m: - for _ in xrange(5): + for _i in xrange(5): m = re.search(self.CAPTCHA_PATTERN, self.html) if m: self.logDebug("Trying captcha") @@ -53,7 +56,7 @@ class LixIn(Crypter): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.fail("can't find destination url") + self.error(_("Unable to find destination url")) else: self.urls = [m.group("link")] self.logDebug("Found link %s, adding to package" % self.urls[0]) diff --git a/pyload/plugins/crypter/LofCc.py b/pyload/plugins/crypter/LofCc.py index 24950cab4..955ae56d7 100644 --- a/pyload/plugins/crypter/LofCc.py +++ b/pyload/plugins/crypter/LofCc.py @@ -4,11 +4,13 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class LofCc(DeadCrypter): - __name__ = "LofCc" - __type__ = "crypter" + __name__ = "LofCc" + __type__ = "crypter" __version__ = "0.21" - __pattern__ = r'http://(?:www\.)?lof.cc/(.*)' + __pattern__ = r'http://(?:www\.)?lof\.cc/(.*)' + __config__ = [] __description__ = """Lof.cc decrypter plugin""" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] diff --git a/pyload/plugins/crypter/MBLinkInfo.py b/pyload/plugins/crypter/MBLinkInfo.py index 9e63bc05d..98d4c09e6 100644 --- a/pyload/plugins/crypter/MBLinkInfo.py +++ b/pyload/plugins/crypter/MBLinkInfo.py @@ -4,12 +4,14 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class MBLinkInfo(DeadCrypter): - __name__ = "MBLinkInfo" - __type__ = "crypter" + __name__ = "MBLinkInfo" + __type__ = "crypter" __version__ = "0.03" __pattern__ = r'http://(?:www\.)?mblink\.info/?\?id=(\d+)' + __config__ = [] __description__ = """MBLink.info decrypter plugin""" - __authors__ = [("Gummibaer", "Gummibaer@wiki-bierkiste.de"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("Gummibaer", "Gummibaer@wiki-bierkiste.de"), + ("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugins/crypter/MediafireComFolder.py b/pyload/plugins/crypter/MediafireComFolder.py index f5f6389ef..43f87b821 100644 --- a/pyload/plugins/crypter/MediafireComFolder.py +++ b/pyload/plugins/crypter/MediafireComFolder.py @@ -7,18 +7,21 @@ from pyload.utils import json_loads class MediafireComFolder(Crypter): - __name__ = "MediafireComFolder" - __type__ = "crypter" + __name__ = "MediafireComFolder" + __type__ = "crypter" __version__ = "0.14" __pattern__ = r'http://(?:www\.)?mediafire\.com/(folder/|\?sharekey=|\?\w{13}($|[/#]))' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Mediafire.com folder decrypter plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FOLDER_KEY_PATTERN = r"var afI= '(\w+)';" - FILE_URL_PATTERN = r'<meta property="og:url" content="http://www.mediafire.com/\?(\w+)"/>' + FOLDER_KEY_PATTERN = r'var afI= \'(\w+)' + LINK_PATTERN = r'<meta property="og:url" content="http://www\.mediafire\.com/\?(\w+)"/>' def decrypt(self, pyfile): @@ -28,7 +31,7 @@ class MediafireComFolder(Crypter): if result == 0: # load and parse html html = self.load(pyfile.url) - m = re.search(self.FILE_URL_PATTERN, html) + m = re.search(self.LINK_PATTERN, html) if m: # file page self.urls.append("http://www.mediafire.com/file/%s" % m.group(1)) @@ -51,6 +54,3 @@ class MediafireComFolder(Crypter): self.offline() else: self.urls.append(url) - - if not self.urls: - self.fail('Could not extract any links') diff --git a/pyload/plugins/crypter/Movie2kTo.py b/pyload/plugins/crypter/Movie2kTo.py index 80ef4f871..bb00e2eed 100644 --- a/pyload/plugins/crypter/Movie2kTo.py +++ b/pyload/plugins/crypter/Movie2kTo.py @@ -4,11 +4,13 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class Movie2kTo(DeadCrypter): - __name__ = "Movie2kTo" - __type__ = "crypter" + __name__ = "Movie2kTo" + __type__ = "crypter" __version__ = "0.51" __pattern__ = r'http://(?:www\.)?movie2k\.to/(.*)\.html' + __config__ = [] __description__ = """Movie2k.to decrypter plugin""" - __authors__ = [("4Christopher", "4Christopher@gmx.de")] + __license__ = "GPLv3" + __authors__ = [("4Christopher", "4Christopher@gmx.de")] diff --git a/pyload/plugins/crypter/MultiUpOrg.py b/pyload/plugins/crypter/MultiUpOrg.py index 86dbb339f..81e204c72 100644 --- a/pyload/plugins/crypter/MultiUpOrg.py +++ b/pyload/plugins/crypter/MultiUpOrg.py @@ -7,17 +7,20 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class MultiUpOrg(SimpleCrypter): - __name__ = "MultiUpOrg" - __type__ = "crypter" - __version__ = "0.02" + __name__ = "MultiUpOrg" + __type__ = "crypter" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?multiup\.org/(en|fr)/(?P<TYPE>project|download|miror)/\w+(/\w+)?' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """MultiUp.org crypter plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - TITLE_PATTERN = r'<title>.*(?:Project|Projet|ownload|élécharger) (.+?) (?:\(|- )' + NAME_PATTERN = r'<title>.*(?:Project|Projet|ownload|élécharger) (?P<N>.+?) (\(|- )' def getLinks(self): diff --git a/pyload/plugins/crypter/MultiloadCz.py b/pyload/plugins/crypter/MultiloadCz.py index 7dd9dabc6..e233dce99 100644 --- a/pyload/plugins/crypter/MultiloadCz.py +++ b/pyload/plugins/crypter/MultiloadCz.py @@ -5,16 +5,19 @@ from pyload.plugins.base.Crypter import Crypter class MultiloadCz(Crypter): - __name__ = "MultiloadCz" - __type__ = "crypter" + __name__ = "MultiloadCz" + __type__ = "crypter" __version__ = "0.4" - __pattern__ = r'http://(?:[^/]*\.)?multiload.cz/(stahnout|slozka)/.*' - __config__ = [("usedHoster", "str", "Prefered hoster list (bar-separated) ", ""), - ("ignoredHoster", "str", "Ignored hoster list (bar-separated) ", "")] + __pattern__ = r'http://(?:[^/]*\.)?multiload\.cz/(stahnout|slozka)/.*' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True), + ("usedHoster", "str", "Prefered hoster list (bar-separated)", ""), + ("ignoredHoster", "str", "Ignored hoster list (bar-separated)", "")] __description__ = """Multiload.cz decrypter plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] FOLDER_PATTERN = r'<form action="" method="get"><textarea[^>]*>([^>]*)</textarea></form>' @@ -37,6 +40,3 @@ class MultiloadCz(Crypter): if not self.urls: ignored_set = set(self.getConfig("ignoredHoster").split('|')) self.urls.extend([x[1] for x in m if x[0] not in ignored_set]) - - if not self.urls: - self.fail('Could not extract any links') diff --git a/pyload/plugins/crypter/MultiuploadCom.py b/pyload/plugins/crypter/MultiuploadCom.py index ee2bb277a..61295bc85 100644 --- a/pyload/plugins/crypter/MultiuploadCom.py +++ b/pyload/plugins/crypter/MultiuploadCom.py @@ -4,11 +4,12 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class MultiuploadCom(DeadCrypter): - __name__ = "MultiuploadCom" - __type__ = "crypter" + __name__ = "MultiuploadCom" + __type__ = "crypter" __version__ = "0.02" __pattern__ = r'http://(?:www\.)?multiupload\.(com|nl)/\w+' - __description__ = """MultiUpload.com decrypter plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __description__ = """ MultiUpload.com decrypter plugin """ + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugins/crypter/NCryptIn.py b/pyload/plugins/crypter/NCryptIn.py index 287cbb87f..28eb40a63 100644 --- a/pyload/plugins/crypter/NCryptIn.py +++ b/pyload/plugins/crypter/NCryptIn.py @@ -11,15 +11,18 @@ from pyload.plugins.internal.CaptchaService import ReCaptcha class NCryptIn(Crypter): - __name__ = "NCryptIn" - __type__ = "crypter" - __version__ = "1.32" + __name__ = "NCryptIn" + __type__ = "crypter" + __version__ = "1.33" - __pattern__ = r'http://(?:www\.)?ncrypt.in/(?P<type>folder|link|frame)-([^/\?]+)' + __pattern__ = r'http://(?:www\.)?ncrypt\.in/(?P<type>folder|link|frame)-([^/\?]+)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """NCrypt.in decrypter plugin""" - __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es"), + ("stickell", "l.stickell@yahoo.it")] JK_KEY = "jk" @@ -30,11 +33,11 @@ class NCryptIn(Crypter): def setup(self): self.package = None - self.html = None self.cleanedHtml = None self.links_source_order = ["cnl2", "rsdf", "ccf", "dlc", "web"] self.protection_type = None + def decrypt(self, pyfile): # Init self.package = pyfile.package() @@ -72,17 +75,19 @@ class NCryptIn(Crypter): package_links = set(package_links) # Pack and return links - if not package_links: - self.fail('Could not extract any links') - self.packages = [(package_name, package_links, folder_name)] + if package_links: + self.packages = [(package_name, package_links, folder_name)] + def isSingleLink(self): link_type = re.match(self.__pattern__, self.pyfile.url).group('type') return link_type in ("link", "frame") + def requestFolderHome(self): return self.load(self.pyfile.url, decode=True) + def removeHtmlCrap(self, content): patterns = (r'(type="hidden".*?(name=".*?")?.*?value=".*?")', r'display:none;">(.*?)</(div|span)>', @@ -90,18 +95,20 @@ class NCryptIn(Crypter): r'<table class="global">(.*?)</table>', r'<iframe\s+style="display:none(.*?)</iframe>') for pattern in patterns: - rexpr = re.compile(pattern, re.DOTALL) + rexpr = re.compile(pattern, re.S) content = re.sub(rexpr, "", content) return content + def isOnline(self): if "Your folder does not exist" in self.cleanedHtml: self.logDebug("File not m") return False return True + def isProtected(self): - form = re.search(r'<form.*?name.*?protected.*?>(.*?)</form>', self.cleanedHtml, re.DOTALL) + form = re.search(r'<form.*?name.*?protected.*?>(.*?)</form>', self.cleanedHtml, re.S) if form is not None: content = form.group(1) for keyword in ("password", "captcha"): @@ -111,6 +118,7 @@ class NCryptIn(Crypter): return True return False + def getPackageInfo(self): m = re.search(self.NAME_PATTERN, self.html) if m: @@ -122,11 +130,11 @@ class NCryptIn(Crypter): self.logDebug("Package info not m, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) return name, folder - def unlockProtection(self): + def unlockProtection(self): postData = {} - form = re.search(r'<form name="protected"(.*?)</form>', self.cleanedHtml, re.DOTALL).group(1) + form = re.search(r'<form name="protected"(.*?)</form>', self.cleanedHtml, re.S).group(1) # Submit package password if "password" in form: @@ -157,7 +165,7 @@ class NCryptIn(Crypter): self.logDebug("CircleCaptcha protected") captcha_img_url = "http://ncrypt.in/classes/captcha/circlecaptcha.php" coords = self.decryptCaptcha(captcha_img_url, forceUser=True, imgtype="png", result_type='positional') - self.logDebug("Captcha resolved, coords [%s]" % coords) + self.logDebug("Captcha resolved, coords [%s]" % str(coords)) postData['circle.x'] = coords[0] postData['circle.y'] = coords[1] @@ -165,20 +173,21 @@ class NCryptIn(Crypter): postData['submit_protected'] = 'Continue to folder' return self.load(self.pyfile.url, post=postData, decode=True) + def handleErrors(self): if self.protection_type == "password": if "This password is invalid!" in self.cleanedHtml: self.logDebug("Incorrect password, please set right password on 'Edit package' form and retry") - self.fail("Incorrect password, please set right password on 'Edit package' form and retry") + self.fail(_("Incorrect password, please set right password on 'Edit package' form and retry")) if self.protection_type == "captcha": if "The securitycheck was wrong!" in self.cleanedHtml: - self.logDebug("Invalid captcha, retrying") self.invalidCaptcha() self.retry() else: self.correctCaptcha() + def handleLinkSource(self, link_source_type): # Check for JS engine require_js_engine = link_source_type in ("cnl2", "rsdf", "ccf", "dlc") @@ -196,10 +205,10 @@ class NCryptIn(Crypter): elif link_source_type == "web": return self.handleWebLinks() else: - self.fail('unknown source type "%s" (this is probably a bug)' % link_source_type) + self.error('Unknown source type "%s" (this is probably a bug)' % link_source_type) - def handleSingleLink(self): + def handleSingleLink(self): self.logDebug("Handling Single link") package_links = [] @@ -210,8 +219,8 @@ class NCryptIn(Crypter): return package_links - def handleCNL2(self): + def handleCNL2(self): self.logDebug("Handling CNL2 links") package_links = [] @@ -221,16 +230,16 @@ class NCryptIn(Crypter): for (crypted, jk) in zip(vcrypted, vjk): package_links.extend(self._getLinks(crypted, jk)) except: - self.fail("Unable to decrypt CNL2 links") + self.fail(_("Unable to decrypt CNL2 links")) return package_links - def handleContainers(self): + def handleContainers(self): self.logDebug("Handling Container links") package_links = [] - pattern = r"/container/(rsdf|dlc|ccf)/([a-z0-9]+)" + pattern = r'/container/(rsdf|dlc|ccf)/(\w+)' containersLinks = re.findall(pattern, self.html) self.logDebug("Decrypting %d Container links" % len(containersLinks)) for containerLink in containersLinks: @@ -239,10 +248,10 @@ class NCryptIn(Crypter): return package_links - def handleWebLinks(self): + def handleWebLinks(self): self.logDebug("Handling Web links") - pattern = r"(http://ncrypt\.in/link-.*?=)" + pattern = r'(http://ncrypt\.in/link-.*?=)' links = re.findall(pattern, self.html) package_links = [] @@ -255,6 +264,7 @@ class NCryptIn(Crypter): return package_links + def decryptLink(self, link): try: url = link.replace("link-", "frame-") @@ -263,8 +273,8 @@ class NCryptIn(Crypter): except Exception, detail: self.logDebug("Error decrypting link %s, %s" % (link, detail)) - def _getCipherParams(self): + def _getCipherParams(self): pattern = r'<input.*?name="%s".*?value="(.*?)"' # Get jk @@ -279,6 +289,7 @@ class NCryptIn(Crypter): self.logDebug("Detected %d crypted blocks" % len(vcrypted)) return vcrypted, vjk + def _getLinks(self, crypted, jk): # Get key jreturn = self.js.eval("%s f()" % jk) diff --git a/pyload/plugins/crypter/NetfolderIn.py b/pyload/plugins/crypter/NetfolderIn.py index 8bc41ddeb..bba72c047 100644 --- a/pyload/plugins/crypter/NetfolderIn.py +++ b/pyload/plugins/crypter/NetfolderIn.py @@ -6,38 +6,32 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class NetfolderIn(SimpleCrypter): - __name__ = "NetfolderIn" - __type__ = "crypter" - __version__ = "0.7" + __name__ = "NetfolderIn" + __type__ = "crypter" + __version__ = "0.72" - __pattern__ = r'http://(?:www\.)?netfolder.in/((?P<id1>\w+)/\w+|folder.php\?folder_id=(?P<id2>\w+))' + __pattern__ = r'http://(?:www\.)?netfolder\.in/((?P<id1>\w+)/\w+|folder\.php\?folder_id=(?P<id2>\w+))' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """NetFolder.in decrypter plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("fragonib", "fragonib[AT]yahoo[DOT]es")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("fragonib", "fragonib[AT]yahoo[DOT]es")] - TITLE_PATTERN = r'<div class="Text">Inhalt des Ordners <span.*>(.+)</span></div>' + NAME_PATTERN = r'<div class="Text">Inhalt des Ordners <span.*>(?P<N>.+)</span></div>' - def decrypt(self, pyfile): - # Request package - self.html = self.load(pyfile.url) + def prepare(self): + super(NetfolderIn, self).prepare() # Check for password protection if self.isPasswordProtected(): self.html = self.submitPassword() if not self.html: - self.fail("Incorrect password, please set right password on Add package form and retry") + self.fail(_("Incorrect password, please set right password on Add package form and retry")) - # Get package name and folder - (package_name, folder_name) = self.getPackageNameAndFolder() - - # Get package links - package_links = self.getLinks() - - # Set package - self.packages = [(package_name, package_links, folder_name)] def isPasswordProtected(self): if '<input type="password" name="password"' in self.html: @@ -45,6 +39,7 @@ class NetfolderIn(SimpleCrypter): return True return False + def submitPassword(self): # Gather data try: @@ -68,6 +63,7 @@ class NetfolderIn(SimpleCrypter): return html + def getLinks(self): links = re.search(r'name="list" value="(.*?)"', self.html).group(1).split(",") self.logDebug("Package has %d links" % len(links)) diff --git a/pyload/plugins/crypter/NosvideoCom.py b/pyload/plugins/crypter/NosvideoCom.py index b22546636..5bd3b16a0 100644 --- a/pyload/plugins/crypter/NosvideoCom.py +++ b/pyload/plugins/crypter/NosvideoCom.py @@ -4,15 +4,18 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class NosvideoCom(SimpleCrypter): - __name__ = "NosvideoCom" - __type__ = "crypter" - __version__ = "0.02" + __name__ = "NosvideoCom" + __type__ = "crypter" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?nosvideo\.com/\?v=\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Nosvideo.com decrypter plugin""" - __authors__ = [("igel", "igelkun@myopera.com")] + __license__ = "GPLv3" + __authors__ = [("igel", "igelkun@myopera.com")] - LINK_PATTERN = r'href="(http://(?:w{3}\.)?nosupload.com/\?d=\w+)"' - TITLE_PATTERN = r'<[tT]itle>Watch (.+?)<' + LINK_PATTERN = r'href="(http://(?:w{3}\.)?nosupload\.com/\?d=\w+)"' + NAME_PATTERN = r'<[tT]itle>Watch (?P<N>.+?)<' diff --git a/pyload/plugins/crypter/OneKhDe.py b/pyload/plugins/crypter/OneKhDe.py index 84560995e..d980f9bad 100644 --- a/pyload/plugins/crypter/OneKhDe.py +++ b/pyload/plugins/crypter/OneKhDe.py @@ -7,26 +7,30 @@ from pyload.plugins.base.Crypter import Crypter class OneKhDe(Crypter): - __name__ = "OneKhDe" - __type__ = "crypter" + __name__ = "OneKhDe" + __type__ = "crypter" __version__ = "0.1" - __pattern__ = r'http://(?:www\.)?1kh.de/f/' + __pattern__ = r'http://(?:www\.)?1kh\.de/f/' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """1kh.de decrypter plugin""" - __authors__ = [("spoob", "spoob@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org")] def __init__(self, parent): Crypter.__init__(self, parent) self.parent = parent - self.html = None + def file_exists(self): """ returns True or False """ return True + def proceed(self, url, location): url = self.parent.url self.html = self.load(url) diff --git a/pyload/plugins/crypter/OronComFolder.py b/pyload/plugins/crypter/OronComFolder.py index 8991642b6..dad59099f 100644 --- a/pyload/plugins/crypter/OronComFolder.py +++ b/pyload/plugins/crypter/OronComFolder.py @@ -4,11 +4,13 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class OronComFolder(DeadCrypter): - __name__ = "OronComFolder" - __type__ = "crypter" + __name__ = "OronComFolder" + __type__ = "crypter" __version__ = "0.11" - __pattern__ = r'http://(?:www\.)?oron.com/folder/\w+' + __pattern__ = r'http://(?:www\.)?oron\.com/folder/\w+' + __config__ = [] __description__ = """Oron.com folder decrypter plugin""" - __authors__ = [("DHMH", "webmaster@pcProfil.de")] + __license__ = "GPLv3" + __authors__ = [("DHMH", "webmaster@pcProfil.de")] diff --git a/pyload/plugins/crypter/PastebinCom.py b/pyload/plugins/crypter/PastebinCom.py index bb5fd2a42..e47698752 100644 --- a/pyload/plugins/crypter/PastebinCom.py +++ b/pyload/plugins/crypter/PastebinCom.py @@ -4,15 +4,18 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class PastebinCom(SimpleCrypter): - __name__ = "PastebinCom" - __type__ = "crypter" - __version__ = "0.02" + __name__ = "PastebinCom" + __type__ = "crypter" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?pastebin\.com/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Pastebin.com decrypter plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] LINK_PATTERN = r'<div class="de\d+">(https?://[^ <]+)(?:[^<]*)</div>' - TITLE_PATTERN = r'<div class="paste_box_line1" title="([^"]+)">' + NAME_PATTERN = r'<div class="paste_box_line1" title="(?P<N>[^"]+)">' diff --git a/pyload/plugins/crypter/QuickshareCzFolder.py b/pyload/plugins/crypter/QuickshareCzFolder.py index c6f0280a2..7a4a7fb03 100644 --- a/pyload/plugins/crypter/QuickshareCzFolder.py +++ b/pyload/plugins/crypter/QuickshareCzFolder.py @@ -5,27 +5,27 @@ from pyload.plugins.base.Crypter import Crypter class QuickshareCzFolder(Crypter): - __name__ = "QuickshareCzFolder" - __type__ = "crypter" + __name__ = "QuickshareCzFolder" + __type__ = "crypter" __version__ = "0.1" - __pattern__ = r'http://(?:www\.)?quickshare.cz/slozka-\d+.*' + __pattern__ = r'http://(?:www\.)?quickshare\.cz/slozka-\d+.*' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Quickshare.cz folder decrypter plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] FOLDER_PATTERN = r'<textarea[^>]*>(.*?)</textarea>' - LINK_PATTERN = r'(http://www.quickshare.cz/\S+)' + LINK_PATTERN = r'(http://www\.quickshare\.cz/\S+)' def decrypt(self, pyfile): html = self.load(pyfile.url) - m = re.search(self.FOLDER_PATTERN, html, re.DOTALL) + m = re.search(self.FOLDER_PATTERN, html, re.S) if m is None: - self.fail("Parse error (FOLDER)") + self.error(_("FOLDER_PATTERN not found")) self.urls.extend(re.findall(self.LINK_PATTERN, m.group(1))) - - if not self.urls: - self.fail('Could not extract any links') diff --git a/pyload/plugins/crypter/RSLayerCom.py b/pyload/plugins/crypter/RSLayerCom.py index d93593459..70c04a10c 100644 --- a/pyload/plugins/crypter/RSLayerCom.py +++ b/pyload/plugins/crypter/RSLayerCom.py @@ -4,11 +4,13 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class RSLayerCom(DeadCrypter): - __name__ = "RSLayerCom" - __type__ = "crypter" + __name__ = "RSLayerCom" + __type__ = "crypter" __version__ = "0.21" - __pattern__ = r'http://(?:www\.)?rs-layer.com/directory-' + __pattern__ = r'http://(?:www\.)?rs-layer\.com/directory-' + __config__ = [] __description__ = """RS-Layer.com decrypter plugin""" - __authors__ = [("hzpz", None)] + __license__ = "GPLv3" + __authors__ = [("hzpz", None)] diff --git a/pyload/plugins/crypter/RelinkUs.py b/pyload/plugins/crypter/RelinkUs.py index 30d9eba48..8a31d2acd 100644 --- a/pyload/plugins/crypter/RelinkUs.py +++ b/pyload/plugins/crypter/RelinkUs.py @@ -10,38 +10,46 @@ from pyload.plugins.base.Crypter import Crypter class RelinkUs(Crypter): - __name__ = "RelinkUs" - __type__ = "crypter" - __version__ = "3.0" + __name__ = "RelinkUs" + __type__ = "crypter" + __version__ = "3.1" - __pattern__ = r'http://(?:www\.)?relink.us/(f/|((view|go).php\?id=))(?P<id>.+)' + __pattern__ = r'http://(?:www\.)?relink\.us/(f/|((view|go)\.php\?id=))(?P<id>.+)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Relink.us decrypter plugin""" - __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es")] + __license__ = "GPLv3" + __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es"), + ("AndroKev", "neureither.kevin@gmail.com")] - # Constants PREFERRED_LINK_SOURCES = ["cnl2", "dlc", "web"] OFFLINE_TOKEN = r'<title>Tattooside' - PASSWORD_TOKEN = r'container_password\.php' + + PASSWORD_TOKEN = r'container_password.php' PASSWORD_ERROR_ROKEN = r'You have entered an incorrect password' - PASSWORD_SUBMIT_URL = r'http://www\.relink\.us/container_password\.php' - CAPTCHA_TOKEN = r'container_captcha\.php' + PASSWORD_SUBMIT_URL = r'http://www.relink.us/container_password.php' + + CAPTCHA_TOKEN = r'container_captcha.php' CAPTCHA_ERROR_ROKEN = r'You have solved the captcha wrong' - CAPTCHA_IMG_URL = r'http://www\.relink\.us/core/captcha/circlecaptcha\.php' - CAPTCHA_SUBMIT_URL = r'http://www\.relink\.us/container_captcha\.php' - FILE_TITLE_REGEX = r'<th>Title</th><td><i>(.*)</i></td></tr>' + CAPTCHA_IMG_URL = r'http://www.relink.us/core/captcha/circlecaptcha.php' + CAPTCHA_SUBMIT_URL = r'http://www.relink.us/container_captcha.php' + + FILE_TITLE_REGEX = r'<th>Title</th><td>(.*)</td></tr>' FILE_NOTITLE = r'No title' CNL2_FORM_REGEX = r'<form id="cnl_form-(.*?)</form>' CNL2_FORMINPUT_REGEX = r'<input.*?name="%s".*?value="(.*?)"' CNL2_JK_KEY = "jk" CNL2_CRYPTED_KEY = "crypted" + DLC_LINK_REGEX = r'<a href=".*?" class="dlc_button" target="_blank">' - DLC_DOWNLOAD_URL = r'http://www\.relink\.us/download\.php' - WEB_FORWARD_REGEX = r"getFile\('(?P<link>.+)'\)" - WEB_FORWARD_URL = r'http://www\.relink\.us/frame\.php' + DLC_DOWNLOAD_URL = r'http://www.relink.us/download.php' + + WEB_FORWARD_REGEX = r'getFile\(\'(?P<link>.+)\'\)' + WEB_FORWARD_URL = r'http://www.relink.us/frame.php' WEB_LINK_REGEX = r'<iframe name="Container" height="100%" frameborder="no" width="100%" src="(?P<link>.+)"></iframe>' @@ -49,9 +57,9 @@ class RelinkUs(Crypter): self.fileid = None self.package = None self.password = None - self.html = None self.captcha = False + def decrypt(self, pyfile): # Init self.initPackage(pyfile) @@ -87,49 +95,55 @@ class RelinkUs(Crypter): # Pack if package_links: self.packages = [(package_name, package_links, folder_name)] - else: - self.fail('Could not extract any links') + def initPackage(self, pyfile): self.fileid = re.match(self.__pattern__, pyfile.url).group('id') self.package = pyfile.package() self.password = self.getPassword() + def requestPackage(self): self.html = self.load(self.pyfile.url, decode=True) + def isOnline(self): if self.OFFLINE_TOKEN in self.html: self.logDebug("File not found") return False return True + def isPasswordProtected(self): if self.PASSWORD_TOKEN in self.html: self.logDebug("Links are password protected") return True + def isCaptchaProtected(self): if self.CAPTCHA_TOKEN in self.html: self.logDebug("Links are captcha protected") return True return False + def unlockPasswordProtection(self): self.logDebug("Submitting password [%s] for protected links" % self.password) passwd_url = self.PASSWORD_SUBMIT_URL + "?id=%s" % self.fileid passwd_data = {'id': self.fileid, 'password': self.password, 'pw': 'submit'} self.html = self.load(passwd_url, post=passwd_data, decode=True) + def unlockCaptchaProtection(self): self.logDebug("Request user positional captcha resolving") captcha_img_url = self.CAPTCHA_IMG_URL + "?id=%s" % self.fileid coords = self.decryptCaptcha(captcha_img_url, forceUser=True, imgtype="png", result_type='positional') - self.logDebug("Captcha resolved, coords [%s]" % coords) + self.logDebug("Captcha resolved, coords [%s]" % str(coords)) captcha_post_url = self.CAPTCHA_SUBMIT_URL + "?id=%s" % self.fileid captcha_post_data = {'button.x': coords[0], 'button.y': coords[1], 'captcha': 'submit'} self.html = self.load(captcha_post_url, post=captcha_post_data, decode=True) + def getPackageInfo(self): name = folder = None @@ -150,20 +164,21 @@ class RelinkUs(Crypter): # Return package info return name, folder + def handleErrors(self): if self.PASSWORD_ERROR_ROKEN in self.html: msg = "Incorrect password, please set right password on 'Edit package' form and retry" self.logDebug(msg) - self.fail(msg) + self.fail(_(msg)) if self.captcha: if self.CAPTCHA_ERROR_ROKEN in self.html: - self.logDebug("Invalid captcha, retrying") self.invalidCaptcha() self.retry() else: self.correctCaptcha() + def handleLinkSource(self, source): if source == 'cnl2': return self.handleCNL2Links() @@ -172,12 +187,13 @@ class RelinkUs(Crypter): elif source == 'web': return self.handleWEBLinks() else: - self.fail('Unknown source [%s] (this is probably a bug)' % source) + self.error('Unknown source type "%s" (this is probably a bug)' % source) + def handleCNL2Links(self): self.logDebug("Search for CNL2 links") package_links = [] - m = re.search(self.CNL2_FORM_REGEX, self.html, re.DOTALL) + m = re.search(self.CNL2_FORM_REGEX, self.html, re.S) if m is not None: cnl2_form = m.group(1) try: @@ -188,6 +204,7 @@ class RelinkUs(Crypter): self.logDebug("Unable to decrypt CNL2 links") return package_links + def handleDLCLinks(self): self.logDebug("Search for DLC links") package_links = [] @@ -199,14 +216,14 @@ class RelinkUs(Crypter): dlc = self.load(container_url) dlc_filename = self.fileid + ".dlc" dlc_filepath = os.path.join(self.config['general']['download_folder'], dlc_filename) - f = open(dlc_filepath, "wb") - f.write(dlc) - f.close() + with open(dlc_filepath, "wb") as f: + f.write(dlc) package_links.append(dlc_filepath) except: - self.logDebug("Unable to download DLC container") + self.fail("Unable to download DLC container") return package_links + def handleWEBLinks(self): self.logDebug("Search for WEB links") package_links = [] @@ -225,19 +242,21 @@ class RelinkUs(Crypter): self.wait() return package_links + def _getCipherParams(self, cnl2_form): # Get jk jk_re = self.CNL2_FORMINPUT_REGEX % self.CNL2_JK_KEY - vjk = re.findall(jk_re, cnl2_form, re.IGNORECASE) + vjk = re.findall(jk_re, cnl2_form, re.I) # Get crypted crypted_re = self.CNL2_FORMINPUT_REGEX % RelinkUs.CNL2_CRYPTED_KEY - vcrypted = re.findall(crypted_re, cnl2_form, re.IGNORECASE) + vcrypted = re.findall(crypted_re, cnl2_form, re.I) # Log and return self.logDebug("Detected %d crypted blocks" % len(vcrypted)) return vcrypted, vjk + def _getLinks(self, crypted, jk): # Get key jreturn = self.js.eval("%s f()" % jk) diff --git a/pyload/plugins/crypter/SafelinkingNet.py b/pyload/plugins/crypter/SafelinkingNet.py index 12ba3c853..1d8ad7cf6 100644 --- a/pyload/plugins/crypter/SafelinkingNet.py +++ b/pyload/plugins/crypter/SafelinkingNet.py @@ -12,49 +12,48 @@ from pyload.plugins.internal.CaptchaService import SolveMedia class SafelinkingNet(Crypter): - __name__ = "SafelinkingNet" - __type__ = "crypter" - __version__ = "0.1" + __name__ = "SafelinkingNet" + __type__ = "crypter" + __version__ = "0.11" - __pattern__ = r'https?://(?:www\.)?safelinking.net/([pd])/\w+' + __pattern__ = r'https?://(?:www\.)?safelinking\.net/([pd])/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Safelinking.net decrypter plugin""" - __authors__ = [("quareevo", "quareevo@arcor.de")] + __license__ = "GPLv3" + __authors__ = [("quareevo", "quareevo@arcor.de")] - SOLVEMEDIA_PATTERN = "solvemediaApiKey = '([\w\.\-_]+)';" + SOLVEMEDIA_PATTERN = "solvemediaApiKey = '([\w.-]+)';" def decrypt(self, pyfile): url = pyfile.url + if re.match(self.__pattern__, url).group(1) == "d": - self.req.http.c.setopt(FOLLOWLOCATION, 0) - self.load(url) - m = re.search("^Location: (.+)$", self.req.http.header, re.MULTILINE) - if m: - self.urls = [m.group(1)] + + header = self.load(url, just_header=True) + if 'location' in header: + self.urls = [header['location']] else: - self.fail("Couldn't find forwarded Link") + self.error(_("Couldn't find forwarded Link")) else: - password = "" postData = {"post-protect": "1"} - self.html = self.load(url) - if "link-password" in self.html: - password = pyfile.package().password - postData['link-password'] = password + postData['link-password'] = self.getPassword() if "altcaptcha" in self.html: - for _ in xrange(5): + for _i in xrange(5): m = re.search(self.SOLVEMEDIA_PATTERN, self.html) if m: captchaKey = m.group(1) captcha = SolveMedia(self) captchaProvider = "Solvemedia" else: - self.fail("Error parsing captcha") + self.fail(_("Error parsing captcha")) challenge, response = captcha.challenge(captchaKey) postData['adcopy_challenge'] = challenge @@ -62,7 +61,7 @@ class SafelinkingNet(Crypter): self.html = self.load(url, post=postData) if "The password you entered was incorrect" in self.html: - self.fail("Incorrect Password") + self.fail(_("Incorrect Password")) if not "The CAPTCHA code you entered was wrong" in self.html: break diff --git a/pyload/plugins/crypter/SecuredIn.py b/pyload/plugins/crypter/SecuredIn.py index 4416c2e71..21ebff060 100644 --- a/pyload/plugins/crypter/SecuredIn.py +++ b/pyload/plugins/crypter/SecuredIn.py @@ -4,11 +4,13 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class SecuredIn(DeadCrypter): - __name__ = "SecuredIn" - __type__ = "crypter" + __name__ = "SecuredIn" + __type__ = "crypter" __version__ = "0.21" - __pattern__ = r'http://(?:www\.)?secured\.in/download-[\d]+-[\w]{8}\.html' + __pattern__ = r'http://(?:www\.)?secured\.in/download-[\d]+-\w{8}\.html' + __config__ = [] __description__ = """Secured.in decrypter plugin""" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] diff --git a/pyload/plugins/crypter/ShareLinksBiz.py b/pyload/plugins/crypter/ShareLinksBiz.py index 796643e8d..0c646eda8 100644 --- a/pyload/plugins/crypter/ShareLinksBiz.py +++ b/pyload/plugins/crypter/ShareLinksBiz.py @@ -9,23 +9,26 @@ from pyload.plugins.base.Crypter import Crypter class ShareLinksBiz(Crypter): - __name__ = "ShareLinksBiz" - __type__ = "crypter" - __version__ = "1.13" + __name__ = "ShareLinksBiz" + __type__ = "crypter" + __version__ = "1.14" __pattern__ = r'http://(?:www\.)?(share-links|s2l)\.biz/(?P<ID>_?\w+)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Share-Links.biz decrypter plugin""" - __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es")] + __license__ = "GPLv3" + __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es")] def setup(self): self.baseUrl = None self.fileId = None self.package = None - self.html = None self.captcha = False + def decrypt(self, pyfile): # Init self.initFile(pyfile) @@ -60,6 +63,7 @@ class ShareLinksBiz(Crypter): # Pack self.packages = [(package_name, package_links, package_folder)] + def initFile(self, pyfile): url = pyfile.url if 's2l.biz' in url: @@ -68,29 +72,34 @@ class ShareLinksBiz(Crypter): self.fileId = re.match(self.__pattern__, url).group('ID') self.package = pyfile.package() + def isOnline(self): if "No usable content was found" in self.html: self.logDebug("File not found") return False return True + def isPasswordProtected(self): if re.search(r'''<form.*?id="passwordForm".*?>''', self.html): self.logDebug("Links are protected") return True return False + def isCaptchaProtected(self): if '<map id="captchamap"' in self.html: self.logDebug("Links are captcha protected") return True return False + def unblockServer(self): imgs = re.findall(r"(/template/images/.*?\.gif)", self.html) for img in imgs: self.load(self.baseUrl + img) + def unlockPasswordProtection(self): password = self.getPassword() self.logDebug("Submitting password [%s] for protected links" % password) @@ -98,6 +107,7 @@ class ShareLinksBiz(Crypter): url = self.baseUrl + '/' + self.fileId self.html = self.load(url, post=post, decode=True) + def unlockCaptchaProtection(self): # Get captcha map captchaMap = self._getCaptchaMap() @@ -108,19 +118,17 @@ class ShareLinksBiz(Crypter): captchaUrl = self.baseUrl + '/captcha.gif?d=%s&PHPSESSID=%s' % (m.group(1), m.group(2)) self.logDebug("Waiting user for correct position") coords = self.decryptCaptcha(captchaUrl, forceUser=True, imgtype="gif", result_type='positional') - self.logDebug("Captcha resolved, coords [%s]" % coords) + self.logDebug("Captcha resolved, coords [%s]" % str(coords)) # Resolve captcha href = self._resolveCoords(coords, captchaMap) if href is None: - self.logDebug("Invalid captcha resolving, retrying") self.invalidCaptcha() - self.setWait(5, False) - self.wait() - self.retry() + self.retry(wait_time=5) url = self.baseUrl + href self.html = self.load(url, decode=True) + def _getCaptchaMap(self): mapp = {} for m in re.finditer(r'<area shape="rect" coords="(.*?)" href="(.*?)"', self.html): @@ -129,34 +137,34 @@ class ShareLinksBiz(Crypter): mapp[rect] = href return mapp + def _resolveCoords(self, coords, captchaMap): x, y = coords - for rect, href in captchaMap.items(): + for rect, href in captchaMap.iteritems(): x1, y1, x2, y2 = rect if (x >= x1 and x <= x2) and (y >= y1 and y <= y2): return href + def handleErrors(self): if "The inserted password was wrong" in self.html: self.logDebug("Incorrect password, please set right password on 'Edit package' form and retry") - self.fail("Incorrect password, please set right password on 'Edit package' form and retry") + self.fail(_("Incorrect password, please set right password on 'Edit package' form and retry")) if self.captcha: if "Your choice was wrong" in self.html: - self.logDebug("Invalid captcha, retrying") self.invalidCaptcha() - self.setWait(5) - self.wait() - self.retry() + self.retry(wait_time=5) else: self.correctCaptcha() + def getPackageInfo(self): name = folder = None # Extract from web package header title_re = r'<h2><img.*?/>(.*)</h2>' - m = re.search(title_re, self.html, re.DOTALL) + m = re.search(title_re, self.html, re.S) if m is not None: title = m.group(1).strip() if 'unnamed' not in title: @@ -172,38 +180,45 @@ class ShareLinksBiz(Crypter): # Return package info return name, folder + def handleWebLinks(self): package_links = [] self.logDebug("Handling Web links") #@TODO: Gather paginated web links - pattern = r"javascript:_get\('(.*?)', \d+, ''\)" + pattern = r'javascript:_get\(\'(.*?)\', \d+, \'\'\)' ids = re.findall(pattern, self.html) self.logDebug("Decrypting %d Web links" % len(ids)) for i, ID in enumerate(ids): try: self.logDebug("Decrypting Web link %d, [%s]" % (i + 1, ID)) + dwLink = self.baseUrl + "/get/lnk/" + ID - response = self.load(dwLink) - code = re.search(r'frm/(\d+)', response).group(1) + res = self.load(dwLink) + + code = re.search(r'frm/(\d+)', res).group(1) fwLink = self.baseUrl + "/get/frm/" + code - response = self.load(fwLink) - jscode = re.search(r'<script language="javascript">\s*eval\((.*)\)\s*</script>', response, - re.DOTALL).group(1) + res = self.load(fwLink) + + jscode = re.search(r'<script language="javascript">\s*eval\((.*)\)\s*</script>', res, re.S).group(1) jscode = self.js.eval("f = %s" % jscode) jslauncher = "window=''; parent={frames:{Main:{location:{href:''}}},location:''}; %s; parent.frames.Main.location.href" + dlLink = self.js.eval(jslauncher % jscode) + self.logDebug("JsEngine returns value [%s] for redirection link" % dlLink) + package_links.append(dlLink) except Exception, detail: self.logDebug("Error decrypting Web link [%s], %s" % (ID, detail)) return package_links + def handleContainers(self): package_links = [] self.logDebug("Handling Container links") - pattern = r"javascript:_get\('(.*?)', 0, '(rsdf|ccf|dlc)'\)" + pattern = r'javascript:_get\(\'(.*?)\', 0, \'(rsdf|ccf|dlc)\'\)' containersLinks = re.findall(pattern, self.html) self.logDebug("Decrypting %d Container links" % len(containersLinks)) for containerLink in containersLinks: @@ -211,6 +226,7 @@ class ShareLinksBiz(Crypter): package_links.append(link) return package_links + def handleCNL2(self): package_links = [] self.logDebug("Handling CNL2 links") @@ -220,15 +236,16 @@ class ShareLinksBiz(Crypter): (crypted, jk) = self._getCipherParams() package_links.extend(self._getLinks(crypted, jk)) except: - self.fail("Unable to decrypt CNL2 links") + self.fail(_("Unable to decrypt CNL2 links")) return package_links + def _getCipherParams(self): # Request CNL2 - code = re.search(r'ClicknLoad.swf\?code=(.*?)"', self.html).group(1) - url = "%s/get/cnl2/%s" % (self.baseUrl, code) - response = self.load(url) - params = response.split(";;") + code = re.search(r'ClicknLoad.swf\?code=(.*?)"', self.html).group(1) + url = "%s/get/cnl2/%s" % (self.baseUrl, code) + res = self.load(url) + params = res.split(";;") # Get jk strlist = list(base64.standard_b64decode(params[1])) @@ -243,6 +260,7 @@ class ShareLinksBiz(Crypter): # Log and return return crypted, jk + def _getLinks(self, crypted, jk): # Get key jreturn = self.js.eval("%s f()" % jk) diff --git a/pyload/plugins/crypter/ShareRapidComFolder.py b/pyload/plugins/crypter/ShareRapidComFolder.py deleted file mode 100644 index a6f9eb334..000000000 --- a/pyload/plugins/crypter/ShareRapidComFolder.py +++ /dev/null @@ -1,17 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugins.internal.SimpleCrypter import SimpleCrypter - - -class ShareRapidComFolder(SimpleCrypter): - __name__ = "ShareRapidComFolder" - __type__ = "crypter" - __version__ = "0.01" - - __pattern__ = r'http://(?:www\.)?((share(-?rapid\.(biz|com|cz|info|eu|net|org|pl|sk)|-(central|credit|free|net)\.cz|-ms\.net)|(s-?rapid|rapids)\.(cz|sk))|(e-stahuj|mediatack|premium-rapidshare|rapidshare-premium|qiuck)\.cz|kadzet\.com|stahuj-zdarma\.eu|strelci\.net|universal-share\.com)/(slozka/.+)' - - __description__ = """Share-Rapid.com folder decrypter plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - LINK_PATTERN = r'<td class="soubor"[^>]*><a href="([^"]+)">' diff --git a/pyload/plugins/crypter/SpeedLoadOrgFolder.py b/pyload/plugins/crypter/SpeedLoadOrgFolder.py index 39a237953..5b66b7ea6 100644 --- a/pyload/plugins/crypter/SpeedLoadOrgFolder.py +++ b/pyload/plugins/crypter/SpeedLoadOrgFolder.py @@ -4,11 +4,13 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class SpeedLoadOrgFolder(DeadCrypter): - __name__ = "SpeedLoadOrgFolder" - __type__ = "crypter" + __name__ = "SpeedLoadOrgFolder" + __type__ = "crypter" __version__ = "0.3" __pattern__ = r'http://(?:www\.)?speedload\.org/(\d+~f$|folder/\d+/)' + __config__ = [] __description__ = """Speedload decrypter plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugins/crypter/StealthTo.py b/pyload/plugins/crypter/StealthTo.py index ce89a6f35..6177a116a 100644 --- a/pyload/plugins/crypter/StealthTo.py +++ b/pyload/plugins/crypter/StealthTo.py @@ -4,11 +4,13 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class StealthTo(DeadCrypter): - __name__ = "StealthTo" - __type__ = "crypter" + __name__ = "StealthTo" + __type__ = "crypter" __version__ = "0.2" __pattern__ = r'http://(?:www\.)?stealth\.to/folder/.+' + __config__ = [] __description__ = """Stealth.to decrypter plugin""" - __authors__ = [("spoob", "spoob@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org")] diff --git a/pyload/plugins/crypter/TnyCz.py b/pyload/plugins/crypter/TnyCz.py index dc065b8ea..b2a777da2 100644 --- a/pyload/plugins/crypter/TnyCz.py +++ b/pyload/plugins/crypter/TnyCz.py @@ -6,17 +6,20 @@ import re class TnyCz(SimpleCrypter): - __name__ = "TnyCz" - __type__ = "crypter" - __version__ = "0.02" + __name__ = "TnyCz" + __type__ = "crypter" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?tny\.cz/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Tny.cz decrypter plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - TITLE_PATTERN = r'<title>(.+) - .+</title>' + NAME_PATTERN = r'<title>(?P<N>.+) - .+</title>' def getLinks(self): diff --git a/pyload/plugins/crypter/TrailerzoneInfo.py b/pyload/plugins/crypter/TrailerzoneInfo.py index 8cb6a01a2..deee3e23b 100644 --- a/pyload/plugins/crypter/TrailerzoneInfo.py +++ b/pyload/plugins/crypter/TrailerzoneInfo.py @@ -4,11 +4,13 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class TrailerzoneInfo(DeadCrypter): - __name__ = "TrailerzoneInfo" - __type__ = "crypter" + __name__ = "TrailerzoneInfo" + __type__ = "crypter" __version__ = "0.03" - __pattern__ = r'http://(?:www\.)?trailerzone.info/.*?' + __pattern__ = r'http://(?:www\.)?trailerzone\.info/.*?' + __config__ = [] __description__ = """TrailerZone.info decrypter plugin""" - __authors__ = [("godofdream", "soilfiction@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("godofdream", "soilfiction@gmail.com")] diff --git a/pyload/plugins/crypter/TurbobitNetFolder.py b/pyload/plugins/crypter/TurbobitNetFolder.py index b5b611ad6..096cc92c0 100644 --- a/pyload/plugins/crypter/TurbobitNetFolder.py +++ b/pyload/plugins/crypter/TurbobitNetFolder.py @@ -7,18 +7,21 @@ from pyload.utils import json_loads class TurbobitNetFolder(SimpleCrypter): - __name__ = "TurbobitNetFolder" - __type__ = "crypter" - __version__ = "0.04" + __name__ = "TurbobitNetFolder" + __type__ = "crypter" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?turbobit\.net/download/folder/(?P<ID>\w+)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Turbobit.net folder decrypter plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] - TITLE_PATTERN = r"src='/js/lib/grid/icon/folder.png'> <span>(.+?)</span>" + NAME_PATTERN = r'src=\'/js/lib/grid/icon/folder.png\'> <span>(?P<N>.+?)</span>' def _getLinks(self, id, page=1): @@ -34,6 +37,7 @@ class TurbobitNetFolder(SimpleCrypter): else: return + def getLinks(self): id = re.match(self.__pattern__, self.pyfile.url).group("ID") fixurl = lambda id: "http://turbobit.net/%s.html" % id diff --git a/pyload/plugins/crypter/TusfilesNetFolder.py b/pyload/plugins/crypter/TusfilesNetFolder.py index 245cb20bf..e8da59736 100644 --- a/pyload/plugins/crypter/TusfilesNetFolder.py +++ b/pyload/plugins/crypter/TusfilesNetFolder.py @@ -4,23 +4,26 @@ import math import re from urlparse import urljoin -from pyload.plugins.internal.SimpleCrypter import SimpleCrypter +from module.plugins.internal.XFSCrypter import XFSCrypter -class TusfilesNetFolder(SimpleCrypter): - __name__ = "TusfilesNetFolder" - __type__ = "crypter" - __version__ = "0.03" +class TusfilesNetFolder(XFSCrypter): + __name__ = "TusfilesNetFolder" + __type__ = "crypter" + __version__ = "0.06" - __pattern__ = r'https?://(?:www\.)?tusfiles\.net/go/(?P<ID>\w+)/?' + __pattern__ = r'https?://(?:www\.)?tusfiles\.net/go/(?P<ID>\w+)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Tusfiles.net folder decrypter plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com"), + ("stickell", "l.stickell@yahoo.it")] - LINK_PATTERN = r'<TD align=left><a href="(.*?)">' - TITLE_PATTERN = r'<Title>.*?\: (.+) folder</Title>' + HOSTER_DOMAIN = "tusfiles.net" + PAGES_PATTERN = r'>\((\d+) \w+\)<' URL_REPLACEMENTS = [(__pattern__, r'https://www.tusfiles.net/go/\g<ID>/')] @@ -29,6 +32,7 @@ class TusfilesNetFolder(SimpleCrypter): def loadPage(self, page_n): return self.load(urljoin(self.pyfile.url, str(page_n)), decode=True) + def handleMultiPages(self): pages = re.search(self.PAGES_PATTERN, self.html) if pages: @@ -38,4 +42,4 @@ class TusfilesNetFolder(SimpleCrypter): for p in xrange(2, pages + 1): self.html = self.loadPage(p) - self.package_links += self.getLinks() + self.links += self.getLinks() diff --git a/pyload/plugins/crypter/UlozToFolder.py b/pyload/plugins/crypter/UlozToFolder.py index 1d25fff6f..da1cb61b9 100644 --- a/pyload/plugins/crypter/UlozToFolder.py +++ b/pyload/plugins/crypter/UlozToFolder.py @@ -5,14 +5,17 @@ from pyload.plugins.base.Crypter import Crypter class UlozToFolder(Crypter): - __name__ = "UlozToFolder" - __type__ = "crypter" + __name__ = "UlozToFolder" + __type__ = "crypter" __version__ = "0.2" - __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj.cz|zachowajto.pl)/(m|soubory)/.*' + __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(m|soubory)/.*' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Uloz.to folder decrypter plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] FOLDER_PATTERN = r'<ul class="profile_files">(.*?)</ul>' @@ -25,10 +28,10 @@ class UlozToFolder(Crypter): new_links = [] for i in xrange(1, 100): - self.logInfo("Fetching links from page %i" % i) - m = re.search(self.FOLDER_PATTERN, html, re.DOTALL) + self.logInfo(_("Fetching links from page %i") % i) + m = re.search(self.FOLDER_PATTERN, html, re.S) if m is None: - self.fail("Parse error (FOLDER)") + self.error(_("FOLDER_PATTERN not found")) new_links.extend(re.findall(self.LINK_PATTERN, m.group(1))) m = re.search(self.NEXT_PAGE_PATTERN, html) @@ -37,9 +40,7 @@ class UlozToFolder(Crypter): else: break else: - self.logInfo("Limit of 99 pages reached, aborting") + self.logInfo(_("Limit of 99 pages reached, aborting")) if new_links: self.urls = [map(lambda s: "http://ulozto.net/%s" % s, new_links)] - else: - self.fail('Could not extract any links') diff --git a/pyload/plugins/crypter/UploadableChFolder.py b/pyload/plugins/crypter/UploadableChFolder.py index a3b77eaaa..8fff41c16 100644 --- a/pyload/plugins/crypter/UploadableChFolder.py +++ b/pyload/plugins/crypter/UploadableChFolder.py @@ -4,18 +4,21 @@ from pyload.plugins.internal.SimpleCrypter import SimpleCrypter class UploadableChFolder(SimpleCrypter): - __name__ = "UploadableChFolder" - __type__ = "crypter" - __version__ = "0.02" + __name__ = "UploadableChFolder" + __type__ = "crypter" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?uploadable\.ch/list/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Uploadable.ch folder decrypter plugin""" - __authors__ = [("guidobelix", "guidobelix@hotmail.it"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it"), + ("Walter Purcaro", "vuolter@gmail.com")] LINK_PATTERN = r'"(.+?)" class="icon_zipfile">' - TITLE_PATTERN = r'<div class="folder"><span> </span>(.+?)</div>' + NAME_PATTERN = r'<div class="folder"><span> </span>(?P<N>.+?)</div>' OFFLINE_PATTERN = r'We are sorry... The URL you entered cannot be found on the server.' TEMP_OFFLINE_PATTERN = r'<div class="icon_err">' diff --git a/pyload/plugins/crypter/UploadedToFolder.py b/pyload/plugins/crypter/UploadedToFolder.py index 223c419d7..359ba92d0 100644 --- a/pyload/plugins/crypter/UploadedToFolder.py +++ b/pyload/plugins/crypter/UploadedToFolder.py @@ -2,37 +2,33 @@ import re -from pyload.plugins.internal.SimpleCrypter import SimpleCrypter +from urlparse import urljoin + +from module.plugins.internal.SimpleCrypter import SimpleCrypter class UploadedToFolder(SimpleCrypter): - __name__ = "UploadedToFolder" - __type__ = "crypter" - __version__ = "0.4" + __name__ = "UploadedToFolder" + __type__ = "crypter" + __version__ = "0.42" __pattern__ = r'http://(?:www\.)?(uploaded|ul)\.(to|net)/(f|folder|list)/(?P<id>\w+)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """UploadedTo decrypter plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] PLAIN_PATTERN = r'<small class="date"><a href="(?P<plain>[\w/]+)" onclick=' - TITLE_PATTERN = r'<title>(.+?)<' - + NAME_PATTERN = r'<title>(?P<N>.+?)<' - def decrypt(self, pyfile): - self.html = self.load(pyfile.url) - - package_name, folder_name = self.getPackageNameAndFolder() + def getLinks(self): m = re.search(self.PLAIN_PATTERN, self.html) - if m: - plain_link = 'http://uploaded.net/' + m.group('plain') - else: - self.fail('Parse error - Unable to find plain url list') - - self.html = self.load(plain_link) - package_links = self.html.split('\n')[:-1] - self.logDebug("Package has %d links" % len(package_links)) + if m is None: + self.error(_("PLAIN_PATTERN not found")) - self.packages = [(package_name, package_links, folder_name)] + plain_link = urljoin("http://uploaded.net/", m.group('plain')) + return self.load(plain_link).split('\n')[:-1] diff --git a/pyload/plugins/crypter/WiiReloadedOrg.py b/pyload/plugins/crypter/WiiReloadedOrg.py index 0e3aef6d6..3c48044b0 100644 --- a/pyload/plugins/crypter/WiiReloadedOrg.py +++ b/pyload/plugins/crypter/WiiReloadedOrg.py @@ -4,11 +4,13 @@ from pyload.plugins.internal.DeadCrypter import DeadCrypter class WiiReloadedOrg(DeadCrypter): - __name__ = "WiiReloadedOrg" - __type__ = "crypter" + __name__ = "WiiReloadedOrg" + __type__ = "crypter" __version__ = "0.11" __pattern__ = r'http://(?:www\.)?wii-reloaded\.org/protect/get\.php\?i=.+' + __config__ = [] __description__ = """Wii-Reloaded.org decrypter plugin""" - __authors__ = [("hzpz", None)] + __license__ = "GPLv3" + __authors__ = [("hzpz", None)] diff --git a/pyload/plugins/crypter/XupPl.py b/pyload/plugins/crypter/XupPl.py index 798572285..87c93a305 100644 --- a/pyload/plugins/crypter/XupPl.py +++ b/pyload/plugins/crypter/XupPl.py @@ -4,14 +4,17 @@ from pyload.plugins.base.Crypter import Crypter class XupPl(Crypter): - __name__ = "XupPl" - __type__ = "crypter" + __name__ = "XupPl" + __type__ = "crypter" __version__ = "0.1" __pattern__ = r'https?://(?:[^/]*\.)?xup\.pl/.*' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Xup.pl decrypter plugin""" - __authors__ = [("z00nx", "z00nx0@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("z00nx", "z00nx0@gmail.com")] def decrypt(self, pyfile): @@ -19,4 +22,4 @@ class XupPl(Crypter): if 'location' in header: self.urls = [header['location']] else: - self.fail('Unable to find link') + self.fail(_("Unable to find link")) diff --git a/pyload/plugins/crypter/YoutubeBatch.py b/pyload/plugins/crypter/YoutubeBatch.py index b48e792c0..7cb0e2f0a 100644 --- a/pyload/plugins/crypter/YoutubeBatch.py +++ b/pyload/plugins/crypter/YoutubeBatch.py @@ -8,29 +8,34 @@ from pyload.utils import json_loads from pyload.plugins.base.Crypter import Crypter from pyload.utils import safe_join -API_URL = "AIzaSyCKnWLNlkX-L4oD1aEzqqhRw1zczeD6_k0" - class YoutubeBatch(Crypter): - __name__ = "YoutubeBatch" - __type__ = "crypter" - __version__ = "1.00" + __name__ = "YoutubeBatch" + __type__ = "crypter" + __version__ = "1.01" __pattern__ = r'https?://(?:www\.|m\.)?youtube\.com/(?P<TYPE>user|playlist|view_play_list)(/|.*?[?&](?:list|p)=)(?P<ID>[\w-]+)' - __config__ = [("likes", "bool", "Grab user (channel) liked videos", False), + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True), + ("likes", "bool", "Grab user (channel) liked videos", False), ("favorites", "bool", "Grab user (channel) favorite videos", False), ("uploads", "bool", "Grab channel unplaylisted videos", True)] __description__ = """Youtube.com channel & playlist decrypter plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + API_KEY = "AIzaSyCKnWLNlkX-L4oD1aEzqqhRw1zczeD6_k0" def api_response(self, ref, req): - req.update({"key": API_KEY}) + req.update({"key": self.API_KEY}) url = urljoin("https://www.googleapis.com/youtube/v3/", ref) page = self.load(url, get=req) return json_loads(page) + def getChannel(self, user): channels = self.api_response("channels", {"part": "id,snippet,contentDetails", "forUsername": user, "maxResults": "50"}) if channels['items']: @@ -40,6 +45,7 @@ class YoutubeBatch(Crypter): "relatedPlaylists": channel['contentDetails']['relatedPlaylists'], "user": user} # One lone channel for user? + def getPlaylist(self, p_id): playlists = self.api_response("playlists", {"part": "snippet", "id": p_id}) if playlists['items']: @@ -49,6 +55,7 @@ class YoutubeBatch(Crypter): "channelId": playlist['snippet']['channelId'], "channelTitle": playlist['snippet']['channelTitle']} + def _getPlaylists(self, id, token=None): req = {"part": "id", "maxResults": "50", "channelId": id} if token: @@ -63,9 +70,11 @@ class YoutubeBatch(Crypter): for item in self._getPlaylists(id, playlists['nextPageToken']): yield item + def getPlaylists(self, ch_id): return map(self.getPlaylist, self._getPlaylists(ch_id)) + def _getVideosId(self, id, token=None): req = {"part": "contentDetails", "maxResults": "50", "playlistId": id} if token: @@ -80,9 +89,11 @@ class YoutubeBatch(Crypter): for item in self._getVideosId(id, playlist['nextPageToken']): yield item + def getVideosId(self, p_id): return list(self._getVideosId(p_id)) + def decrypt(self, pyfile): m = re.match(self.__pattern__, pyfile.url) m_id = m.group("ID") @@ -114,7 +125,7 @@ class YoutubeBatch(Crypter): playlists = [self.getPlaylist(m_id)] if not playlists: - self.fail("No playlist available") + self.fail(_("No playlist available")) addedvideos = [] urlize = lambda x: "https://www.youtube.com/watch?v=" + x diff --git a/pyload/plugins/hook/AlldebridCom.py b/pyload/plugins/hook/AlldebridCom.py index dadf322b4..9ed80f101 100644 --- a/pyload/plugins/hook/AlldebridCom.py +++ b/pyload/plugins/hook/AlldebridCom.py @@ -5,19 +5,19 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class AlldebridCom(MultiHoster): - __name__ = "AlldebridCom" - __type__ = "hook" + __name__ = "AlldebridCom" + __type__ = "hook" __version__ = "0.13" - __config__ = [("activated", "bool", "Activated", False), - ("https", "bool", "Enable HTTPS", False), + __config__ = [("https", "bool", "Enable HTTPS", False), ("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__ = """Alldebrid.com hook plugin""" - __authors__ = [("Andy Voigt", "spamsales@online.de")] + __license__ = "GPLv3" + __authors__ = [("Andy Voigt", "spamsales@online.de")] def getHoster(self): diff --git a/pyload/plugins/hook/BypassCaptcha.py b/pyload/plugins/hook/BypassCaptcha.py index 02b72c6d0..8b34777f0 100644 --- a/pyload/plugins/hook/BypassCaptcha.py +++ b/pyload/plugins/hook/BypassCaptcha.py @@ -13,29 +13,32 @@ class BypassCaptchaException(Exception): def __init__(self, err): self.err = err + def getCode(self): return self.err + def __str__(self): return "<BypassCaptchaException %s>" % self.err + def __repr__(self): return "<BypassCaptchaException %s>" % self.err class BypassCaptcha(Hook): - __name__ = "BypassCaptcha" - __type__ = "hook" + __name__ = "BypassCaptcha" + __type__ = "hook" __version__ = "0.04" - __config__ = [("activated", "bool", "Activated", False), - ("force", "bool", "Force BC even if client is connected", False), + __config__ = [("force", "bool", "Force BC even if client is connected", False), ("passkey", "password", "Passkey", "")] __description__ = """Send captchas to BypassCaptcha.com""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("Godofdream", "soilfcition@gmail.com"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("Godofdream", "soilfcition@gmail.com"), + ("zoidberg", "zoidberg@mujmail.cz")] PYLOAD_KEY = "4f771155b640970d5607f919a615bdefc67e7d32" @@ -46,14 +49,16 @@ class BypassCaptcha(Hook): def setup(self): - self.info = {} + self.info = {} #@TODO: Remove in 0.4.10 + def getCredits(self): - response = getURL(self.GETCREDITS_URL, post={"key": self.getConfig("passkey")}) + res = getURL(self.GETCREDITS_URL, post={"key": self.getConfig("passkey")}) - data = dict([x.split(' ', 1) for x in response.splitlines()]) + data = dict([x.split(' ', 1) for x in res.splitlines()]) return int(data['Left']) + def submit(self, captcha, captchaType="file", match=None): req = getRequest() @@ -61,18 +66,18 @@ class BypassCaptcha(Hook): req.c.setopt(LOW_SPEED_TIME, 80) try: - response = req.load(self.SUBMIT_URL, - post={"vendor_key": self.PYLOAD_KEY, - "key": self.getConfig("passkey"), - "gen_task_id": "1", - "file": (FORM_FILE, captcha)}, - multipart=True) + res = req.load(self.SUBMIT_URL, + post={'vendor_key': self.PYLOAD_KEY, + 'key': self.getConfig("passkey"), + 'gen_task_id': "1", + 'file': (FORM_FILE, captcha)}, + multipart=True) finally: req.close() - data = dict([x.split(' ', 1) for x in response.splitlines()]) + data = dict([x.split(' ', 1) for x in res.splitlines()]) if not data or "Value" not in data: - raise BypassCaptchaException(response) + raise BypassCaptchaException(res) result = data['Value'] ticket = data['TaskId'] @@ -80,12 +85,14 @@ class BypassCaptcha(Hook): return ticket, result + def respond(self, ticket, success): try: - response = getURL(self.RESPOND_URL, post={"task_id": ticket, "key": self.getConfig("passkey"), + res = getURL(self.RESPOND_URL, post={"task_id": ticket, "key": self.getConfig("passkey"), "cv": 1 if success else 0}) except BadHeader, e: - self.logError(_("Could not send response."), e + self.logError(_("Could not send response"), e) + def newCaptchaTask(self, task): if "service" in task.data: @@ -109,14 +116,17 @@ class BypassCaptcha(Hook): else: self.logInfo(_("Your %s account has not enough credits") % self.__name__) + def captchaCorrect(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: self.respond(task.data['ticket'], True) + def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: self.respond(task.data['ticket'], False) + def processCaptcha(self, task): c = task.captchaFile try: diff --git a/pyload/plugins/hook/Captcha9kw.py b/pyload/plugins/hook/Captcha9kw.py index c37bfc61f..f131aa21e 100644 --- a/pyload/plugins/hook/Captcha9kw.py +++ b/pyload/plugins/hook/Captcha9kw.py @@ -2,155 +2,252 @@ from __future__ import with_statement -import time +import re from base64 import b64encode from thread import start_new_thread +from time import sleep from pyload.network.HTTPRequest import BadHeader from pyload.network.RequestFactory import getURL + from pyload.plugins.base.Hook import Hook class Captcha9kw(Hook): - __name__ = "Captcha9kw" - __type__ = "hook" - __version__ = "0.09" - - __config__ = [("activated", "bool", "Activated", False), - ("force", "bool", "Force CT even if client is connected", True), - ("https", "bool", "Enable HTTPS", False), - ("confirm", "bool", "Confirm Captcha (Cost +6)", False), - ("captchaperhour", "int", "Captcha per hour (max. 9999)", 9999), - ("prio", "int", "Prio 1-10 (Cost +1-10)", 0), - ("selfsolve", "bool", - "If enabled and you have a 9kw client active only you will get your captcha to solve it (Selfsolve)", - False), - ("timeout", "int", "Timeout (max. 300)", 300), - ("passkey", "password", "API key", "")] + __name__ = "Captcha9kw" + __type__ = "hook" + __version__ = "0.24" + + __config__ = [("activated", "bool", "Activated", True), + ("ssl", "bool", "Use HTTPS", True), + ("force", "bool", "Force captcha resolving even if client is connected", True), + ("confirm", "bool", "Confirm Captcha (cost +6 credits)", False), + ("captchaperhour", "int", "Captcha per hour", "9999"), + ("prio", "int", "Priority (max 10)(cost +0 -> +10 credits)", "0"), + ("queue", "int", "Max. Queue (max 999)", "50"), + ("hoster_options", "string", "Hoster options (format: pluginname:prio=1:selfsolfe=1:confirm=1:timeout=900|...)", "ShareonlineBiz:prio=0:timeout=999 | UploadedTo:prio=0:timeout=999"), + ("selfsolve", "bool", "Selfsolve (manually solve your captcha in your 9kw client if active)", "0"), + ("passkey", "password", "API key", ""), + ("timeout", "int", "Timeout in seconds (min 60, max 3999)", "900")] __description__ = """Send captchas to 9kw.eu""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] - API_URL = "://www.9kw.eu/index.cgi" + API_URL = "http://www.9kw.eu/index.cgi" def setup(self): - self.API_URL = "https" + self.API_URL if self.getConfig("https") else "http" + self.API_URL - self.info = {} + self.info = {} #@TODO: Remove in 0.4.10 + if self.getConfig("ssl"): + self.API_URL = self.API_URL.replace("http://", "https://") - def getCredits(self): - response = getURL(self.API_URL, get={"apikey": self.getConfig("passkey"), "pyload": "1", "source": "pyload", - "action": "usercaptchaguthaben"}) - if response.isdigit(): - self.logInfo(_("%s credits left") % response) - self.info['credits'] = credits = int(response) + def getCredits(self): + res = getURL(self.API_URL, + get={'apikey': self.getConfig("passkey"), + 'pyload': "1", + 'source': "pyload", + 'action': "usercaptchaguthaben"}) + + if res.isdigit(): + self.logInfo(_("%s credits left") % res) + credits = self.info["credits"] = int(res) return credits else: - self.logError(response) + self.logError(res) return 0 - def processCaptcha(self, task): - result = None - with open(task.captchaFile, 'rb') as f: - data = f.read() + def _processCaptcha(self, task): + try: + with open(task.captchaFile, 'rb') as f: + data = f.read() + + except IOError, e: + self.logError(e) + return + data = b64encode(data) - self.logDebug(task.captchaFile, data) - if task.isPositional(): - mouse = 1 - else: - mouse = 0 - - response = getURL(self.API_URL, post={ - "apikey": self.getConfig("passkey"), - "prio": self.getConfig("prio"), - "confirm": self.getConfig("confirm"), - "captchaperhour": self.getConfig("captchaperhour"), - "maxtimeout": self.getConfig("timeout"), - "selfsolve": self.getConfig("selfsolve"), - "pyload": "1", - "source": "pyload", - "base64": "1", - "mouse": mouse, - "file-upload-01": data, - "action": "usercaptchaupload"}) - - if response.isdigit(): - self.logInfo(_("New CaptchaID from upload: %s : %s") % (response, task.captchaFile)) - - for _ in xrange(1, 100, 1): - response2 = getURL(self.API_URL, get={"apikey": self.getConfig("passkey"), "id": response, - "pyload": "1", "source": "pyload", - "action": "usercaptchacorrectdata"}) - - if response2 != "": + mouse = 1 if task.isPositional() else 0 + pluginname = re.search(r'_([^_]*)_\d+.\w+', task.captchaFile).group(1) + + option = {'min' : 2, + 'max' : 50, + 'phrase' : 0, + 'numeric' : 0, + 'case_sensitive': 0, + 'math' : 0, + 'prio' : min(max(self.getConfig("prio"), 0), 10), + 'confirm' : self.getConfig("confirm"), + 'timeout' : min(max(self.getConfig("timeout"), 300), 3999), + 'selfsolve' : self.getConfig("selfsolve"), + 'cph' : self.getConfig("captchaperhour")} + + for opt in str(self.getConfig("hoster_options").split('|')): + + details = map(str.strip, opt.split(':')) + + if not details or details[0].lower() != pluginname.lower(): + continue + + for d in details: + hosteroption = d.split("=") + + if len(hosteroption) < 2 or not hosteroption[1].isdigit(): + continue + + o = hosteroption[0].lower() + if o in option: + option[o] = hosteroption[1] + + break + + post_data = {'apikey' : self.getConfig("passkey"), + 'prio' : option['prio'], + 'confirm' : option['confirm'], + 'maxtimeout' : option['timeout'], + 'selfsolve' : option['selfsolve'], + 'captchaperhour': option['cph'], + 'case-sensitive': option['case_sensitive'], + 'min_len' : option['min'], + 'max_len' : option['max'], + 'phrase' : option['phrase'], + 'numeric' : option['numeric'], + 'math' : option['math'], + 'oldsource' : pluginname, + 'pyload' : "1", + 'source' : "pyload", + 'base64' : "1", + 'mouse' : mouse, + 'file-upload-01': data, + 'action' : "usercaptchaupload"} + + for _i in xrange(5): + try: + res = getURL(self.API_URL, post=post_data) + except BadHeader, e: + sleep(3) + else: + if res and res.isdigit(): break + else: + self.logError(_("Bad upload: %s") % res) + return + + self.logDebug(_("NewCaptchaID ticket: %s") % res, task.captchaFile) + + task.data["ticket"] = res + + for _i in xrange(int(self.getConfig("timeout") / 5)): + result = getURL(self.API_URL, + get={'apikey': self.getConfig("passkey"), + 'id' : res, + 'pyload': "1", + 'info' : "1", + 'source': "pyload", + 'action': "usercaptchacorrectdata"}) + + if not result or result == "NO DATA": + sleep(5) + else: + break + else: + self.logDebug("Could not send request: %s" % res) + result = None - time.sleep(3) + self.logInfo(_("Captcha result for ticket %s: %s") % (res, result)) + + task.setResult(result) - result = response2 - task.data['ticket'] = response - self.logInfo(_("Result %s : %s") % (response, result)) - task.setResult(result) - else: - self.logError(_("Bad upload"), response) - return False def newCaptchaTask(self, task): if not task.isTextual() and not task.isPositional(): - return False + return if not self.getConfig("passkey"): - return False + return if self.core.isClientConnected() and not self.getConfig("force"): - return False + return - if self.getCredits() > 0: - task.handler.append(self) - task.setWaiting(self.getConfig("timeout")) - start_new_thread(self.processCaptcha, (task,)) + credits = self.getCredits() - else: - self.logError(_("Your Captcha 9kw.eu Account has not enough credits")) + if not credits: + self.logError(_("Your captcha 9kw.eu account has not enough credits")) + return - def captchaCorrect(self, task): - if "ticket" in task.data: + queue = min(self.getConfig("queue"), 999) + timeout = min(max(self.getConfig("timeout"), 300), 3999) + pluginname = re.search(r'_([^_]*)_\d+.\w+', task.captchaFile).group(1) - try: - response = getURL(self.API_URL, - post={"action": "usercaptchacorrectback", - "apikey": self.getConfig("passkey"), - "api_key": self.getConfig("passkey"), - "correct": "1", - "pyload": "1", - "source": "pyload", - "id": task.data['ticket']}) - self.logInfo(_("Request correct", response) + for _i in xrange(5): + servercheck = getURL("http://www.9kw.eu/grafik/servercheck.txt") + if queue < re.search(r'queue=(\d+)', servercheck).group(1): + break - except BadHeader, e: - self.logError(_("Could not send correct request."), e) + sleep(10) else: - self.logError(_("No CaptchaID for correct request (task %s) found.") % task) + self.fail(_("Too many captchas in queue")) - def captchaInvalid(self, task): - if "ticket" in task.data: + for opt in str(self.getConfig("hoster_options").split('|')): + details = map(str.strip, opt.split(':')) - try: - response = getURL(self.API_URL, - post={"action": "usercaptchacorrectback", - "apikey": self.getConfig("passkey"), - "api_key": self.getConfig("passkey"), - "correct": "2", - "pyload": "1", - "source": "pyload", - "id": task.data['ticket']}) - self.logInfo(_("Request refund", response) + if not details or details[0].lower() != pluginname.lower(): + continue - except BadHeader, e: - self.logError(_("Could not send refund request."), e) + for d in details: + hosteroption = d.split("=") + + if (len(hosteroption) > 1 + and hosteroption[0].lower() == 'timeout' + and hosteroption[1].isdigit()): + timeout = int(hosteroption[1]) + + break + + task.handler.append(self) + + task.setWaiting(timeout) + + self._processCaptcha(task) + + + def _captchaResponse(self, task, correct): + type = "correct" if correct else "refund" + + if 'ticket' not in task.data: + self.logDebug("No CaptchaID for %s request (task: %s)" % (type, task)) + return + + passkey = self.getConfig("passkey") + + for _i in xrange(3): + res = getURL(self.API_URL, + get={'action' : "usercaptchacorrectback", + 'apikey' : passkey, + 'api_key': passkey, + 'correct': "1" if correct else "2", + 'pyload' : "1", + 'source' : "pyload", + 'id' : task.data["ticket"]}) + + self.logDebug("Request %s: %s" % (type, res)) + + if res == "OK": + break + + sleep(5) else: - self.logError(_("No CaptchaID for not correct request (task %s) found.") % task) + self.logDebug("Could not send %s request: %s" % (type, res)) + + + def captchaCorrect(self, task): + self._captchaResponse(task, True) + + + def captchaInvalid(self, task): + self._captchaResponse(task, False) diff --git a/pyload/plugins/hook/CaptchaBrotherhood.py b/pyload/plugins/hook/CaptchaBrotherhood.py index 79216923e..03821b8b6 100644 --- a/pyload/plugins/hook/CaptchaBrotherhood.py +++ b/pyload/plugins/hook/CaptchaBrotherhood.py @@ -23,48 +23,53 @@ class CaptchaBrotherhoodException(Exception): def __init__(self, err): self.err = err + def getCode(self): return self.err + def __str__(self): return "<CaptchaBrotherhoodException %s>" % self.err + def __repr__(self): return "<CaptchaBrotherhoodException %s>" % self.err class CaptchaBrotherhood(Hook): - __name__ = "CaptchaBrotherhood" - __type__ = "hook" + __name__ = "CaptchaBrotherhood" + __type__ = "hook" __version__ = "0.05" - __config__ = [("activated", "bool", "Activated", False), - ("username", "str", "Username", ""), + __config__ = [("username", "str", "Username", ""), ("force", "bool", "Force CT even if client is connected", False), ("passkey", "password", "Password", "")] __description__ = """Send captchas to CaptchaBrotherhood.com""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz")] API_URL = "http://www.captchabrotherhood.com/" def setup(self): - self.info = {} + self.info = {} #@TODO: Remove in 0.4.10 + def getCredits(self): - response = getURL(self.API_URL + "askCredits.aspx", - get={"username": self.getConfig("username"), "password": self.getConfig("passkey")}) - if not response.startswith("OK"): - raise CaptchaBrotherhoodException(response) + res = getURL(self.API_URL + "askCredits.aspx", + get={"username": self.getConfig("username"), "password": self.getConfig("passkey")}) + if not res.startswith("OK"): + raise CaptchaBrotherhoodException(res) else: - credits = int(response[3:]) + credits = int(res[3:]) self.logInfo(_("%d credits left") % credits) self.info['credits'] = credits return credits + def submit(self, captcha, captchaType="file", match=None): try: img = Image.open(captcha) @@ -96,34 +101,36 @@ class CaptchaBrotherhood(Hook): try: req.c.perform() - response = req.getResponse() + res = req.getResponse() except Exception, e: raise CaptchaBrotherhoodException("Submit captcha image failed") req.close() - if not response.startswith("OK"): - raise CaptchaBrotherhoodException(response[1]) + if not res.startswith("OK"): + raise CaptchaBrotherhoodException(res[1]) - ticket = response[3:] + ticket = res[3:] - for _ in xrange(15): + for _i in xrange(15): sleep(5) - response = self.get_api("askCaptchaResult", ticket) - if response.startswith("OK-answered"): - return ticket, response[12:] + res = self.get_api("askCaptchaResult", ticket) + if res.startswith("OK-answered"): + return ticket, res[12:] raise CaptchaBrotherhoodException("No solution received in time") + def get_api(self, api, ticket): - response = getURL("%s%s.aspx" % (self.API_URL, api), + res = getURL("%s%s.aspx" % (self.API_URL, api), get={"username": self.getConfig("username"), "password": self.getConfig("passkey"), "captchaID": ticket}) - if not response.startswith("OK"): - raise CaptchaBrotherhoodException("Unknown response: %s" % response) + if not res.startswith("OK"): + raise CaptchaBrotherhoodException("Unknown response: %s" % res) + + return res - return response def newCaptchaTask(self, task): if "service" in task.data: @@ -146,9 +153,11 @@ class CaptchaBrotherhood(Hook): else: self.logInfo(_("Your CaptchaBrotherhood Account has not enough credits")) + def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: - response = self.get_api("complainCaptcha", task.data['ticket']) + res = self.get_api("complainCaptcha", task.data['ticket']) + def processCaptcha(self, task): c = task.captchaFile diff --git a/pyload/plugins/hook/DeathByCaptcha.py b/pyload/plugins/hook/DeathByCaptcha.py index 293326d86..f3e4bb808 100644 --- a/pyload/plugins/hook/DeathByCaptcha.py +++ b/pyload/plugins/hook/DeathByCaptcha.py @@ -25,45 +25,51 @@ class DeathByCaptchaException(Exception): 'invalid-request': 'Invalid request', 'timed-out': 'No CAPTCHA solution received in time'} + def __init__(self, err): self.err = err + def getCode(self): return self.err + def getDesc(self): if self.err in self.DBC_ERRORS.keys(): return self.DBC_ERRORS[self.err] else: return self.err + def __str__(self): return "<DeathByCaptchaException %s>" % self.err + def __repr__(self): return "<DeathByCaptchaException %s>" % self.err class DeathByCaptcha(Hook): - __name__ = "DeathByCaptcha" - __type__ = "hook" + __name__ = "DeathByCaptcha" + __type__ = "hook" __version__ = "0.03" - __config__ = [("activated", "bool", "Activated", False), - ("username", "str", "Username", ""), + __config__ = [("username", "str", "Username", ""), ("passkey", "password", "Password", ""), ("force", "bool", "Force DBC even if client is connected", False)] __description__ = """Send captchas to DeathByCaptcha.com""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz")] API_URL = "http://api.dbcapi.me/api/" def setup(self): - self.info = {} + self.info = {} #@TODO: Remove in 0.4.10 + def call_api(self, api="captcha", post=False, multipart=False): req = getRequest() @@ -75,18 +81,18 @@ class DeathByCaptcha(Hook): post.update({"username": self.getConfig("username"), "password": self.getConfig("passkey")}) - response = None + res = None try: json = req.load("%s%s" % (self.API_URL, api), post=post, multipart=multipart) self.logDebug(json) - response = json_loads(json) + res = json_loads(json) - if "error" in response: - raise DeathByCaptchaException(response['error']) - elif "status" not in response: - raise DeathByCaptchaException(str(response)) + if "error" in res: + raise DeathByCaptchaException(res['error']) + elif "status" not in res: + raise DeathByCaptchaException(str(res)) except BadHeader, e: if 403 == e.code: @@ -103,27 +109,30 @@ class DeathByCaptcha(Hook): finally: req.close() - return response + return res + def getCredits(self): - response = self.call_api("user", True) + res = self.call_api("user", True) - if 'is_banned' in response and response['is_banned']: + if 'is_banned' in res and res['is_banned']: raise DeathByCaptchaException('banned') - elif 'balance' in response and 'rate' in response: - self.info.update(response) + elif 'balance' in res and 'rate' in res: + self.info.update(res) else: - raise DeathByCaptchaException(response) + raise DeathByCaptchaException(res) + def getStatus(self): - response = self.call_api("status", False) + res = self.call_api("status", False) - if 'is_service_overloaded' in response and response['is_service_overloaded']: + if 'is_service_overloaded' in res and res['is_service_overloaded']: raise DeathByCaptchaException('service-overload') + def submit(self, captcha, captchaType="file", match=None): #workaround multipart-post bug in HTTPRequest.py - if re.match("^[A-Za-z0-9]*$", self.getConfig("passkey")): + if re.match("^\w*$", self.getConfig("passkey")): multipart = True data = (FORM_FILE, captcha) else: @@ -132,25 +141,26 @@ class DeathByCaptcha(Hook): data = f.read() data = "base64:" + b64encode(data) - response = self.call_api("captcha", {"captchafile": data}, multipart) + res = self.call_api("captcha", {"captchafile": data}, multipart) - if "captcha" not in response: - raise DeathByCaptchaException(response) - ticket = response['captcha'] + if "captcha" not in res: + raise DeathByCaptchaException(res) + ticket = res['captcha'] - for _ in xrange(24): + for _i in xrange(24): sleep(5) - response = self.call_api("captcha/%d" % ticket, False) - if response['text'] and response['is_correct']: + res = self.call_api("captcha/%d" % ticket, False) + if res['text'] and res['is_correct']: break else: raise DeathByCaptchaException('timed-out') - result = response['text'] + result = res['text'] self.logDebug("Result %s : %s" % (ticket, result)) return ticket, result + def newCaptchaTask(self, task): if "service" in task.data: return False @@ -182,15 +192,19 @@ class DeathByCaptcha(Hook): task.setWaiting(180) start_new_thread(self.processCaptcha, (task,)) + def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: try: - response = self.call_api("captcha/%d/report" % task.data['ticket'], True) + res = self.call_api("captcha/%d/report" % task.data['ticket'], True) + except DeathByCaptchaException, e: self.logError(e.getDesc()) + except Exception, e: self.logError(e) + def processCaptcha(self, task): c = task.captchaFile try: diff --git a/pyload/plugins/hook/DebridItaliaCom.py b/pyload/plugins/hook/DebridItaliaCom.py index 4a12f052a..9c8f866f0 100644 --- a/pyload/plugins/hook/DebridItaliaCom.py +++ b/pyload/plugins/hook/DebridItaliaCom.py @@ -4,18 +4,18 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class DebridItaliaCom(MultiHoster): - __name__ = "DebridItaliaCom" - __type__ = "hook" + __name__ = "DebridItaliaCom" + __type__ = "hook" __version__ = "0.07" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Debriditalia.com hook plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def getHoster(self): diff --git a/pyload/plugins/hook/EasybytezCom.py b/pyload/plugins/hook/EasybytezCom.py index c920f4069..15033c8e7 100644 --- a/pyload/plugins/hook/EasybytezCom.py +++ b/pyload/plugins/hook/EasybytezCom.py @@ -6,16 +6,16 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class EasybytezCom(MultiHoster): - __name__ = "EasybytezCom" - __type__ = "hook" + __name__ = "EasybytezCom" + __type__ = "hook" __version__ = "0.03" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] __description__ = """EasyBytez.com hook plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def getHoster(self): diff --git a/pyload/plugins/hook/ExpertDecoders.py b/pyload/plugins/hook/ExpertDecoders.py index e843d8773..933355fbe 100644 --- a/pyload/plugins/hook/ExpertDecoders.py +++ b/pyload/plugins/hook/ExpertDecoders.py @@ -13,36 +13,38 @@ from pyload.plugins.base.Hook import Hook class ExpertDecoders(Hook): - __name__ = "ExpertDecoders" - __type__ = "hook" + __name__ = "ExpertDecoders" + __type__ = "hook" __version__ = "0.01" - __config__ = [("activated", "bool", "Activated", False), - ("force", "bool", "Force CT even if client is connected", False), + __config__ = [("force", "bool", "Force CT even if client is connected", False), ("passkey", "password", "Access key", "")] __description__ = """Send captchas to expertdecoders.com""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz")] API_URL = "http://www.fasttypers.org/imagepost.ashx" def setup(self): - self.info = {} + self.info = {} #@TODO: Remove in 0.4.10 + def getCredits(self): - response = getURL(self.API_URL, post={"key": self.getConfig("passkey"), "action": "balance"}) + res = getURL(self.API_URL, post={"key": self.getConfig("passkey"), "action": "balance"}) - if response.isdigit(): - self.logInfo(_("%s credits left") % response) - self.info['credits'] = credits = int(response) + if res.isdigit(): + self.logInfo(_("%s credits left") % res) + self.info['credits'] = credits = int(res) return credits else: - self.logError(response) + self.logError(res) return 0 + def processCaptcha(self, task): task.data['ticket'] = ticket = uuid4() result = None @@ -64,6 +66,7 @@ class ExpertDecoders(Hook): self.logDebug("Result %s : %s" % (ticket, result)) task.setResult(result) + def newCaptchaTask(self, task): if not task.isTextual(): return False @@ -82,13 +85,14 @@ class ExpertDecoders(Hook): else: self.logInfo(_("Your ExpertDecoders Account has not enough credits")) + def captchaInvalid(self, task): if "ticket" in task.data: try: - response = getURL(self.API_URL, post={"action": "refund", "key": self.getConfig("passkey"), - "gen_task_id": task.data['ticket']}) - self.logInfo(_("Request refund"), response) + res = getURL(self.API_URL, + post={'action': "refund", 'key': self.getConfig("passkey"), 'gen_task_id': task.data['ticket']}) + self.logInfo(_("Request refund", res) except BadHeader, e: - self.logError(_("Could not send refund request."), e) + self.logError(_("Could not send refund request"), e) diff --git a/pyload/plugins/hook/FastixRu.py b/pyload/plugins/hook/FastixRu.py index 8247a592c..a7a5e6b8c 100644 --- a/pyload/plugins/hook/FastixRu.py +++ b/pyload/plugins/hook/FastixRu.py @@ -6,17 +6,17 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class FastixRu(MultiHoster): - __name__ = "FastixRu" - __type__ = "hook" + __name__ = "FastixRu" + __type__ = "hook" __version__ = "0.02" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("unloadFailing", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Fastix.ru hook plugin""" - __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] + __license__ = "GPLv3" + __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] def getHoster(self): diff --git a/pyload/plugins/hook/FreeWayMe.py b/pyload/plugins/hook/FreeWayMe.py index 2db2a1a4d..b9955c90a 100644 --- a/pyload/plugins/hook/FreeWayMe.py +++ b/pyload/plugins/hook/FreeWayMe.py @@ -5,18 +5,18 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class FreeWayMe(MultiHoster): - __name__ = "FreeWayMe" - __type__ = "hook" + __name__ = "FreeWayMe" + __type__ = "hook" __version__ = "0.11" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + __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__ = """FreeWay.me hook plugin""" - __authors__ = [("Nicolas Giese", "james@free-way.me")] + __license__ = "GPLv3" + __authors__ = [("Nicolas Giese", "james@free-way.me")] def getHoster(self): diff --git a/pyload/plugins/hook/ImageTyperz.py b/pyload/plugins/hook/ImageTyperz.py index b26eaceea..b79fd42ba 100644 --- a/pyload/plugins/hook/ImageTyperz.py +++ b/pyload/plugins/hook/ImageTyperz.py @@ -17,29 +17,32 @@ class ImageTyperzException(Exception): def __init__(self, err): self.err = err + def getCode(self): return self.err + def __str__(self): return "<ImageTyperzException %s>" % self.err + def __repr__(self): return "<ImageTyperzException %s>" % self.err class ImageTyperz(Hook): - __name__ = "ImageTyperz" - __type__ = "hook" + __name__ = "ImageTyperz" + __type__ = "hook" __version__ = "0.04" - __config__ = [("activated", "bool", "Activated", False), - ("username", "str", "Username", ""), + __config__ = [("username", "str", "Username", ""), ("passkey", "password", "Password", ""), ("force", "bool", "Force IT even if client is connected", False)] __description__ = """Send captchas to ImageTyperz.com""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz")] SUBMIT_URL = "http://captchatypers.com/Forms/UploadFileAndGetTextNEW.ashx" @@ -48,23 +51,27 @@ class ImageTyperz(Hook): def setup(self): - self.info = {} + self.info = {} #@TODO: Remove in 0.4.10 + def getCredits(self): - response = getURL(self.GETCREDITS_URL, post={"action": "REQUESTBALANCE", "username": self.getConfig("username"), - "password": self.getConfig("passkey")}) + res = getURL(self.GETCREDITS_URL, + post={'action': "REQUESTBALANCE", + 'username': self.getConfig("username"), + 'password': self.getConfig("passkey")}) - if response.startswith('ERROR'): - raise ImageTyperzException(response) + if res.startswith('ERROR'): + raise ImageTyperzException(res) try: - balance = float(response) + balance = float(res) except: - raise ImageTyperzException("invalid response") + raise ImageTyperzException("Invalid response") - self.logInfo(_("Account balance: $%s left") % response) + self.logInfo(_("Account balance: $%s left") % res) return balance + def submit(self, captcha, captchaType="file", match=None): req = getRequest() #raise timeout threshold @@ -72,7 +79,7 @@ class ImageTyperz(Hook): try: #workaround multipart-post bug in HTTPRequest.py - if re.match("^[A-Za-z0-9]*$", self.getConfig("passkey")): + if re.match("^\w*$", self.getConfig("passkey")): multipart = True data = (FORM_FILE, captcha) else: @@ -81,24 +88,26 @@ class ImageTyperz(Hook): data = f.read() data = b64encode(data) - response = req.load(self.SUBMIT_URL, post={"action": "UPLOADCAPTCHA", - "username": self.getConfig("username"), - "password": self.getConfig("passkey"), "file": data}, - multipart=multipart) + res = req.load(self.SUBMIT_URL, + post={'action': "UPLOADCAPTCHA", + 'username': self.getConfig("username"), + 'password': self.getConfig("passkey"), "file": data}, + multipart=multipart) finally: req.close() - if response.startswith("ERROR"): - raise ImageTyperzException(response) + if res.startswith("ERROR"): + raise ImageTyperzException(res) else: - data = response.split('|') + data = res.split('|') if len(data) == 2: ticket, result = data else: - raise ImageTyperzException("Unknown response %s" % response) + raise ImageTyperzException("Unknown response: %s" % res) return ticket, result + def newCaptchaTask(self, task): if "service" in task.data: return False @@ -121,16 +130,20 @@ class ImageTyperz(Hook): else: self.logInfo(_("Your %s account has not enough credits") % self.__name__) + def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: - response = getURL(self.RESPOND_URL, post={"action": "SETBADIMAGE", "username": self.getConfig("username"), - "password": self.getConfig("passkey"), - "imageid": task.data['ticket']}) + res = getURL(self.RESPOND_URL, + post={'action': "SETBADIMAGE", + 'username': self.getConfig("username"), + 'password': self.getConfig("passkey"), + 'imageid': task.data['ticket']}) - if response == "SUCCESS": + if res == "SUCCESS": self.logInfo(_("Bad captcha solution received, requested refund")) else: - self.logError(_("Bad captcha solution received, refund request failed"), response) + self.logError(_("Bad captcha solution received, refund request failed"), res) + def processCaptcha(self, task): c = task.captchaFile diff --git a/pyload/plugins/hook/LinkdecrypterCom.py b/pyload/plugins/hook/LinkdecrypterCom.py index ea1e54b30..8455ed904 100644 --- a/pyload/plugins/hook/LinkdecrypterCom.py +++ b/pyload/plugins/hook/LinkdecrypterCom.py @@ -8,14 +8,13 @@ from pyload.utils import remove_chars class LinkdecrypterCom(Hook): - __name__ = "LinkdecrypterCom" - __type__ = "hook" - __version__ = "0.19" - - __config__ = [("activated", "bool", "Activated", False)] + __name__ = "LinkdecrypterCom" + __type__ = "hook" + __version__ = "0.20" __description__ = """Linkdecrypter.com hook plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def coreReady(self): @@ -24,9 +23,16 @@ class LinkdecrypterCom(Hook): except Exception, e: self.logError(e) + def loadPatterns(self): - page = getURL("http://linkdecrypter.com/") - m = re.search(r'<b>Supported\(\d+\)</b>: <i>([^+<]*)', page) + html = getURL("http://linkdecrypter.com/") + + m = re.search(r'<title>', html) + if m is None: + self.logError(_("Linkdecrypter site is down")) + return + + m = re.search(r'<b>Supported\(\d+\)</b>: <i>([^+<]*)', html) if m is None: self.logError(_("Crypter list not found")) return @@ -45,10 +51,10 @@ class LinkdecrypterCom(Hook): self.logError(_("Crypter list is empty")) return - regexp = r"https?://([^.]+\.)*?(%s)/.*" % "|".join(online) + regexp = r'https?://([^.]+\.)*?(%s)/.*' % '|'.join(online) dict = self.core.pluginManager.crypterPlugins[self.__name__] dict['pattern'] = regexp dict['re'] = re.compile(regexp) - self.logDebug("REGEXP", regexp) + self.logDebug("Loaded pattern: %s" % regexp) diff --git a/pyload/plugins/hook/LinksnappyCom.py b/pyload/plugins/hook/LinksnappyCom.py index 0cf913f60..0957b6a91 100644 --- a/pyload/plugins/hook/LinksnappyCom.py +++ b/pyload/plugins/hook/LinksnappyCom.py @@ -6,18 +6,18 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class LinksnappyCom(MultiHoster): - __name__ = "LinksnappyCom" - __type__ = "hook" + __name__ = "LinksnappyCom" + __type__ = "hook" __version__ = "0.01" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Linksnappy.com hook plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def getHoster(self): diff --git a/pyload/plugins/hook/MegaDebridEu.py b/pyload/plugins/hook/MegaDebridEu.py index bf6997117..6c3e2b03a 100644 --- a/pyload/plugins/hook/MegaDebridEu.py +++ b/pyload/plugins/hook/MegaDebridEu.py @@ -6,15 +6,15 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class MegaDebridEu(MultiHoster): - __name__ = "MegaDebridEu" - __type__ = "hook" + __name__ = "MegaDebridEu" + __type__ = "hook" __version__ = "0.02" - __config__ = [("activated", "bool", "Activated", False), - ("unloadFailing", "bool", "Revert to standard download if download fails", False)] + __config__ = [("unloadFailing", "bool", "Revert to standard download if download fails", False)] __description__ = """mega-debrid.eu hook plugin""" - __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] + __license__ = "GPLv3" + __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] def getHoster(self): diff --git a/pyload/plugins/hook/MultishareCz.py b/pyload/plugins/hook/MultishareCz.py index d8396b44f..f1a12acb8 100644 --- a/pyload/plugins/hook/MultishareCz.py +++ b/pyload/plugins/hook/MultishareCz.py @@ -7,16 +7,16 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class MultishareCz(MultiHoster): - __name__ = "MultishareCz" - __type__ = "hook" + __name__ = "MultishareCz" + __type__ = "hook" __version__ = "0.04" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "uloz.to")] __description__ = """MultiShare.cz hook plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] HOSTER_PATTERN = r'<img class="logo-shareserveru"[^>]*?alt="([^"]+)"></td>\s*<td class="stav">[^>]*?alt="OK"' diff --git a/pyload/plugins/hook/MyfastfileCom.py b/pyload/plugins/hook/MyfastfileCom.py index e476c10b5..affaa2261 100644 --- a/pyload/plugins/hook/MyfastfileCom.py +++ b/pyload/plugins/hook/MyfastfileCom.py @@ -6,18 +6,19 @@ from pyload.utils import json_loads class MyfastfileCom(MultiHoster): - __name__ = "MyfastfileCom" - __type__ = "hook" + __name__ = "MyfastfileCom" + __type__ = "hook" __version__ = "0.02" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Myfastfile.com hook plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugins/hook/OverLoadMe.py b/pyload/plugins/hook/OverLoadMe.py index 347509a8b..2766165fd 100644 --- a/pyload/plugins/hook/OverLoadMe.py +++ b/pyload/plugins/hook/OverLoadMe.py @@ -5,19 +5,19 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class OverLoadMe(MultiHoster): - __name__ = "OverLoadMe" - __type__ = "hook" + __name__ = "OverLoadMe" + __type__ = "hook" __version__ = "0.01" - __config__ = [("activated", "bool", "Activated", False), - ("https", "bool", "Enable HTTPS", True), + __config__ = [("https", "bool", "Enable HTTPS", True), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 12)] __description__ = """Over-Load.me hook plugin""" - __authors__ = [("marley", "marley@over-load.me")] + __license__ = "GPLv3" + __authors__ = [("marley", "marley@over-load.me")] def getHoster(self): diff --git a/pyload/plugins/hook/PremiumTo.py b/pyload/plugins/hook/PremiumTo.py index eb5f16a83..e3c9823f6 100644 --- a/pyload/plugins/hook/PremiumTo.py +++ b/pyload/plugins/hook/PremiumTo.py @@ -5,18 +5,18 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class PremiumTo(MultiHoster): - __name__ = "PremiumTo" - __type__ = "hook" + __name__ = "PremiumTo" + __type__ = "hook" __version__ = "0.04" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] __description__ = """Premium.to hook plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] @@ -25,6 +25,7 @@ class PremiumTo(MultiHoster): get={'username': self.account.username, 'password': self.account.password}) return [x.strip() for x in page.replace("\"", "").split(";")] + def coreReady(self): self.account = self.core.accountManager.getAccountPlugin("PremiumTo") diff --git a/pyload/plugins/hook/PremiumizeMe.py b/pyload/plugins/hook/PremiumizeMe.py index 9d18f45fc..a751e7b61 100644 --- a/pyload/plugins/hook/PremiumizeMe.py +++ b/pyload/plugins/hook/PremiumizeMe.py @@ -6,18 +6,18 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class PremiumizeMe(MultiHoster): - __name__ = "PremiumizeMe" - __type__ = "hook" + __name__ = "PremiumizeMe" + __type__ = "hook" __version__ = "0.12" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + __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__ = """Premiumize.me hook plugin""" - __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] def getHoster(self): @@ -41,12 +41,13 @@ class PremiumizeMe(MultiHoster): # Extract hosters from json file return data['result']['hosterlist'] + def coreReady(self): # Get account plugin and check if there is a valid account available self.account = self.core.accountManager.getAccountPlugin("PremiumizeMe") if not self.account.canUse(): self.account = None - self.logError(_("Please add a valid premiumize.me account first and restart pyLoad.")) + self.logError(_("Please add a valid premiumize.me account first and restart pyLoad")) return # Run the overwriten core ready which actually enables the multihoster hook diff --git a/pyload/plugins/hook/RPNetBiz.py b/pyload/plugins/hook/RPNetBiz.py index 9e04f1dfd..3bbdcf839 100644 --- a/pyload/plugins/hook/RPNetBiz.py +++ b/pyload/plugins/hook/RPNetBiz.py @@ -6,18 +6,18 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class RPNetBiz(MultiHoster): - __name__ = "RPNetBiz" - __type__ = "hook" + __name__ = "RPNetBiz" + __type__ = "hook" __version__ = "0.1" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + __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__ = """RPNet.biz hook plugin""" - __authors__ = [("Dman", "dmanugm@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Dman", "dmanugm@gmail.com")] def getHoster(self): @@ -28,9 +28,9 @@ class RPNetBiz(MultiHoster): # Get account data (user, data) = self.account.selectAccount() - response = getURL("https://premium.rpnet.biz/client_api.php", - get={"username": user, "password": data['password'], "action": "showHosterList"}) - hoster_list = json_loads(response) + res = getURL("https://premium.rpnet.biz/client_api.php", + get={"username": user, "password": data['password'], "action": "showHosterList"}) + hoster_list = json_loads(res) # If account is not valid thera are no hosters available if 'error' in hoster_list: @@ -39,6 +39,7 @@ class RPNetBiz(MultiHoster): # Extract hosters from json file return hoster_list['hosters'] + def coreReady(self): # Get account plugin and check if there is a valid account available self.account = self.core.accountManager.getAccountPlugin("RPNetBiz") diff --git a/pyload/plugins/hook/RealdebridCom.py b/pyload/plugins/hook/RealdebridCom.py index 8329da7e7..a6f79a97d 100644 --- a/pyload/plugins/hook/RealdebridCom.py +++ b/pyload/plugins/hook/RealdebridCom.py @@ -5,19 +5,19 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class RealdebridCom(MultiHoster): - __name__ = "RealdebridCom" - __type__ = "hook" + __name__ = "RealdebridCom" + __type__ = "hook" __version__ = "0.43" - __config__ = [("activated", "bool", "Activated", False), - ("https", "bool", "Enable HTTPS", False), + __config__ = [("https", "bool", "Enable HTTPS", False), ("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__ = """Real-Debrid.com hook plugin""" - __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] + __license__ = "GPLv3" + __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] def getHoster(self): diff --git a/pyload/plugins/hook/RehostTo.py b/pyload/plugins/hook/RehostTo.py index f38074a7b..2c8739869 100644 --- a/pyload/plugins/hook/RehostTo.py +++ b/pyload/plugins/hook/RehostTo.py @@ -5,24 +5,25 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class RehostTo(MultiHoster): - __name__ = "RehostTo" - __type__ = "hook" + __name__ = "RehostTo" + __type__ = "hook" __version__ = "0.43" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __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__ = """Rehost.to hook plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] def getHoster(self): page = getURL("http://rehost.to/api.php?cmd=get_supported_och_dl&long_ses=%s" % self.long_ses) return [x.strip() for x in page.replace("\"", "").split(",")] + def coreReady(self): self.account = self.core.accountManager.getAccountPlugin("RehostTo") diff --git a/pyload/plugins/hook/SimplyPremiumCom.py b/pyload/plugins/hook/SimplyPremiumCom.py index 62f5ba778..a0f41901c 100644 --- a/pyload/plugins/hook/SimplyPremiumCom.py +++ b/pyload/plugins/hook/SimplyPremiumCom.py @@ -6,8 +6,8 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class SimplyPremiumCom(MultiHoster): - __name__ = "SimplyPremiumCom" - __type__ = "hook" + __name__ = "SimplyPremiumCom" + __type__ = "hook" __version__ = "0.02" __config__ = [("activated", "bool", "Activated", "False"), @@ -17,7 +17,8 @@ class SimplyPremiumCom(MultiHoster): ("interval", "int", "Reload interval in hours (0 to disable)", "24")] __description__ = """Simply-Premium.com hook plugin""" - __authors__ = [("EvolutionClip", "evolutionclip@live.de")] + __license__ = "GPLv3" + __authors__ = [("EvolutionClip", "evolutionclip@live.de")] def getHoster(self): diff --git a/pyload/plugins/hook/SimplydebridCom.py b/pyload/plugins/hook/SimplydebridCom.py index 25373449b..4668da45b 100644 --- a/pyload/plugins/hook/SimplydebridCom.py +++ b/pyload/plugins/hook/SimplydebridCom.py @@ -5,16 +5,16 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class SimplydebridCom(MultiHoster): - __name__ = "SimplydebridCom" - __type__ = "hook" + __name__ = "SimplydebridCom" + __type__ = "hook" __version__ = "0.01" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] __description__ = """Simply-Debrid.com hook plugin""" - __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] + __license__ = "GPLv3" + __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] def getHoster(self): diff --git a/pyload/plugins/hook/UnrestrictLi.py b/pyload/plugins/hook/UnrestrictLi.py index 4caedf550..cfe580048 100644 --- a/pyload/plugins/hook/UnrestrictLi.py +++ b/pyload/plugins/hook/UnrestrictLi.py @@ -6,19 +6,19 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class UnrestrictLi(MultiHoster): - __name__ = "UnrestrictLi" - __type__ = "hook" + __name__ = "UnrestrictLi" + __type__ = "hook" __version__ = "0.02" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24), ("history", "bool", "Delete History", False)] __description__ = """Unrestrict.li hook plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def getHoster(self): diff --git a/pyload/plugins/hook/XFileSharingPro.py b/pyload/plugins/hook/XFileSharingPro.py index d9ccda796..3f70f88f3 100644 --- a/pyload/plugins/hook/XFileSharingPro.py +++ b/pyload/plugins/hook/XFileSharingPro.py @@ -6,17 +6,42 @@ from pyload.plugins.base.Hook import Hook class XFileSharingPro(Hook): - __name__ = "XFileSharingPro" - __type__ = "hook" - __version__ = "0.12" + __name__ = "XFileSharingPro" + __type__ = "hook" + __version__ = "0.22" __config__ = [("activated", "bool", "Activated", True), - ("load_default", "bool", "Include default (built-in) hoster list", True), - ("include_hosters", "str", "Include hosters (comma separated)", ""), - ("exclude_hosters", "str", "Exclude hosters (comma separated)", "")] + ("use_hoster_list", "bool", "Load listed hosters only", False), + ("use_crypter_list", "bool", "Load listed crypters only", False), + ("use_builtin_list", "bool", "Load built-in plugin list", True), + ("hoster_list", "str", "Hoster list (comma separated)", ""), + ("crypter_list", "str", "Crypter list (comma separated)", "")] - __description__ = """XFileSharingPro hook plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __description__ = """Load XFileSharingPro based hosters and crypter which don't need a own plugin to run""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + # event_list = ["pluginConfigChanged"] + regexp = {'hoster' : (r'https?://(?:www\.)?([\w^_]+(?:\.[a-zA-Z]{2,})+(?:\:\d+)?)/(?:embed-)?\w{12}', + r'https?://(?:[^/]+\.)?(%s)/(?:embed-)?\w{12}\W?'), + 'crypter': (r'https?://(?:www\.)?([\w^_]+(?:\.[a-zA-Z]{2,})+(?:\:\d+)?)/(?:user|folder)s?/\w+', + r'https?://(?:[^/]+\.)?(%s)/(?:user|folder)s?/\w+')} + + HOSTER_LIST = [#WORKING HOSTERS: + "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "filevice.com", "hostingbulk.com", + "linestorage.com", "ravishare.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", + #NOT TESTED: + "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", + "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", + "vidbull.com", "zalaa.com", "zomgupload.com", + #NOT WORKING: + "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com"] + CRYPTER_LIST = [] + + + # def pluginConfigChanged(self.__name__, plugin, name, value): + # self.loadPattern() def coreReady(self): @@ -24,56 +49,50 @@ class XFileSharingPro(Hook): def loadPattern(self): - hoster_list = self.getConfigSet('include_hosters') - exclude_list = self.getConfigSet('exclude_hosters') - - if self.getConfig('load_default'): - hoster_list |= set(( - #WORKING HOSTERS: - "aieshare.com", "asixfiles.com", "banashare.com", "cyberlocker.ch", "eyesfile.co", "eyesfile.com", - "fileband.com", "filedwon.com", "filedownloads.org", "hipfile.com", "kingsupload.com", "mlfat4arab.com", - "netuploaded.com", "odsiebie.pl", "q4share.com", "ravishare.com", "uptobox.com", "verzend.be", - "xvidstage.com", "thefile.me", "sharesix.com", "hostingbulk.com", - #NOT TESTED: - "bebasupload.com", "boosterking.com", "divxme.com", "filevelocity.com", "glumbouploads.com", - "grupload.com", "heftyfile.com", "host4desi.com", "laoupload.com", "linkzhost.com", "movreel.com", - "rockdizfile.com", "limfile.com", "share76.com", "sharebeast.com", "sharehut.com", "sharerun.com", - "shareswift.com", "sharingonline.com", "6ybh-upload.com", "skipfile.com", "spaadyshare.com", - "space4file.com", "uploadbaz.com", "uploadc.com", "uploaddot.com", "uploadfloor.com", "uploadic.com", - "uploadville.com", "vidbull.com", "zalaa.com", "zomgupload.com", "kupload.org", "movbay.org", - "multishare.org", "omegave.org", "toucansharing.org", "uflinq.org", "banicrazy.info", "flowhot.info", - "upbrasil.info", "shareyourfilez.biz", "bzlink.us", "cloudcache.cc", "fileserver.cc", "farshare.to", - "filemaze.ws", "filehost.ws", "filestock.ru", "moidisk.ru", "4up.im", "100shared.com", "sharesix.com", - "thefile.me", "filenuke.com", "sharerepo.com", "mightyupload.com", - #WRONG FILE NAME: - "sendmyway.com", "upchi.co.il", - #NOT WORKING: - "amonshare.com", "imageporter.com", "file4safe.com", - #DOWN OR BROKEN: - "ddlanime.com", "fileforth.com", "loombo.com", "goldfile.eu", "putshare.com" - )) - - hoster_list -= (exclude_list) - hoster_list -= set(('', u'')) - - if not hoster_list: - self.unload() - return - - regexp = r"http://(?:[^/]*\.)?(%s)/(?:embed-)?\w{12}" % ("|".join(sorted(hoster_list)).replace('.', '\.')) - - dict = self.core.pluginManager.hosterPlugins['XFileSharingPro'] - dict['pattern'] = regexp - dict['re'] = re.compile(regexp) - self.logDebug("Pattern loaded - handling %d hosters" % len(hoster_list)) - - - def getConfigSet(self, option): - s = self.getConfig(option).lower().replace('|', ',').replace(';', ',') - return set([x.strip() for x in s.split(',')]) + use_builtin_list = self.getConfig('use_builtin_list') + for type, plugin in (("hoster", "XFileSharingPro"), + ("crypter", "XFileSharingProFolder")): + every_plugin = not self.getConfig("use_%s_list" % type) - def unload(self): - dict = self.core.pluginManager.hosterPlugins['XFileSharingPro'] + if every_plugin: + self.logInfo(_("Handling any %s I can!") % type) + pattern = self.regexp[type][0] + else: + s = self.getConfig('%s_list' % type).replace('\\', '').replace('|', ',').replace(';', ',').lower() + plugin_list = set([x.strip() for x in s.split(',')]) + + if use_builtin_list: + plugin_list |= set([x.lower() for x in getattr(self, "%s_LIST" % type.upper())]) + + plugin_list -= set(('', u'')) + + if not plugin_list: + self.logInfo(_("No %s to handle") % type) + self._unload(type, plugin) + return + + match_list = '|'.join(sorted(plugin_list)) + + len_match_list = len(plugin_list) + self.logInfo(_("Handling %d %s%s: %s") % (len_match_list, type, "" if len_match_list is 1 else "s", match_list.replace('|', ', '))) + + pattern = self.regexp[type][1] % match_list.replace('.', '\.') + + dict = self.core.pluginManager.plugins[type][plugin] + dict['pattern'] = pattern + dict['re'] = re.compile(pattern) + + self.logDebug("Loaded %s pattern: %s" % (type, pattern)) + + + def _unload(self, type, plugin): + dict = self.core.pluginManager.plugins[type][plugin] dict['pattern'] = r'^unmatchable$' - dict['re'] = re.compile(r'^unmatchable$') + dict['re'] = re.compile(dict['pattern']) + + + def unload(self): + for type, plugin in (("hoster", "XFileSharingPro"), + ("crypter", "XFileSharingProFolder")): + self._unload(type, plugin) diff --git a/pyload/plugins/hook/ZeveraCom.py b/pyload/plugins/hook/ZeveraCom.py index 2a6168008..09e3953a2 100644 --- a/pyload/plugins/hook/ZeveraCom.py +++ b/pyload/plugins/hook/ZeveraCom.py @@ -5,16 +5,16 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class ZeveraCom(MultiHoster): - __name__ = "ZeveraCom" - __type__ = "hook" + __name__ = "ZeveraCom" + __type__ = "hook" __version__ = "0.02" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] __description__ = """Real-Debrid.com hook plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def getHoster(self): diff --git a/pyload/plugins/hoster/AlldebridCom.py b/pyload/plugins/hoster/AlldebridCom.py index 331f5c2bb..7a7831204 100644 --- a/pyload/plugins/hoster/AlldebridCom.py +++ b/pyload/plugins/hoster/AlldebridCom.py @@ -11,14 +11,15 @@ from pyload.utils import parseFileSize class AlldebridCom(Hoster): - __name__ = "AlldebridCom" - __type__ = "hoster" + __name__ = "AlldebridCom" + __type__ = "hoster" __version__ = "0.34" __pattern__ = r'https?://(?:[^/]*\.)?alldebrid\..*' __description__ = """Alldebrid.com hoster plugin""" - __authors__ = [("Andy Voigt", "spamsales@online.de")] + __license__ = "GPLv3" + __authors__ = [("Andy Voigt", "spamsales@online.de")] def getFilename(self, url): @@ -30,16 +31,18 @@ class AlldebridCom(Hoster): name += "%s.tmp" % randrange(100, 999) return name + def setup(self): self.chunkLimit = 16 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "AllDebrid") - self.fail("No AllDebrid account provided") + self.fail(_("No AllDebrid account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) password = self.getPassword().splitlines() @@ -81,6 +84,6 @@ class AlldebridCom(Hoster): 'empty': re.compile(r"^$")}) if check == "error": - self.retry(wait_time=60, reason="An error occured while generating link.") + self.retry(wait_time=60, reason=_("An error occured while generating link")) elif check == "empty": - self.retry(wait_time=60, reason="Downloaded File was empty.") + self.retry(wait_time=60, reason=_("Downloaded File was empty")) diff --git a/pyload/plugins/hoster/BasePlugin.py b/pyload/plugins/hoster/BasePlugin.py index 1973c45be..761ee720c 100644 --- a/pyload/plugins/hoster/BasePlugin.py +++ b/pyload/plugins/hoster/BasePlugin.py @@ -11,14 +11,15 @@ from pyload.utils import html_unescape, remove_chars class BasePlugin(Hoster): - __name__ = "BasePlugin" - __type__ = "hoster" + __name__ = "BasePlugin" + __type__ = "hoster" __version__ = "0.20" __pattern__ = r'^unmatchable$' __description__ = """Base Plugin when any other didnt fit""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] def setup(self): @@ -34,17 +35,6 @@ class BasePlugin(Hoster): self.multiDL = False return - # self.__name__ = "NetloadIn" - # pyfile.name = "test" - # self.html = self.load("http://localhost:9000/short") - # self.download("http://localhost:9000/short") - # self.api = self.load("http://localhost:9000/short") - # self.decryptCaptcha("http://localhost:9000/captcha") - # - # if pyfile.url == "79": - # self.core.api.addPackage("test", [str(i) for i in xrange(80)], 1) - # - # return if pyfile.url.startswith("http"): try: @@ -73,13 +63,13 @@ class BasePlugin(Hoster): raise else: - self.fail("No Plugin matched and not a downloadable url.") + self.fail(_("No Plugin matched and not a downloadable url")) def downloadFile(self, pyfile): url = pyfile.url - for _ in xrange(5): + for _i in xrange(5): header = self.load(url, just_header=True) # self.load does not raise a BadHeader on 404 responses, do it here diff --git a/pyload/plugins/hoster/BayfilesCom.py b/pyload/plugins/hoster/BayfilesCom.py index d5d001730..f3fa87d89 100644 --- a/pyload/plugins/hoster/BayfilesCom.py +++ b/pyload/plugins/hoster/BayfilesCom.py @@ -9,65 +9,67 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BayfilesCom(SimpleHoster): - __name__ = "BayfilesCom" - __type__ = "hoster" - __version__ = "0.07" + __name__ = "BayfilesCom" + __type__ = "hoster" + __version__ = "0.08" - __pattern__ = r'https?://(?:www\.)?bayfiles\.(com|net)/file/(?P<ID>[a-zA-Z0-9]+/[a-zA-Z0-9]+/[^/]+)' + __pattern__ = r'https?://(?:www\.)?bayfiles\.(com|net)/file/(?P<ID>\w+/\w+/[^/]+)' __description__ = """Bayfiles.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] - FILE_INFO_PATTERN = r'<p title="(?P<N>[^"]+)">[^<]*<strong>(?P<S>[0-9., ]+)(?P<U>[kKMG])i?B</strong></p>' + INFO_PATTERN = r'<p title="(?P<N>[^"]+)">[^<]*<strong>(?P<S>[\d .,]+)(?P<U>[\w^_]+)</strong></p>' OFFLINE_PATTERN = r'(<p>The requested file could not be found.</p>|<title>404 Not Found</title>)' - WAIT_PATTERN = r'>Your IP [0-9.]* has recently downloaded a file\. Upgrade to premium or wait (\d+) minutes\.<' + WAIT_PATTERN = r'>Your IP [\d.]* has recently downloaded a file\. Upgrade to premium or wait (\d+) minutes\.<' VARS_PATTERN = r'var vfid = (\d+);\s*var delay = (\d+);' - FREE_LINK_PATTERN = r"javascript:window.location.href = '([^']+)';" + FREE_LINK_PATTERN = r'javascript:window\.location\.href = \'(.+?)\';' PREMIUM_LINK_PATTERN = r'(?:<a class="highlighted-btn" href="|(?=http://s\d+\.baycdn\.com/dl/))(.*?)"' def handleFree(self): m = re.search(self.WAIT_PATTERN, self.html) if m: - self.wait(int(m.group(1)) * 60) - self.retry() + self.retry(wait_time=int(m.group(1)) * 60) # Get download token m = re.search(self.VARS_PATTERN, self.html) if m is None: - self.parseError('VARS') + self.error(_("VARS_PATTERN not found")) vfid, delay = m.groups() - response = json_loads(self.load('http://bayfiles.com/ajax_download', get={ - "_": time() * 1000, - "action": "startTimer", - "vfid": vfid}, decode=True)) + res = json_loads(self.load('http://bayfiles.com/ajax_download', + get={"_": time() * 1000, + "action": "startTimer", + "vfid": vfid}, decode=True)) - if not "token" in response or not response['token']: - self.fail('No token') + if not "token" in res or not res['token']: + self.fail(_("No token")) self.wait(int(delay)) self.html = self.load('http://bayfiles.com/ajax_download', get={ - "token": response['token'], + "token": res['token'], "action": "getLink", "vfid": vfid}) # Get final link and download m = re.search(self.FREE_LINK_PATTERN, self.html) if m is None: - self.parseError("Free link") + self.error(_("Free link")) self.startDownload(m.group(1)) + def handlePremium(self): m = re.search(self.PREMIUM_LINK_PATTERN, self.html) if m is None: - self.parseError("Premium link") + self.error(_("Premium link")) self.startDownload(m.group(1)) + def startDownload(self, url): self.logDebug("%s URL: %s" % ("Premium" if self.premium else "Free", url)) self.download(url) diff --git a/pyload/plugins/hoster/BezvadataCz.py b/pyload/plugins/hoster/BezvadataCz.py index b0a6d6af6..2f2afc6ac 100644 --- a/pyload/plugins/hoster/BezvadataCz.py +++ b/pyload/plugins/hoster/BezvadataCz.py @@ -6,42 +6,44 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BezvadataCz(SimpleHoster): - __name__ = "BezvadataCz" - __type__ = "hoster" - __version__ = "0.24" + __name__ = "BezvadataCz" + __type__ = "hoster" + __version__ = "0.25" - __pattern__ = r'http://(?:www\.)?bezvadata.cz/stahnout/.*' + __pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.*' __description__ = """BezvaData.cz hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<p><b>Soubor: (?P<N>[^<]+)</b></p>' - FILE_SIZE_PATTERN = r'<li><strong>Velikost:</strong> (?P<S>[^<]+)</li>' + NAME_PATTERN = r'<p><b>Soubor: (?P<N>[^<]+)</b></p>' + SIZE_PATTERN = r'<li><strong>Velikost:</strong> (?P<S>[^<]+)</li>' OFFLINE_PATTERN = r'<title>BezvaData \| Soubor nenalezen</title>' def setup(self): self.multiDL = self.resumeDownload = True + def handleFree(self): #download button m = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html) if m is None: - self.parseError("page1 URL") + self.error(_("Page 1 URL not found")) url = "http://bezvadata.cz%s" % m.group(1) #captcha form self.html = self.load(url) self.checkErrors() - for _ in xrange(5): + for _i in xrange(5): action, inputs = self.parseHtmlForm('frm-stahnoutFreeForm') if not inputs: - self.parseError("FreeForm") + self.error(_("FreeForm")) m = re.search(r'<img src="data:image/png;base64,(.*?)"', self.html) if m is None: - self.parseError("captcha img") + self.error(_("Wrong captcha image")) #captcha image is contained in html page as base64encoded data but decryptCaptcha() expects image url self.load, proper_load = self.loadcaptcha, self.load @@ -56,30 +58,32 @@ class BezvadataCz(SimpleHoster): self.correctCaptcha() break else: - self.fail("No valid captcha code entered") + self.fail(_("No valid captcha code entered")) #download url self.html = self.load("http://bezvadata.cz%s" % action, post=inputs) self.checkErrors() m = re.search(r'<a class="stahnoutSoubor2" href="(.*?)">', self.html) if m is None: - self.parseError("page2 URL") + self.error(_("Page 2 URL not found")) url = "http://bezvadata.cz%s" % m.group(1) self.logDebug("DL URL %s" % url) #countdown m = re.search(r'id="countdown">(\d\d):(\d\d)<', self.html) - wait_time = (int(m.group(1)) * 60 + int(m.group(2)) + 1) if m else 120 + wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 120 self.wait(wait_time, False) self.download(url) + def checkErrors(self): if 'images/button-download-disable.png' in self.html: - self.longWait(5 * 60, 24) # parallel dl limit + self.longWait(5 * 60, 24) #: parallel dl limit elif '<div class="infobox' in self.html: self.tempOffline() + def loadcaptcha(self, data, *args, **kwargs): return data.decode("base64") diff --git a/pyload/plugins/hoster/BillionuploadsCom.py b/pyload/plugins/hoster/BillionuploadsCom.py index 305d840dc..b20ace0f1 100644 --- a/pyload/plugins/hoster/BillionuploadsCom.py +++ b/pyload/plugins/hoster/BillionuploadsCom.py @@ -1,23 +1,24 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class BillionuploadsCom(XFSPHoster): - __name__ = "BillionuploadsCom" - __type__ = "hoster" - __version__ = "0.01" +class BillionuploadsCom(XFSHoster): + __name__ = "BillionuploadsCom" + __type__ = "hoster" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?billionuploads\.com/\w{12}' __description__ = """Billionuploads.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_NAME = "billionuploads.com" + HOSTER_DOMAIN = "billionuploads.com" - FILE_NAME_PATTERN = r'<td class="dofir" title="(?P<N>.+?)"' - FILE_SIZE_PATTERN = r'<td class="dofir">(?P<S>[\d.]+) (?P<U>\w+)' + NAME_PATTERN = r'<td class="dofir" title="(?P<N>.+?)"' + SIZE_PATTERN = r'<td class="dofir">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' getInfo = create_getInfo(BillionuploadsCom) diff --git a/pyload/plugins/hoster/BitshareCom.py b/pyload/plugins/hoster/BitshareCom.py index 552601d21..bb9230fd5 100644 --- a/pyload/plugins/hoster/BitshareCom.py +++ b/pyload/plugins/hoster/BitshareCom.py @@ -9,23 +9,24 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): - __name__ = "BitshareCom" - __type__ = "hoster" - __version__ = "0.50" + __name__ = "BitshareCom" + __type__ = "hoster" + __version__ = "0.51" - __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P<id1>[a-zA-Z0-9]+)(/(?P<name>.*?)\.html)?|\?f=(?P<id2>[a-zA-Z0-9]+))' + __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P<id1>\w+)(/(?P<name>.*?)\.html)?|\?f=(?P<id2>\w+))' __description__ = """Bitshare.com hoster plugin""" - __authors__ = [("Paul King", None), - ("fragonib", "fragonib[AT]yahoo[DOT]es")] + __license__ = "GPLv3" + __authors__ = [("Paul King", None), + ("fragonib", "fragonib[AT]yahoo[DOT]es")] - FILE_INFO_PATTERN = r'Downloading (?P<N>.+) - (?P<S>[\d.]+) (?P<U>\w+)</h1>' + INFO_PATTERN = r'Downloading (?P<N>.+) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)</h1>' OFFLINE_PATTERN = r'(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)' COOKIES = [(".bitshare.com", "language_selection", "EN")] - FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' + AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' TRAFFIC_USED_UP = r'Your Traffic is used up for today. Upgrade to premium to continue!' @@ -54,24 +55,23 @@ class BitshareCom(SimpleHoster): # Check Traffic used up if re.search(self.TRAFFIC_USED_UP, self.html): - self.logInfo("Your Traffic is used up for today") + self.logInfo(_("Your Traffic is used up for today")) self.wait(30 * 60, True) self.retry() # File name m = re.match(self.__pattern__, pyfile.url) name1 = m.group('name') if m else None - m = re.search(self.FILE_INFO_PATTERN, self.html) + m = re.search(self.INFO_PATTERN, self.html) name2 = m.group('N') if m else None pyfile.name = max(name1, name2) # Ajax file id - self.ajaxid = re.search(self.FILE_AJAXID_PATTERN, self.html).group(1) + self.ajaxid = re.search(self.AJAXID_PATTERN, self.html).group(1) self.logDebug("File ajax id is [%s]" % self.ajaxid) # This may either download our file or forward us to an error page url = self.getDownloadUrl() - self.logDebug("Downloading file with url [%s]" % url) self.download(url) check = self.checkDownload({"404": ">404 Not Found<", "Error": ">Error occured<"}) @@ -90,10 +90,10 @@ class BitshareCom(SimpleHoster): # Get download info self.logDebug("Getting download info") - response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", - post={"request": "generateID", "ajaxid": self.ajaxid}) - self.handleErrors(response, ':') - parts = response.split(":") + res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", + post={"request": "generateID", "ajaxid": self.ajaxid}) + self.handleErrors(res, ':') + parts = res.split(":") filetype = parts[0] wait = int(parts[1]) captcha = int(parts[2]) @@ -112,47 +112,43 @@ class BitshareCom(SimpleHoster): if captcha == 1: self.logDebug("File is captcha protected") recaptcha = ReCaptcha(self) - captcha_key = recaptcha.detect_key() - if captcha_key is None: - self.parseError("ReCaptcha captcha key not found") # Try up to 3 times for i in xrange(3): - self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (captcha_key, i + 1)) - challenge, code = recaptcha.challenge(captcha_key) - response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", + challenge, code = recaptcha.challenge() + res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request": "validateCaptcha", "ajaxid": self.ajaxid, "recaptcha_challenge_field": challenge, "recaptcha_response_field": code}) - if self.handleCaptchaErrors(response): + if self.handleCaptchaErrors(res): break # Get download URL self.logDebug("Getting download url") - response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", - post={"request": "getDownloadURL", "ajaxid": self.ajaxid}) - self.handleErrors(response, '#') - url = response.split("#")[-1] + res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", + post={"request": "getDownloadURL", "ajaxid": self.ajaxid}) + self.handleErrors(res, '#') + url = res.split("#")[-1] return url - def handleErrors(self, response, separator): - self.logDebug("Checking response [%s]" % response) - if "ERROR:Session timed out" in response: + def handleErrors(self, res, separator): + self.logDebug("Checking response [%s]" % res) + if "ERROR:Session timed out" in res: self.retry() - elif "ERROR" in response: - msg = response.split(separator)[-1] + elif "ERROR" in res: + msg = res.split(separator)[-1] self.fail(msg) - def handleCaptchaErrors(self, response): - self.logDebug("Result of captcha resolving [%s]" % response) - if "SUCCESS" in response: + def handleCaptchaErrors(self, res): + self.logDebug("Result of captcha resolving [%s]" % res) + if "SUCCESS" in res: self.correctCaptcha() return True - elif "ERROR:SESSION ERROR" in response: + elif "ERROR:SESSION ERROR" in res: self.retry() - self.logDebug("Wrong captcha") + self.invalidCaptcha() diff --git a/pyload/plugins/hoster/BoltsharingCom.py b/pyload/plugins/hoster/BoltsharingCom.py index daebe6a3d..4726fc769 100644 --- a/pyload/plugins/hoster/BoltsharingCom.py +++ b/pyload/plugins/hoster/BoltsharingCom.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class BoltsharingCom(DeadHoster): - __name__ = "BoltsharingCom" - __type__ = "hoster" + __name__ = "BoltsharingCom" + __type__ = "hoster" __version__ = "0.02" - __pattern__ = r'http://(?:www\.)?boltsharing.com/\w{12}' + __pattern__ = r'http://(?:www\.)?boltsharing\.com/\w{12}' __description__ = """Boltsharing.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] getInfo = create_getInfo(BoltsharingCom) diff --git a/pyload/plugins/hoster/CatShareNet.py b/pyload/plugins/hoster/CatShareNet.py index 39f25113a..c6600f4b4 100644 --- a/pyload/plugins/hoster/CatShareNet.py +++ b/pyload/plugins/hoster/CatShareNet.py @@ -7,24 +7,25 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CatShareNet(SimpleHoster): - __name__ = "CatShareNet" - __type__ = "hoster" - __version__ = "0.06" + __name__ = "CatShareNet" + __type__ = "hoster" + __version__ = "0.08" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}' __description__ = """CatShare.net hoster plugin""" - __authors__ = [("z00nx", "z00nx0@gmail.com"), - ("prOq", None), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("z00nx", "z00nx0@gmail.com"), + ("prOq", None), + ("Walter Purcaro", "vuolter@gmail.com")] TEXT_ENCODING = True - FILE_INFO_PATTERN = r'<title>(?P<N>.+) \((?P<S>[\d.]+) (?P<U>\w+)\)<' - OFFLINE_PATTERN = r'Podany plik zostaÅ usuniÄty\s*</div>' + INFO_PATTERN = r'<title>(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)<' + OFFLINE_PATTERN = ur'Podany plik zostaÅ usuniÄty\s*</div>' - IP_BLOCKED_PATTERN = r'>Nasz serwis wykryÅ ÅŒe Twój adres IP nie pochodzi z Polski.<' + IP_BLOCKED_PATTERN = ur'>Nasz serwis wykryÅ ÅŒe Twój adres IP nie pochodzi z Polski.<' SECONDS_PATTERN = 'var\scount\s=\s(\d+);' LINK_PATTERN = r'<form action="(.+?)" method="GET">' @@ -37,7 +38,7 @@ class CatShareNet(SimpleHoster): def getFileInfo(self): m = re.search(self.IP_BLOCKED_PATTERN, self.html) if m: - self.fail("Only connections from Polish IP address are allowed") + self.fail(_("Only connections from Polish IP address are allowed")) return super(CatShareNet, self).getFileInfo() @@ -49,11 +50,7 @@ class CatShareNet(SimpleHoster): recaptcha = ReCaptcha(self) - captcha_key = recaptcha.detect_key() - if captcha_key is None: - self.parseError("ReCaptcha key not found") - - challenge, code = recaptcha.challenge(captcha_key) + challenge, code = recaptcha.challenge() self.html = self.load(self.pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field': code}) @@ -61,7 +58,7 @@ class CatShareNet(SimpleHoster): m = re.search(self.LINK_PATTERN, self.html) if m is None: self.invalidCaptcha() - self.retry(reason="Wrong captcha entered") + self.retry(reason=_("Wrong captcha entered")) dl_link = m.group(1) self.download(dl_link, disposition=True) diff --git a/pyload/plugins/hoster/CloudzerNet.py b/pyload/plugins/hoster/CloudzerNet.py index 719b8fa50..ce16f6fce 100644 --- a/pyload/plugins/hoster/CloudzerNet.py +++ b/pyload/plugins/hoster/CloudzerNet.py @@ -4,16 +4,17 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class CloudzerNet(DeadHoster): - __name__ = "CloudzerNet" - __type__ = "hoster" + __name__ = "CloudzerNet" + __type__ = "hoster" __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?(cloudzer\.net/file/|clz\.to/(file/)?)\w+' __description__ = """Cloudzer.net hoster plugin""" - __authors__ = [("gs", "I-_-I-_-I@web.de"), - ("z00nx", "z00nx0@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("gs", "I-_-I-_-I@web.de"), + ("z00nx", "z00nx0@gmail.com"), + ("stickell", "l.stickell@yahoo.it")] getInfo = create_getInfo(CloudzerNet) diff --git a/pyload/plugins/hoster/CramitIn.py b/pyload/plugins/hoster/CramitIn.py index e0a42611f..4f1ad1ff1 100644 --- a/pyload/plugins/hoster/CramitIn.py +++ b/pyload/plugins/hoster/CramitIn.py @@ -1,23 +1,24 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class CramitIn(XFSPHoster): - __name__ = "CramitIn" - __type__ = "hoster" - __version__ = "0.04" +class CramitIn(XFSHoster): + __name__ = "CramitIn" + __type__ = "hoster" + __version__ = "0.07" __pattern__ = r'http://(?:www\.)?cramit\.in/\w{12}' __description__ = """Cramit.in hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_NAME = "cramit.in" + HOSTER_DOMAIN = "cramit.in" - FILE_INFO_PATTERN = r'<span class=t2>\s*(?P<N>.*?)</span>.*?<small>\s*\((?P<S>.*?)\)' - LINK_PATTERN = r'href="(http://cramit.in/file_download/.*?)"' + INFO_PATTERN = r'<span class=t2>\s*(?P<N>.*?)</span>.*?<small>\s*\((?P<S>.*?)\)' + LINK_PATTERN = r'href="(http://cramit\.in/file_download/.*?)"' getInfo = create_getInfo(CramitIn) diff --git a/pyload/plugins/hoster/CrockoCom.py b/pyload/plugins/hoster/CrockoCom.py index 81566e10c..012fb7f0b 100644 --- a/pyload/plugins/hoster/CrockoCom.py +++ b/pyload/plugins/hoster/CrockoCom.py @@ -7,34 +7,35 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CrockoCom(SimpleHoster): - __name__ = "CrockoCom" - __type__ = "hoster" - __version__ = "0.16" + __name__ = "CrockoCom" + __type__ = "hoster" + __version__ = "0.17" - __pattern__ = r'http://(?:www\.)?(crocko|easy-share).com/\w+' + __pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+' __description__ = """Crocko hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<span class="fz24">Download:\s*<strong>(?P<N>.*)' - FILE_SIZE_PATTERN = r'<span class="tip1"><span class="inner">(?P<S>[^<]+)</span></span>' - OFFLINE_PATTERN = r"<h1>Sorry,<br />the page you're looking for <br />isn't here.</h1>|File not found" + NAME_PATTERN = r'<span class="fz24">Download:\s*<strong>(?P<N>.*)' + SIZE_PATTERN = r'<span class="tip1"><span class="inner">(?P<S>[^<]+)</span></span>' + OFFLINE_PATTERN = r'<h1>Sorry,<br />the page you\'re looking for <br />isn\'t here.</h1>|File not found' - CAPTCHA_URL_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';") + CAPTCHA_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';") FORM_PATTERN = r'<form method="post" action="([^"]+)">(.*?)</form>' FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>' - FILE_NAME_REPLACEMENTS = [(r'<[^>]*>', '')] + NAME_REPLACEMENTS = [(r'<[^>]*>', '')] def handleFree(self): if "You need Premium membership to download this file." in self.html: - self.fail("You need Premium membership to download this file.") + self.fail(_("You need Premium membership to download this file")) - for _ in xrange(5): - m = re.search(self.CAPTCHA_URL_PATTERN, self.html) + for _i in xrange(5): + m = re.search(self.CAPTCHA_PATTERN, self.html) if m: url, wait_time = 'http://crocko.com' + m.group(1), m.group(2) self.wait(wait_time) @@ -42,19 +43,16 @@ class CrockoCom(SimpleHoster): else: break - recaptcha = ReCaptcha(self) - captcha_key = recaptcha.detect_key() - if captcha_key is None: - self.parseError("ReCaptcha captcha key not found") - - m = re.search(self.FORM_PATTERN, self.html, re.DOTALL) + m = re.search(self.FORM_PATTERN, self.html, re.S) if m is None: - self.parseError('ACTION') + self.error(_("FORM_PATTERN not found")) + action, form = m.groups() inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) + recaptcha = ReCaptcha(self) - for _ in xrange(5): - inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key) + for _i in xrange(5): + inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge() self.download(action, post=inputs) check = self.checkDownload({ @@ -66,7 +64,7 @@ class CrockoCom(SimpleHoster): else: break else: - self.fail('No valid captcha solution received') + self.fail(_("No valid captcha solution received")) getInfo = create_getInfo(CrockoCom) diff --git a/pyload/plugins/hoster/CyberlockerCh.py b/pyload/plugins/hoster/CyberlockerCh.py index a03cc72b0..48109101d 100644 --- a/pyload/plugins/hoster/CyberlockerCh.py +++ b/pyload/plugins/hoster/CyberlockerCh.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class CyberlockerCh(DeadHoster): - __name__ = "CyberlockerCh" - __type__ = "hoster" + __name__ = "CyberlockerCh" + __type__ = "hoster" __version__ = "0.02" __pattern__ = r'http://(?:www\.)?cyberlocker\.ch/\w+' __description__ = """Cyberlocker.ch hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] getInfo = create_getInfo(CyberlockerCh) diff --git a/pyload/plugins/hoster/CzshareCom.py b/pyload/plugins/hoster/CzshareCom.py index b39cefd70..92a38f49d 100644 --- a/pyload/plugins/hoster/CzshareCom.py +++ b/pyload/plugins/hoster/CzshareCom.py @@ -10,31 +10,32 @@ from pyload.utils import parseFileSize class CzshareCom(SimpleHoster): - __name__ = "CzshareCom" - __type__ = "hoster" - __version__ = "0.94" + __name__ = "CzshareCom" + __type__ = "hoster" + __version__ = "0.95" - __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download.php\?).*' + __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).*' __description__ = """CZshare.com hoster plugin, now Sdilej.cz""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=[^>]*>(?P<N>[^<]+)</a>' - FILE_SIZE_PATTERN = r'<div class="tab" id="category">(?:\s*<p>[^\n]*</p>)*\s*Velikost:\s*(?P<S>[0-9., ]+)(?P<U>[kKMG])i?B\s*</div>' + NAME_PATTERN = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=[^>]*>(?P<N>[^<]+)</a>' + SIZE_PATTERN = r'<div class="tab" id="category">(?:\s*<p>[^\n]*</p>)*\s*Velikost:\s*(?P<S>[\d .,]+)(?P<U>[\w^_]+)\s*</div>' OFFLINE_PATTERN = r'<div class="header clearfix">\s*<h2 class="red">' - FILE_SIZE_REPLACEMENTS = [(' ', '')] - FILE_URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')] + SIZE_REPLACEMENTS = [(' ', '')] + URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')] FORCE_CHECK_TRAFFIC = True FREE_URL_PATTERN = r'<a href="([^"]+)" class="page-download">[^>]*alt="([^"]+)" /></a>' - FREE_FORM_PATTERN = r'<form action="download.php" method="post">\s*<img src="captcha.php" id="captcha" />(.*?)</form>' - PREMIUM_FORM_PATTERN = r'<form action="/profi_down.php" method="post">(.*?)</form>' + FREE_FORM_PATTERN = r'<form action="download\.php" method="post">\s*<img src="captcha\.php" id="captcha" />(.*?)</form>' + PREMIUM_FORM_PATTERN = r'<form action="/profi_down\.php" method="post">(.*?)</form>' FORM_INPUT_PATTERN = r'<input[^>]* name="([^"]+)" value="([^"]+)"[^>]*/>' - MULTIDL_PATTERN = r"<p><font color='red'>Z[^<]*PROFI.</font></p>" - USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([0-9., ]+)([kKMG]i?B)</strong>\s*</div><!-- .credit -->' + MULTIDL_PATTERN = r'<p><font color=\'red\'>Z[^<]*PROFI.</font></p>' + USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->' def checkTrafficLeft(self): @@ -50,35 +51,37 @@ class CzshareCom(SimpleHoster): # check user credit try: credit = parseFileSize(m.group(1).replace(' ', ''), m.group(2)) - self.logInfo("Premium download for %i KiB of Credit" % (self.pyfile.size / 1024)) - self.logInfo("User %s has %i KiB left" % (self.user, credit / 1024)) + self.logInfo(_("Premium download for %i KiB of Credit") % (self.pyfile.size / 1024)) + self.logInfo(_("User %s has %i KiB left") % (self.user, credit / 1024)) if credit < self.pyfile.size: - self.logInfo("Not enough credit to download file %s" % self.pyfile.name) + self.logInfo(_("Not enough credit to download file: %s") % self.pyfile.name) return False except Exception, e: # let's continue and see what happens... - self.logError("Parse error (CREDIT): %s" % e) + self.logError(e) return True + def handlePremium(self): # parse download link try: - form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.DOTALL).group(1) + form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) except Exception, e: - self.logError("Parse error (FORM): %s" % e) + self.logError(e) self.resetAccount() # download the file, destination is determined by pyLoad self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True) self.checkDownloadedFile() + def handleFree(self): # get free url m = re.search(self.FREE_URL_PATTERN, self.html) if m is None: - self.parseError('Free URL') + self.error(_("FREE_URL_PATTERN not found")) parsed_url = "http://sdilej.cz" + m.group(1) self.logDebug("PARSED_URL:" + parsed_url) @@ -88,16 +91,16 @@ class CzshareCom(SimpleHoster): self.longWait(5 * 60, 12) try: - form = re.search(self.FREE_FORM_PATTERN, self.html, re.DOTALL).group(1) + form = re.search(self.FREE_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) self.pyfile.size = int(inputs['size']) except Exception, e: self.logError(e) - self.parseError('Form') + self.error(_("Form")) # get and decrypt captcha captcha_url = 'http://sdilej.cz/captcha.php' - for _ in xrange(5): + for _i in xrange(5): inputs['captchastring2'] = self.decryptCaptcha(captcha_url) self.html = self.load(parsed_url, cookies=True, post=inputs, decode=True) if u"<li>ZadanÃœ ovÄÅovacà kód nesouhlasÃ!</li>" in self.html: @@ -108,7 +111,7 @@ class CzshareCom(SimpleHoster): self.correctCaptcha() break else: - self.fail("No valid captcha code entered") + self.fail(_("No valid captcha code entered")) m = re.search("countdown_number = (\d+);", self.html) self.setWait(int(m.group(1)) if m else 50) @@ -117,7 +120,7 @@ class CzshareCom(SimpleHoster): self.logDebug("WAIT URL", self.req.lastEffectiveURL) m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) if m is None: - self.parseError('Download URL') + self.error(_("Download URL not found")) url = "http://%s/download.php?%s" % (m.group(1), m.group(2)) @@ -125,6 +128,7 @@ class CzshareCom(SimpleHoster): self.download(url) self.checkDownloadedFile() + def checkDownloadedFile(self): # check download check = self.checkDownload({ @@ -135,7 +139,7 @@ class CzshareCom(SimpleHoster): }) if check == "temp_offline": - self.fail("File not available - try later") + self.fail(_("File not available - try later")) if check == "credit": self.resetAccount() elif check == "multi_dl": diff --git a/pyload/plugins/hoster/DailymotionCom.py b/pyload/plugins/hoster/DailymotionCom.py index 11b0ac583..4fb0b2222 100644 --- a/pyload/plugins/hoster/DailymotionCom.py +++ b/pyload/plugins/hoster/DailymotionCom.py @@ -39,20 +39,22 @@ def getInfo(urls): class DailymotionCom(Hoster): - __name__ = "DailymotionCom" - __type__ = "hoster" + __name__ = "DailymotionCom" + __type__ = "hoster" __version__ = "0.2" __pattern__ = r'https?://(?:www\.)?dailymotion\.com/.*?video/(?P<ID>[\w^_]+)' __config__ = [("quality", "Lowest;LD 144p;LD 240p;SD 384p;HQ 480p;HD 720p;HD 1080p;Highest", "Quality", "Highest")] __description__ = """Dailymotion.com hoster plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] def setup(self): self.resumeDownload = self.multiDL = True + def getStreams(self): streams = [] for result in re.finditer(r"\"(?P<URL>http:\\/\\/www.dailymotion.com\\/cdn\\/H264-(?P<QF>.*?)\\.*?)\"", @@ -64,6 +66,7 @@ class DailymotionCom(Hoster): streams.append((quality, link)) return sorted(streams, key=lambda x: x[0][::-1]) + def getQuality(self): q = self.getConfig("quality") if q == "Lowest": @@ -74,6 +77,7 @@ class DailymotionCom(Hoster): quality = int(q.rsplit(" ")[1][:-1]) return quality + def getLink(self, streams, quality): if quality > 0: for x, s in reversed([item for item in enumerate(streams)]): @@ -87,9 +91,10 @@ class DailymotionCom(Hoster): idx = quality s = streams[idx] - self.logInfo("Download video quality %sx%s" % s[0]) + self.logInfo(_("Download video quality %sx%s") % s[0]) return s[1] + def checkInfo(self, pyfile): pyfile.name, pyfile.size, pyfile.status, pyfile.url = getInfo([pyfile.url])[0] if pyfile.status == 1: @@ -97,6 +102,7 @@ class DailymotionCom(Hoster): elif pyfile.status == 6: self.tempOffline() + def process(self, pyfile): self.checkInfo(pyfile) diff --git a/pyload/plugins/hoster/DataHu.py b/pyload/plugins/hoster/DataHu.py index cacc1cae8..adadbfe5d 100644 --- a/pyload/plugins/hoster/DataHu.py +++ b/pyload/plugins/hoster/DataHu.py @@ -9,32 +9,35 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataHu(SimpleHoster): - __name__ = "DataHu" - __type__ = "hoster" - __version__ = "0.01" + __name__ = "DataHu" + __type__ = "hoster" + __version__ = "0.02" - __pattern__ = r'http://(?:www\.)?data.hu/get/\w+' + __pattern__ = r'http://(?:www\.)?data\.hu/get/\w+' __description__ = """Data.hu hoster plugin""" - __authors__ = [("crash", None), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("crash", None), + ("stickell", "l.stickell@yahoo.it")] - FILE_INFO_PATTERN = ur'<title>(?P<N>.*) \((?P<S>[^)]+)\) let\xf6lt\xe9se</title>' + INFO_PATTERN = ur'<title>(?P<N>.*) \((?P<S>[^)]+)\) let\xf6lt\xe9se</title>' OFFLINE_PATTERN = ur'Az adott f\xe1jl nem l\xe9tezik' LINK_PATTERN = r'<div class="download_box_button"><a href="([^"]+)">' - def handleFree(self): + def setup(self): self.resumeDownload = True - self.html = self.load(self.pyfile.url, decode=True) + self.multiDL = self.premium + + def handleFree(self): m = re.search(self.LINK_PATTERN, self.html) if m: url = m.group(1) self.logDebug("Direct link: " + url) else: - self.parseError('Unable to get direct link') + self.error(_("LINK_PATTERN not found")) self.download(url, disposition=True) diff --git a/pyload/plugins/hoster/DataportCz.py b/pyload/plugins/hoster/DataportCz.py index be3cb1498..174bd04af 100644 --- a/pyload/plugins/hoster/DataportCz.py +++ b/pyload/plugins/hoster/DataportCz.py @@ -4,46 +4,47 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataportCz(SimpleHoster): - __name__ = "DataportCz" - __type__ = "hoster" - __version__ = "0.37" + __name__ = "DataportCz" + __type__ = "hoster" + __version__ = "0.39" - __pattern__ = r'http://(?:www\.)?dataport.cz/file/(.*)' + __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.*)' __description__ = """Dataport.cz hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<span itemprop="name">(?P<N>[^<]+)</span>' - FILE_SIZE_PATTERN = r'<td class="fil">Velikost</td>\s*<td>(?P<S>[^<]+)</td>' + NAME_PATTERN = r'<span itemprop="name">(?P<N>[^<]+)</span>' + SIZE_PATTERN = r'<td class="fil">Velikost</td>\s*<td>(?P<S>[^<]+)</td>' OFFLINE_PATTERN = r'<h2>Soubor nebyl nalezen</h2>' - FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.dataport.cz/file/\1')] + URL_REPLACEMENTS = [(__pattern__, r'http://www.dataport.cz/file/\1')] - CAPTCHA_URL_PATTERN = r'<section id="captcha_bg">\s*<img src="(.*?)"' + CAPTCHA_PATTERN = r'<section id="captcha_bg">\s*<img src="(.*?)"' FREE_SLOTS_PATTERN = ur'PoÄet volnÃœch slotů: <span class="darkblue">(\d+)</span><br />' def handleFree(self): captchas = {"1": "jkeG", "2": "hMJQ", "3": "vmEK", "4": "ePQM", "5": "blBd"} - for _ in xrange(60): + for _i in xrange(60): action, inputs = self.parseHtmlForm('free_download_form') self.logDebug(action, inputs) if not action or not inputs: - self.parseError('free_download_form') + self.error(_("free_download_form")) if "captchaId" in inputs and inputs['captchaId'] in captchas: inputs['captchaCode'] = captchas[inputs['captchaId']] else: - self.parseError('captcha') + self.error(_("captcha")) self.html = self.download("http://www.dataport.cz%s" % action, post=inputs) check = self.checkDownload({"captcha": 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', "slot": 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) if check == "captcha": - self.parseError('invalid captcha') + self.error(_("invalid captcha")) elif check == "slot": self.logDebug("No free slots - wait 60s and retry") self.wait(60, False) @@ -53,4 +54,4 @@ class DataportCz(SimpleHoster): break -create_getInfo(DataportCz) +getInfo = create_getInfo(DataportCz) diff --git a/pyload/plugins/hoster/DateiTo.py b/pyload/plugins/hoster/DateiTo.py index 4a00f22aa..2f83960e6 100644 --- a/pyload/plugins/hoster/DateiTo.py +++ b/pyload/plugins/hoster/DateiTo.py @@ -7,18 +7,19 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DateiTo(SimpleHoster): - __name__ = "DateiTo" - __type__ = "hoster" - __version__ = "0.02" + __name__ = "DateiTo" + __type__ = "hoster" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html' __description__ = """Datei.to hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'Dateiname:</td>\s*<td colspan="2"><strong>(?P<N>.*?)</' - FILE_SIZE_PATTERN = r'Dateigröße:</td>\s*<td colspan="2">(?P<S>.*?)</' + NAME_PATTERN = r'Dateiname:</td>\s*<td colspan="2"><strong>(?P<N>.*?)</' + SIZE_PATTERN = r'Dateigröße:</td>\s*<td colspan="2">(?P<S>.*?)</' OFFLINE_PATTERN = r'>Datei wurde nicht gefunden<|>Bitte wÀhle deine Datei aus... <' PARALELL_PATTERN = r'>Du lÀdst bereits eine Datei herunter<' @@ -28,11 +29,10 @@ class DateiTo(SimpleHoster): def handleFree(self): url = 'http://datei.to/ajax/download.php' - data = {'P': 'I', 'ID': self.file_info['ID']} - + data = {'P': 'I', 'ID': self.info['ID']} recaptcha = ReCaptcha(self) - for _ in xrange(10): + for _i in xrange(10): self.logDebug("URL", url, "POST", data) self.html = self.load(url, post=data) self.checkErrors() @@ -46,38 +46,33 @@ class DateiTo(SimpleHoster): m = re.search(self.DATA_PATTERN, self.html) if m is None: - self.parseError('data') + self.error(_("data")) url = 'http://datei.to/' + m.group(1) data = dict(x.split('=') for x in m.group(2).split('&')) if url.endswith('recaptcha.php'): - captcha_key = recaptcha.detect_key() - if captcha_key is None: - self.parseError("ReCaptcha key not found") - - data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge(captcha_key) - + data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge() else: - self.fail('Too bad...') + self.fail(_("Too bad...")) download_url = self.html - self.logDebug("Download URL", download_url) self.download(download_url) + def checkErrors(self): m = re.search(self.PARALELL_PATTERN, self.html) if m: m = re.search(self.WAIT_PATTERN, self.html) wait_time = int(m.group(1)) if m else 30 - self.wait(wait_time + 1, False) - self.retry() + self.retry(wait_time=wait_time) + def doWait(self): m = re.search(self.WAIT_PATTERN, self.html) wait_time = int(m.group(1)) if m else 30 self.load('http://datei.to/ajax/download.php', post={'P': 'Ads'}) - self.wait(wait_time + 1, False) + self.wait(wait_time, False) getInfo = create_getInfo(DateiTo) diff --git a/pyload/plugins/hoster/DdlstorageCom.py b/pyload/plugins/hoster/DdlstorageCom.py index 2854dac13..4a46c4541 100644 --- a/pyload/plugins/hoster/DdlstorageCom.py +++ b/pyload/plugins/hoster/DdlstorageCom.py @@ -4,15 +4,16 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class DdlstorageCom(DeadHoster): - __name__ = "DdlstorageCom" - __type__ = "hoster" + __name__ = "DdlstorageCom" + __type__ = "hoster" __version__ = "1.02" __pattern__ = r'https?://(?:www\.)?ddlstorage\.com/\w+' __description__ = """DDLStorage.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] getInfo = create_getInfo(DdlstorageCom) diff --git a/pyload/plugins/hoster/DebridItaliaCom.py b/pyload/plugins/hoster/DebridItaliaCom.py index 439467cfb..1b6b1b030 100644 --- a/pyload/plugins/hoster/DebridItaliaCom.py +++ b/pyload/plugins/hoster/DebridItaliaCom.py @@ -6,26 +6,28 @@ from pyload.plugins.base.Hoster import Hoster class DebridItaliaCom(Hoster): - __name__ = "DebridItaliaCom" - __type__ = "hoster" + __name__ = "DebridItaliaCom" + __type__ = "hoster" __version__ = "0.05" __pattern__ = r'https?://(?:[^/]*\.)?debriditalia\.com' __description__ = """Debriditalia.com hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def setup(self): self.chunkLimit = -1 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "DebridItalia") - self.fail("No DebridItalia account provided") + self.fail(_("No DebridItalia account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) url = "http://debriditalia.com/linkgen2.php?xjxfun=convertiLink&xjxargs[]=S<![CDATA[%s]]>" % pyfile.url @@ -33,7 +35,7 @@ class DebridItaliaCom(Hoster): self.logDebug("XML data: %s" % page) if 'File not available' in page: - self.fail('File not available') + self.fail(_("File not available")) else: new_url = re.search(r'<a href="(?:[^"]+)">(?P<direct>[^<]+)</a>', page).group('direct') diff --git a/pyload/plugins/hoster/DepositfilesCom.py b/pyload/plugins/hoster/DepositfilesCom.py index b04aba261..b4fed5b52 100644 --- a/pyload/plugins/hoster/DepositfilesCom.py +++ b/pyload/plugins/hoster/DepositfilesCom.py @@ -9,25 +9,26 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DepositfilesCom(SimpleHoster): - __name__ = "DepositfilesCom" - __type__ = "hoster" - __version__ = "0.49" + __name__ = "DepositfilesCom" + __type__ = "hoster" + __version__ = "0.50" __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)' __description__ = """Depositfiles.com hoster plugin""" - __authors__ = [("spoob", "spoob@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] - FILE_NAME_PATTERN = r'<script type="text/javascript">eval\( unescape\(\'(?P<N>.*?)\'' - FILE_SIZE_PATTERN = r': <b>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</b>' + NAME_PATTERN = r'<script type="text/javascript">eval\( unescape\(\'(?P<N>.*?)\'' + SIZE_PATTERN = r': <b>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</b>' OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>' - FILE_NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))), + NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))), (r'.*<b title="(?P<N>[^"]+).*', "\g<N>")] - FILE_URL_REPLACEMENTS = [(__pattern__, "https://dfiles.eu/files/\g<ID>")] + URL_REPLACEMENTS = [(__pattern__, "https://dfiles.eu/files/\g<ID>")] COOKIES = [(".dfiles.eu", "lang_current", "en")] @@ -40,21 +41,20 @@ class DepositfilesCom(SimpleHoster): self.html = self.load(self.pyfile.url, post={"gateway_result": "1"}, cookies=True) if re.search(r'File is checked, please try again in a minute.', self.html) is not None: - self.logInfo("DepositFiles.com: The file is being checked. Waiting 1 minute.") - self.wait(61) - self.retry() + self.logInfo(_("The file is being checked. Waiting 1 minute")) + self.retry(wait_time=60) wait = re.search(r'html_download_api-limit_interval\">(\d+)</span>', self.html) if wait: wait_time = int(wait.group(1)) - self.logInfo("%s: Traffic used up. Waiting %d seconds." % (self.__name__, wait_time)) + self.logInfo(_("Traffic used up. Waiting %d seconds") % wait_time) self.wait(wait_time, True) self.retry() wait = re.search(r'>Try in (\d+) minutes or use GOLD account', self.html) if wait: wait_time = int(wait.group(1)) - self.logInfo("%s: All free slots occupied. Waiting %d minutes." % (self.__name__, wait_time)) + self.logInfo(_("All free slots occupied. Waiting %d minutes") % wait_time) self.setWait(wait_time * 60, False) wait = re.search(r'Please wait (\d+) sec', self.html) @@ -71,9 +71,9 @@ class DepositfilesCom(SimpleHoster): recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() if captcha_key is None: - self.parseError("ReCaptcha key not found") + self.error(_("ReCaptcha key not found")) - for _ in xrange(5): + for _i in xrange(5): self.html = self.load("https://dfiles.eu/get_file.php", get=params) if '<input type=button value="Continue" onclick="check_recaptcha' in self.html: @@ -91,20 +91,19 @@ class DepositfilesCom(SimpleHoster): self.logDebug("LINK: %s" % link) break else: - self.parseError('Download link') + self.error(_("Download link")) else: - self.fail('No valid captcha response received') + self.fail(_("No valid captcha response received")) try: self.download(link, disposition=True) except: self.retry(wait_time=60) - def handlePremium(self): - self.html = self.load(self.pyfile.url, cookies=self.COOKIES) + def handlePremium(self): if '<span class="html_download_api-gold_traffic_limit">' in self.html: - self.logWarning("Download limit reached") + self.logWarning(_("Download limit reached")) self.retry(25, 60 * 60, "Download limit reached") elif 'onClick="show_gold_offer' in self.html: self.account.relogin(self.user) @@ -117,7 +116,7 @@ class DepositfilesCom(SimpleHoster): elif mirror: dlink = mirror.group(1) else: - self.parseError("No direct download link or mirror found") + self.error(_("No direct download link or mirror found")) self.download(dlink, disposition=True) diff --git a/pyload/plugins/hoster/DlFreeFr.py b/pyload/plugins/hoster/DlFreeFr.py index 4440c5370..b06609298 100644 --- a/pyload/plugins/hoster/DlFreeFr.py +++ b/pyload/plugins/hoster/DlFreeFr.py @@ -14,6 +14,7 @@ class CustomBrowser(Browser): def __init__(self, bucket=None, options={}): Browser.__init__(self, bucket, options) + def load(self, *args, **kwargs): post = kwargs.get("post") @@ -36,8 +37,8 @@ class AdYouLike: """ Class to support adyoulike captcha service """ - ADYOULIKE_INPUT_PATTERN = r'Adyoulike.create\((.*?)\);' - ADYOULIKE_CALLBACK = r'Adyoulike.g._jsonp_5579316662423138' + ADYOULIKE_INPUT_PATTERN = r'Adyoulike\.create\((.*?)\);' + ADYOULIKE_CALLBACK = r'Adyoulike\.g\._jsonp_5579316662423138' ADYOULIKE_CHALLENGE_PATTERN = ADYOULIKE_CALLBACK + r'\((.*?)\)' @@ -110,21 +111,22 @@ class AdYouLike: class DlFreeFr(SimpleHoster): - __name__ = "DlFreeFr" - __type__ = "hoster" + __name__ = "DlFreeFr" + __type__ = "hoster" __version__ = "0.25" - __pattern__ = r'http://(?:www\.)?dl\.free\.fr/([a-zA-Z0-9]+|getfile\.pl\?file=/[a-zA-Z0-9]+)' + __pattern__ = r'http://(?:www\.)?dl\.free\.fr/(\w+|getfile\.pl\?file=/\w+)' __description__ = """Dl.free.fr hoster plugin""" - __authors__ = [("the-razer", "daniel_ AT gmx DOT net"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("Toilal", "toilal.dev@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("the-razer", "daniel_ AT gmx DOT net"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("Toilal", "toilal.dev@gmail.com")] - FILE_NAME_PATTERN = r'Fichier:</td>\s*<td[^>]*>(?P<N>[^>]*)</td>' - FILE_SIZE_PATTERN = r'Taille:</td>\s*<td[^>]*>(?P<S>[\d.]+[KMG])o' - OFFLINE_PATTERN = r"Erreur 404 - Document non trouv|Fichier inexistant|Le fichier demandé n'a pas été trouvé" + NAME_PATTERN = r'Fichier:</td>\s*<td[^>]*>(?P<N>[^>]*)</td>' + SIZE_PATTERN = r'Taille:</td>\s*<td[^>]*>(?P<S>[\d.,]+\w)o' + OFFLINE_PATTERN = r'Erreur 404 - Document non trouv|Fichier inexistant|Le fichier demandé n\'a pas été trouvé' def setup(self): @@ -139,11 +141,10 @@ class DlFreeFr(SimpleHoster): def process(self, pyfile): - pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS) + pyfile.url = replace_patterns(pyfile.url, self.URL_REPLACEMENTS) valid_url = pyfile.url headers = self.load(valid_url, just_header=True) - self.html = None if headers.get('code') == 302: valid_url = headers.get('location') headers = self.load(valid_url, just_header=True) @@ -160,7 +161,7 @@ class DlFreeFr(SimpleHoster): elif headers.get('code') == 404: self.offline() else: - self.fail("Invalid return code: " + str(headers.get('code'))) + self.fail(_("Invalid return code: ") + str(headers.get('code'))) def handleFree(self): @@ -179,12 +180,12 @@ class DlFreeFr(SimpleHoster): if m: cj.setCookie(m.group(4), m.group(1), m.group(2), m.group(3)) else: - self.fail("Cookie error") + self.fail(_("Cookie error")) location = headers.get("location") self.req.setCookieJar(cj) self.download(location, disposition=True) else: - self.fail("Invalid response") + self.fail(_("Invalid response")) def getLastHeaders(self): diff --git a/pyload/plugins/hoster/DuploadOrg.py b/pyload/plugins/hoster/DuploadOrg.py index 213fb717a..dae4c847e 100644 --- a/pyload/plugins/hoster/DuploadOrg.py +++ b/pyload/plugins/hoster/DuploadOrg.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class DuploadOrg(DeadHoster): - __name__ = "DuploadOrg" - __type__ = "hoster" + __name__ = "DuploadOrg" + __type__ = "hoster" __version__ = "0.02" __pattern__ = r'http://(?:www\.)?dupload\.org/\w{12}' __description__ = """Dupload.grg hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] getInfo = create_getInfo(DuploadOrg) diff --git a/pyload/plugins/hoster/EasybytezCom.py b/pyload/plugins/hoster/EasybytezCom.py index 3385d13ad..3103d403f 100644 --- a/pyload/plugins/hoster/EasybytezCom.py +++ b/pyload/plugins/hoster/EasybytezCom.py @@ -1,28 +1,27 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class EasybytezCom(XFSPHoster): - __name__ = "EasybytezCom" - __type__ = "hoster" - __version__ = "0.18" +class EasybytezCom(XFSHoster): + __name__ = "EasybytezCom" + __type__ = "hoster" + __version__ = "0.22" __pattern__ = r'http://(?:www\.)?easybytez\.com/\w{12}' __description__ = """Easybytez.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] - HOSTER_NAME = "easybytez.com" + HOSTER_DOMAIN = "easybytez.com" - FILE_INFO_PATTERN = r'<span class="name">(?P<N>.+)</span><br>\s*<span class="size">(?P<S>[^<]+)</span>' + INFO_PATTERN = r'<span class="name">(?P<N>.+)</span><br>\s*<span class="size">(?P<S>[^<]+)</span>' OFFLINE_PATTERN = r'>File not available' - LINK_PATTERN = r'(http://(\w+\.(easyload|easybytez|zingload)\.(com|to)|\d+\.\d+\.\d+\.\d+)/files/\d+/\w+/[^"<]+)' - OVR_LINK_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)' - ERROR_PATTERN = r'(?:class=["\']err["\'][^>]*>|<Center><b>)(.*?)</' + LINK_PATTERN = r'(http://(\w+\.(easybytez|easyload|ezbytez|zingload)\.(com|to)|\d+\.\d+\.\d+\.\d+)/files/\d+/\w+/.+?)["\'<]' getInfo = create_getInfo(EasybytezCom) diff --git a/pyload/plugins/hoster/EdiskCz.py b/pyload/plugins/hoster/EdiskCz.py index 132396c8c..3b256a89a 100644 --- a/pyload/plugins/hoster/EdiskCz.py +++ b/pyload/plugins/hoster/EdiskCz.py @@ -6,26 +6,28 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class EdiskCz(SimpleHoster): - __name__ = "EdiskCz" - __type__ = "hoster" - __version__ = "0.21" + __name__ = "EdiskCz" + __type__ = "hoster" + __version__ = "0.22" - __pattern__ = r'http://(?:www\.)?edisk.(cz|sk|eu)/(stahni|sk/stahni|en/download)/.*' + __pattern__ = r'http://(?:www\.)?edisk\.(cz|sk|eu)/(stahni|sk/stahni|en/download)/.*' __description__ = """Edisk.cz hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_INFO_PATTERN = r'<span class="fl" title="(?P<N>[^"]+)">\s*.*?\((?P<S>[0-9.]*) (?P<U>[kKMG])i?B\)</h1></span>' + INFO_PATTERN = r'<span class="fl" title="(?P<N>[^"]+)">\s*.*?\((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</h1></span>' OFFLINE_PATTERN = r'<h3>This file does not exist due to one of the following:</h3><ul><li>' ACTION_PATTERN = r'/en/download/(\d+/.*\.html)' - LINK_PATTERN = r'http://.*edisk.cz.*\.html' + LINK_PATTERN = r'http://.*edisk\.cz.*\.html' def setup(self): self.multiDL = False + def process(self, pyfile): url = re.sub("/(stahni|sk/stahni)/", "/en/download/", pyfile.url) @@ -33,7 +35,7 @@ class EdiskCz(SimpleHoster): m = re.search(self.ACTION_PATTERN, url) if m is None: - self.parseError("ACTION") + self.error(_("ACTION_PATTERN not found")) action = m.group(1) self.html = self.load(url, decode=True) @@ -46,7 +48,7 @@ class EdiskCz(SimpleHoster): }) if not re.match(self.LINK_PATTERN, url): - self.fail("Unexpected server response") + self.fail(_("Unexpected server response")) self.download(url) diff --git a/pyload/plugins/hoster/EgoFilesCom.py b/pyload/plugins/hoster/EgoFilesCom.py index 8ba7a8356..20176751a 100644 --- a/pyload/plugins/hoster/EgoFilesCom.py +++ b/pyload/plugins/hoster/EgoFilesCom.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class EgoFilesCom(DeadHoster): - __name__ = "EgoFilesCom" - __type__ = "hoster" + __name__ = "EgoFilesCom" + __type__ = "hoster" __version__ = "0.16" __pattern__ = r'https?://(?:www\.)?egofiles\.com/\w+' __description__ = """Egofiles.com hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] getInfo = create_getInfo(EgoFilesCom) diff --git a/pyload/plugins/hoster/EpicShareNet.py b/pyload/plugins/hoster/EpicShareNet.py index 75f35646e..a06b4f1dc 100644 --- a/pyload/plugins/hoster/EpicShareNet.py +++ b/pyload/plugins/hoster/EpicShareNet.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class EpicShareNet(DeadHoster): - __name__ = "EpicShareNet" - __type__ = "hoster" + __name__ = "EpicShareNet" + __type__ = "hoster" __version__ = "0.02" __pattern__ = r'https?://(?:www\.)?epicshare\.net/\w{12}' __description__ = """EpicShare.net hoster plugin""" - __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] + __license__ = "GPLv3" + __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] getInfo = create_getInfo(EpicShareNet) diff --git a/pyload/plugins/hoster/EuroshareEu.py b/pyload/plugins/hoster/EuroshareEu.py index d7d26240f..e170facca 100644 --- a/pyload/plugins/hoster/EuroshareEu.py +++ b/pyload/plugins/hoster/EuroshareEu.py @@ -6,34 +6,36 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class EuroshareEu(SimpleHoster): - __name__ = "EuroshareEu" - __type__ = "hoster" - __version__ = "0.25" + __name__ = "EuroshareEu" + __type__ = "hoster" + __version__ = "0.26" - __pattern__ = r'http://(?:www\.)?euroshare.(eu|sk|cz|hu|pl)/file/.*' + __pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.*' __description__ = """Euroshare.eu hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_INFO_PATTERN = r'<span style="float: left;"><strong>(?P<N>.+?)</strong> \((?P<S>.+?)\)</span>' + INFO_PATTERN = r'<span style="float: left;"><strong>(?P<N>.+?)</strong> \((?P<S>.+?)\)</span>' OFFLINE_PATTERN = ur'<h2>S.bor sa nena.iel</h2>|PoÅŸadovaná stránka neexistuje!' FREE_URL_PATTERN = r'<a href="(/file/\d+/[^/]*/download/)"><div class="downloadButton"' ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>|<p>Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' ERR_NOT_LOGGED_IN_PATTERN = r'href="/customer-zone/login/"' - FILE_URL_REPLACEMENTS = [(r"(http://[^/]*\.)(sk|cz|hu|pl)/", r"\1eu/")] + URL_REPLACEMENTS = [(r"(http://[^/]*\.)(sk|cz|hu|pl)/", r"\1eu/")] def setup(self): self.multiDL = self.resumeDownload = self.premium self.req.setOption("timeout", 120) + def handlePremium(self): if self.ERR_NOT_LOGGED_IN_PATTERN in self.html: self.account.relogin(self.user) - self.retry(reason="User not logged in") + self.retry(reason=_("User not logged in")) self.download(self.pyfile.url.rstrip('/') + "/download/") @@ -41,17 +43,18 @@ class EuroshareEu(SimpleHoster): "json": re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) if check == "login" or (check == "json" and self.lastCheck.group(1) == "Access token expired"): self.account.relogin(self.user) - self.retry(reason="Access token expired") + self.retry(reason=_("Access token expired")) elif check == "json": self.fail(self.lastCheck.group(1)) + def handleFree(self): if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: self.longWait(5 * 60, 12) m = re.search(self.FREE_URL_PATTERN, self.html) if m is None: - self.parseError("Parse error (URL)") + self.error(_("FREE_URL_PATTERN not found")) parsed_url = "http://euroshare.eu%s" % m.group(1) self.logDebug("URL", parsed_url) self.download(parsed_url, disposition=True) diff --git a/pyload/plugins/hoster/ExtabitCom.py b/pyload/plugins/hoster/ExtabitCom.py index ca5d934c1..6c0dbd185 100644 --- a/pyload/plugins/hoster/ExtabitCom.py +++ b/pyload/plugins/hoster/ExtabitCom.py @@ -10,67 +10,69 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ExtabitCom(SimpleHoster): - __name__ = "ExtabitCom" - __type__ = "hoster" - __version__ = "0.6" + __name__ = "ExtabitCom" + __type__ = "hoster" + __version__ = "0.62" __pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)' __description__ = """Extabit.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<th>File:</th>\s*<td class="col-fileinfo">\s*<div title="(?P<N>[^"]+)">' - FILE_SIZE_PATTERN = r'<th>Size:</th>\s*<td class="col-fileinfo">(?P<S>[^<]+)</td>' + NAME_PATTERN = r'<th>File:</th>\s*<td class="col-fileinfo">\s*<div title="(?P<N>[^"]+)">' + SIZE_PATTERN = r'<th>Size:</th>\s*<td class="col-fileinfo">(?P<S>[^<]+)</td>' OFFLINE_PATTERN = r'>File not found<' TEMP_OFFLINE_PATTERN = r'>(File is temporary unavailable|No download mirror)<' - LINK_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/[a-z0-9]+/.*?)[\'"]' + LINK_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/\w+/.*?)[\'"]' def handleFree(self): if r">Only premium users can download this file" in self.html: - self.fail("Only premium users can download this file") + self.fail(_("Only premium users can download this file")) m = re.search(r"Next free download from your ip will be available in <b>(\d+)\s*minutes", self.html) if m: self.wait(int(m.group(1)) * 60, True) elif "The daily downloads limit from your IP is exceeded" in self.html: - self.logWarning("You have reached your daily downloads limit for today") + self.logWarning(_("You have reached your daily downloads limit for today")) self.wait(secondsToMidnight(gmt=2), True) self.logDebug("URL: " + self.req.http.lastEffectiveURL) m = re.match(self.__pattern__, self.req.http.lastEffectiveURL) - fileID = m.group('ID') if m else self.file_info('ID') + fileID = m.group('ID') if m else self.info('ID') m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.html) if m: recaptcha = ReCaptcha(self) captcha_key = m.group(1) - for _ in xrange(5): + for _i in xrange(5): get_data = {"type": "recaptcha"} get_data['challenge'], get_data['capture'] = recaptcha.challenge(captcha_key) - response = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) - if "ok" in response: + res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) + if "ok" in res: self.correctCaptcha() break else: self.invalidCaptcha() else: - self.fail("Invalid captcha") + self.fail(_("Invalid captcha")) else: - self.parseError('Captcha') + self.error(_("Captcha")) - if not "href" in response: - self.parseError('JSON') + if not "href" in res: + self.error(_("Bad JSON response")) + + self.html = self.load("http://extabit.com/file/%s%s" % (fileID, res['href'])) - self.html = self.load("http://extabit.com/file/%s%s" % (fileID, response['href'])) m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError('Download URL') + self.error(_("LINK_PATTERN not found")) + url = m.group(1) - self.logDebug("Download URL: " + url) self.download(url) diff --git a/pyload/plugins/hoster/FastixRu.py b/pyload/plugins/hoster/FastixRu.py index f2ec1a10e..2e01dc216 100644 --- a/pyload/plugins/hoster/FastixRu.py +++ b/pyload/plugins/hoster/FastixRu.py @@ -10,14 +10,15 @@ from pyload.plugins.base.Hoster import Hoster class FastixRu(Hoster): - __name__ = "FastixRu" - __type__ = "hoster" + __name__ = "FastixRu" + __type__ = "hoster" __version__ = "0.04" - __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P<ID>[a-zA-Z0-9]{24})' + __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P<ID>\w{24})' __description__ = """Fastix hoster plugin""" - __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] + __license__ = "GPLv3" + __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] def getFilename(self, url): @@ -29,16 +30,18 @@ class FastixRu(Hoster): name += "%s.tmp" % randrange(100, 999) return name + def setup(self): self.chunkLimit = 3 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "Fastix") - self.fail("No Fastix account provided") + self.fail(_("No Fastix account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) api_key = self.account.getAccountData(self.user) @@ -65,6 +68,6 @@ class FastixRu(Hoster): "empty": re.compile(r"^$")}) if check == "error": - self.retry(wait_time=60, reason="An error occurred while generating link.") + self.retry(wait_time=60, reason=_("An error occurred while generating link")) elif check == "empty": - self.retry(wait_time=60, reason="Downloaded File was empty.") + self.retry(wait_time=60, reason=_("Downloaded File was empty")) diff --git a/pyload/plugins/hoster/FastshareCz.py b/pyload/plugins/hoster/FastshareCz.py index 666efffe3..c3364cea6 100644 --- a/pyload/plugins/hoster/FastshareCz.py +++ b/pyload/plugins/hoster/FastshareCz.py @@ -11,22 +11,23 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FastshareCz(SimpleHoster): - __name__ = "FastshareCz" - __type__ = "hoster" - __version__ = "0.22" + __name__ = "FastshareCz" + __type__ = "hoster" + __version__ = "0.23" __pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+' __description__ = """FastShare.cz hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] - FILE_INFO_PATTERN = r'<h1 class="dwp">(?P<N>[^<]+)</h1>\s*<div class="fileinfo">\s*Size\s*: (?P<S>\d+) (?P<U>\w+),' + INFO_PATTERN = r'<h1 class="dwp">(?P<N>[^<]+)</h1>\s*<div class="fileinfo">\s*Size\s*: (?P<S>\d+) (?P<U>[\w^_]+),' OFFLINE_PATTERN = r'>(The file has been deleted|Requested page not found)' - FILE_URL_REPLACEMENTS = [("#.*", "")] + URL_REPLACEMENTS = [("#.*", "")] COOKIES = [(".fastshare.cz", "lang", "en")] @@ -37,13 +38,13 @@ class FastshareCz(SimpleHoster): def handleFree(self): if "> 100% of FREE slots are full" in self.html: - self.retry(120, 60, "No free slots") + self.retry(12, 60, _("No free slots")) m = re.search(self.FREE_URL_PATTERN, self.html) if m: action, captcha_src = m.groups() else: - self.parseError("Free URL") + self.error(_("FREE_URL_PATTERN not found")) baseurl = "http://www.fastshare.cz" captcha = self.decryptCaptcha(urljoin(baseurl, captcha_src)) @@ -55,28 +56,24 @@ class FastshareCz(SimpleHoster): }) if check == "paralell_dl": - self.retry(6, 10 * 60, "Paralell download") + self.retry(6, 10 * 60, _("Paralell download")) elif check == "wrong_captcha": - self.retry(max_tries=5, reason="Wrong captcha") + self.retry(max_tries=5, reason=_("Wrong captcha")) + def handlePremium(self): header = self.load(self.pyfile.url, just_header=True) if "location" in header: url = header['location'] + elif self.CREDIT_PATTERN in self.html: + self.logWarning(_("Not enough traffic left")) + self.resetAccount() else: - self.html = self.load(self.pyfile.url) - - self.getFileInfo() # - - if self.CREDIT_PATTERN in self.html: - self.logWarning("Not enough traffic left") - self.resetAccount() + m = re.search(self.PREMIUM_URL_PATTERN, self.html) + if m: + url = m.group(1) else: - m = re.search(self.PREMIUM_URL_PATTERN, self.html) - if m: - url = m.group(1) - else: - self.parseError("Premium URL") + self.error(_("PREMIUM_URL_PATTERN not found")) self.logDebug("PREMIUM URL: " + url) self.download(url, disposition=True) diff --git a/pyload/plugins/hoster/File4safeCom.py b/pyload/plugins/hoster/File4safeCom.py deleted file mode 100644 index 319d2b9af..000000000 --- a/pyload/plugins/hoster/File4safeCom.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pycurl import FOLLOWLOCATION - -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo - - -class File4safeCom(XFSPHoster): - __name__ = "File4safeCom" - __type__ = "hoster" - __version__ = "0.02" - - __pattern__ = r'https?://(?:www\.)?file4safe\.com/\w{12}' - - __description__ = """File4safe.com hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - HOSTER_NAME = "file4safe.com" - - - def handlePremium(self): - self.req.http.lastURL = self.pyfile.url - - self.req.http.c.setopt(FOLLOWLOCATION, 0) - self.load(self.pyfile.url, post=self.getPostParameters(), decode=True) - self.header = self.req.http.header - self.req.http.c.setopt(FOLLOWLOCATION, 1) - - m = re.search(r"Location\s*:\s*(.*)", self.header, re.I) - if m and re.match(self.LINK_PATTERN, m.group(1)): - location = m.group(1).strip() - self.startDownload(location) - else: - self.parseError("Unable to detect premium download link") - - -getInfo = create_getInfo(File4safeCom) diff --git a/pyload/plugins/hoster/FileApeCom.py b/pyload/plugins/hoster/FileApeCom.py index 92c11e8cf..307e0df8d 100644 --- a/pyload/plugins/hoster/FileApeCom.py +++ b/pyload/plugins/hoster/FileApeCom.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class FileApeCom(DeadHoster): - __name__ = "FileApeCom" - __type__ = "hoster" + __name__ = "FileApeCom" + __type__ = "hoster" __version__ = "0.12" __pattern__ = r'http://(?:www\.)?fileape\.com/(index\.php\?act=download\&id=|dl/)\w+' __description__ = """FileApe.com hoster plugin""" - __authors__ = [("espes", None)] + __license__ = "GPLv3" + __authors__ = [("espes", None)] getInfo = create_getInfo(FileApeCom) diff --git a/pyload/plugins/hoster/FileParadoxIn.py b/pyload/plugins/hoster/FileParadoxIn.py index e5830602a..7ed0e9b7a 100644 --- a/pyload/plugins/hoster/FileParadoxIn.py +++ b/pyload/plugins/hoster/FileParadoxIn.py @@ -2,24 +2,24 @@ import re -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class FileParadoxIn(XFSPHoster): - __name__ = "FileParadoxIn" - __type__ = "hoster" - __version__ = "0.01" +class FileParadoxIn(XFSHoster): + __name__ = "FileParadoxIn" + __type__ = "hoster" + __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?fileparadox\.in/\w{12}' __description__ = """FileParadox.in hoster plugin""" - __authors__ = [("RazorWing", "muppetuk1@hotmail.com")] + __license__ = "GPLv3" + __authors__ = [("RazorWing", "muppetuk1@hotmail.com")] - HOSTER_NAME = "fileparadox.in" + HOSTER_DOMAIN = "fileparadox.in" - FILE_SIZE_PATTERN = r'</font>\s*\(\s*(?P<S>[^)]+)\s*\)</font>' - LINK_PATTERN = r'(http://([^/]*?fileparadox.in|\d+\.\d+\.\d+\.\d+)(:\d+/d/|/files/\w+/\w+/)[^"\'<]+)' + SIZE_PATTERN = r'</font>\s*\(\s*(?P<S>[^)]+)\s*\)</font>' getInfo = create_getInfo(FileParadoxIn) diff --git a/pyload/plugins/hoster/FileStoreTo.py b/pyload/plugins/hoster/FileStoreTo.py index 68e5ab2f6..f1425d3d6 100644 --- a/pyload/plugins/hoster/FileStoreTo.py +++ b/pyload/plugins/hoster/FileStoreTo.py @@ -6,29 +6,30 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileStoreTo(SimpleHoster): - __name__ = "FileStoreTo" - __type__ = "hoster" + __name__ = "FileStoreTo" + __type__ = "hoster" __version__ = "0.01" __pattern__ = r'http://(?:www\.)?filestore\.to/\?d=(?P<ID>\w+)' __description__ = """FileStore.to hoster plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com"), + ("stickell", "l.stickell@yahoo.it")] - FILE_INFO_PATTERN = r'File: <span[^>]*>(?P<N>.+)</span><br />Size: (?P<S>[\d,.]+) (?P<U>\w+)' + INFO_PATTERN = r'File: <span[^>]*>(?P<N>.+)</span><br />Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>Download-Datei wurde nicht gefunden<' def setup(self): self.resumeDownload = self.multiDL = True + def handleFree(self): self.wait(10) ldc = re.search(r'wert="(\w+)"', self.html).group(1) link = self.load("http://filestore.to/ajax/download.php", get={"LDC": ldc}) - self.logDebug("Download link = " + link) self.download(link) diff --git a/pyload/plugins/hoster/FilebeerInfo.py b/pyload/plugins/hoster/FilebeerInfo.py index f272e296d..dcc6d1513 100644 --- a/pyload/plugins/hoster/FilebeerInfo.py +++ b/pyload/plugins/hoster/FilebeerInfo.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class FilebeerInfo(DeadHoster): - __name__ = "FilebeerInfo" - __type__ = "hoster" + __name__ = "FilebeerInfo" + __type__ = "hoster" __version__ = "0.03" __pattern__ = r'http://(?:www\.)?filebeer\.info/(?!\d*~f)(?P<ID>\w+).*' __description__ = """Filebeer.info plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] getInfo = create_getInfo(FilebeerInfo) diff --git a/pyload/plugins/hoster/FilecloudIo.py b/pyload/plugins/hoster/FilecloudIo.py index c397a1a1a..7dc9a3a16 100644 --- a/pyload/plugins/hoster/FilecloudIo.py +++ b/pyload/plugins/hoster/FilecloudIo.py @@ -8,40 +8,42 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): - __name__ = "FilecloudIo" - __type__ = "hoster" - __version__ = "0.02" + __name__ = "FilecloudIo" + __type__ = "hoster" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+).*' __description__ = """Filecloud.io hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] - FILE_SIZE_PATTERN = r'{var __ab1 = (?P<S>\d+);}' - FILE_NAME_PATTERN = r'id="aliasSpan">(?P<N>.*?) <' - OFFLINE_PATTERN = r'l10n.(FILES__DOESNT_EXIST|REMOVED)' - TEMP_OFFLINE_PATTERN = r'l10n.FILES__WARNING' + SIZE_PATTERN = r'{var __ab1 = (?P<S>\d+);}' + NAME_PATTERN = r'id="aliasSpan">(?P<N>.*?) <' + OFFLINE_PATTERN = r'l10n\.(FILES__DOESNT_EXIST|REMOVED)' + TEMP_OFFLINE_PATTERN = r'l10n\.FILES__WARNING' - UKEY_PATTERN = r"'ukey'\s*:'(\w+)'," - AB1_PATTERN = r"if\( __ab1 == '(\w+)' \)" + UKEY_PATTERN = r'\'ukey\'\s*:\'(\w+)' + AB1_PATTERN = r'if\( __ab1 == \'(\w+)\' \)' ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);' - RECAPTCHA_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" + RECAPTCHA_PATTERN = r'var __recaptcha_public\s*=\s*\'(.+?)\';' - LINK_PATTERN = r'"(http://s\d+.filecloud.io/%s/\d+/.*?)"' + LINK_PATTERN = r'"(http://s\d+\.filecloud\.io/%s/\d+/.*?)"' def setup(self): self.resumeDownload = self.multiDL = True self.chunkLimit = 1 + def handleFree(self): - data = {"ukey": self.file_info['ID']} + data = {"ukey": self.info['ID']} m = re.search(self.AB1_PATTERN, self.html) if m is None: - self.parseError("__AB1") + self.error(_("__AB1")) data['__ab1'] = m.group(1) recaptcha = ReCaptcha(self) @@ -50,10 +52,10 @@ class FilecloudIo(SimpleHoster): captcha_key = m.group(1) if m else recaptcha.detect_key() if captcha_key is None: - self.parseError("ReCaptcha key not found") + self.error(_("ReCaptcha key not found")) if not self.account: - self.fail("User not logged in") + self.fail(_("User not logged in")) elif not self.account.logged_in: captcha_challenge, captcha_response = recaptcha.challenge(captcha_key) self.account.form_data = {"recaptcha_challenge_field": captcha_challenge, @@ -62,50 +64,52 @@ class FilecloudIo(SimpleHoster): self.retry(2) json_url = "http://filecloud.io/download-request.json" - response = self.load(json_url, post=data) - self.logDebug(response) - response = json_loads(response) + res = self.load(json_url, post=data) + self.logDebug(res) + res = json_loads(res) - if "error" in response and response['error']: - self.fail(response) + if "error" in res and res['error']: + self.fail(res) - self.logDebug(response) - if response['captcha']: + self.logDebug(res) + if res['captcha']: data['ctype'] = "recaptcha" - for _ in xrange(5): + for _i in xrange(5): data['recaptcha_challenge'], data['recaptcha_response'] = recaptcha.challenge(captcha_key) json_url = "http://filecloud.io/download-request.json" - response = self.load(json_url, post=data) - self.logDebug(response) - response = json_loads(response) + res = self.load(json_url, post=data) + self.logDebug(res) + res = json_loads(res) - if "retry" in response and response['retry']: + if "retry" in res and res['retry']: self.invalidCaptcha() else: self.correctCaptcha() break else: - self.fail("Incorrect captcha") + self.fail(_("Incorrect captcha")) - if response['dl']: + if res['dl']: self.html = self.load('http://filecloud.io/download.html') - m = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) + + m = re.search(self.LINK_PATTERN % self.info['ID'], self.html) if m is None: - self.parseError("Download URL") - download_url = m.group(1) - self.logDebug("Download URL: %s" % download_url) + self.error(_("LINK_PATTERN not found")) - if "size" in self.file_info and self.file_info['size']: - self.check_data = {"size": int(self.file_info['size'])} + if "size" in self.info and self.info['size']: + self.check_data = {"size": int(self.info['size'])} + + download_url = m.group(1) self.download(download_url) else: - self.fail("Unexpected server response") + self.fail(_("Unexpected server response")) + def handlePremium(self): akey = self.account.getAccountData(self.user)['akey'] - ukey = self.file_info['ID'] + ukey = self.info['ID'] self.logDebug("Akey: %s | Ukey: %s" % (akey, ukey)) rep = self.load("http://api.filecloud.io/api-fetch_download_url.api", post={"akey": akey, "ukey": ukey}) diff --git a/pyload/plugins/hoster/FilefactoryCom.py b/pyload/plugins/hoster/FilefactoryCom.py index e5f1c0653..0e652ba50 100644 --- a/pyload/plugins/hoster/FilefactoryCom.py +++ b/pyload/plugins/hoster/FilefactoryCom.py @@ -2,6 +2,8 @@ import re +from urlparse import urljoin + from pyload.network.RequestFactory import getURL from pyload.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo @@ -10,97 +12,79 @@ def getInfo(urls): for url in urls: h = getURL(url, just_header=True) m = re.search(r'Location: (.+)\r\n', h) - if m and not re.match(m.group(1), FilefactoryCom.__pattern__): # It's a direct link! Skipping + if m and not re.match(m.group(1), FilefactoryCom.__pattern__): #: It's a direct link! Skipping yield (url, 0, 3, url) - else: # It's a standard html page - file_info = parseFileInfo(FilefactoryCom, url, getURL(url)) - yield file_info + else: #: It's a standard html page + yield parseFileInfo(FilefactoryCom, url, getURL(url)) class FilefactoryCom(SimpleHoster): - __name__ = "FilefactoryCom" - __type__ = "hoster" - __version__ = "0.50" + __name__ = "FilefactoryCom" + __type__ = "hoster" + __version__ = "0.52" - __pattern__ = r'https?://(?:www\.)?filefactory\.com/file/(?P<id>[a-zA-Z0-9]+)' + __pattern__ = r'https?://(?:www\.)?filefactory\.com/(file|trafficshare/\w+)/\w+' __description__ = """Filefactory.com hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] - FILE_INFO_PATTERN = r'<div id="file_name"[^>]*>\s*<h2>(?P<N>[^<]+)</h2>\s*<div id="file_info">\s*(?P<S>[\d.]+) (?P<U>\w+) uploaded' - LINK_PATTERN = r'<a href="(https?://[^"]+)"[^>]*><i[^>]*></i> Download with FileFactory Premium</a>' + INFO_PATTERN = r'<div id="file_name"[^>]*>\s*<h2>(?P<N>[^<]+)</h2>\s*<div id="file_info">\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+) uploaded' OFFLINE_PATTERN = r'<h2>File Removed</h2>|This file is no longer available' - PREMIUM_ONLY_PATTERN = r'>Premium Account Required<' + + LINK_PATTERN = r'"([^"]+filefactory\.com/get.+?)"' + + WAIT_PATTERN = r'<div id="countdown_clock" data-delay="(\d+)">' + PREMIUM_ONLY_PATTERN = r'>Premium Account Required' COOKIES = [(".filefactory.com", "locale", "en_US.utf8")] def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) if "Currently only Premium Members can download files larger than" in self.html: - self.fail("File too large for free download") + self.fail(_("File too large for free download")) elif "All free download slots on this server are currently in use" in self.html: - self.retry(50, 15 * 60, "All free slots are busy") + self.retry(50, 15 * 60, _("All free slots are busy")) + + m = re.search(self.LINK_PATTERN, self.html) + if m is None: + self.error(_("Free download link not found")) + + dl_link = m.group(1) - m = re.search(r'data-href(?:-direct)?="(http://[^"]+)"', self.html) + m = re.search(self.WAIT_PATTERN, self.html) if m: - t = re.search(r'<div id="countdown_clock" data-delay="(\d+)">', self.html) - if t: - t = t.group(1) - else: - self.logDebug("Unable to detect countdown duration. Guessing 60 seconds") - t = 60 - self.wait(t) - direct = m.group(1) - else: # This section could be completely useless now - # Load the page that contains the direct link - url = re.search(r"document\.location\.host \+\s*'(.+)';", self.html) - if url is None: - self.parseError('Unable to detect free link') - url = 'http://www.filefactory.com' + url.group(1) - self.html = self.load(url, decode=True) - - # Free downloads wait time - waittime = re.search(r'id="startWait" value="(\d+)"', self.html) - if not waittime: - self.parseError('Unable to detect wait time') - self.wait(int(waittime.group(1))) - - # Parse the direct link and download it - direct = re.search(r'data-href(?:-direct)?="(.*)" class="button', self.html) - if not direct: - self.parseError('Unable to detect free direct link') - direct = direct.group(1) - - self.logDebug("DIRECT LINK: " + direct) - self.download(direct, disposition=True) - - check = self.checkDownload({"multiple": "You are currently downloading too many files at once.", - "error": '<div id="errorMessage">'}) + self.wait(m.group(1)) + + self.download(dl_link, disposition=True) + + check = self.checkDownload({'multiple': "You are currently downloading too many files at once.", + 'error': '<div id="errorMessage">'}) if check == "multiple": self.logDebug("Parallel downloads detected; waiting 15 minutes") - self.retry(wait_time=15 * 60, reason="Parallel downloads") + self.retry(wait_time=15 * 60, reason=_("Parallel downloads")) elif check == "error": - self.fail("Unknown error") + self.error(_("Unknown error")) + def handlePremium(self): header = self.load(self.pyfile.url, just_header=True) + if 'location' in header: url = header['location'].strip() if not url.startswith("http://"): - url = "http://www.filefactory.com" + url + url = urljoin("http://www.filefactory.com", url) elif 'content-disposition' in header: url = self.pyfile.url else: - self.logInfo('You could enable "Direct Downloads" on http://filefactory.com/account/') html = self.load(self.pyfile.url) m = re.search(self.LINK_PATTERN, html) if m: url = m.group(1) else: - self.parseError('Unable to detect premium direct link') + self.error(_("Premium download link not found")) - self.logDebug("DIRECT PREMIUM LINK: " + url) self.download(url, disposition=True) diff --git a/pyload/plugins/hoster/FilejungleCom.py b/pyload/plugins/hoster/FilejungleCom.py index 9cfc7b481..1cfa4c29e 100644 --- a/pyload/plugins/hoster/FilejungleCom.py +++ b/pyload/plugins/hoster/FilejungleCom.py @@ -5,14 +5,15 @@ from pyload.plugins.Plugin import chunks class FilejungleCom(FileserveCom): - __name__ = "FilejungleCom" - __type__ = "hoster" + __name__ = "FilejungleCom" + __type__ = "hoster" __version__ = "0.51" __pattern__ = r'http://(?:www\.)?filejungle\.com/f/(?P<id>[^/]+).*' __description__ = """Filejungle.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] URLS = ["http://www.filejungle.com/f/", "http://www.filejungle.com/check_links.php", diff --git a/pyload/plugins/hoster/FileomCom.py b/pyload/plugins/hoster/FileomCom.py index a5ddb797c..2b6fd34db 100644 --- a/pyload/plugins/hoster/FileomCom.py +++ b/pyload/plugins/hoster/FileomCom.py @@ -3,30 +3,27 @@ # Test links: # http://fileom.com/gycaytyzdw3g/random.bin.html -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class FileomCom(XFSPHoster): - __name__ = "FileomCom" - __type__ = "hoster" - __version__ = "0.01" +class FileomCom(XFSHoster): + __name__ = "FileomCom" + __type__ = "hoster" + __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?fileom\.com/\w{12}' __description__ = """Fileom.com hoster plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_NAME = "fileom.com" + HOSTER_DOMAIN = "fileom.com" - FILE_URL_REPLACEMENTS = [(r'/$', "")] + NAME_PATTERN = r'Filename: <span>(?P<N>.+?)<' + SIZE_PATTERN = r'File Size: <span class="size">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' - FILE_NAME_PATTERN = r'Filename: <span>(?P<N>.+?)<' - FILE_SIZE_PATTERN = r'File Size: <span class="size">(?P<S>[\d\.]+) (?P<U>\w+)' - - ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.*?)(?:\'|</)' - - LINK_PATTERN = r"var url2 = '(.+?)';" + LINK_PATTERN = r'var url2 = \'(.+?)\';' def setup(self): diff --git a/pyload/plugins/hoster/FilepostCom.py b/pyload/plugins/hoster/FilepostCom.py index 41674ebc8..97fdd6c67 100644 --- a/pyload/plugins/hoster/FilepostCom.py +++ b/pyload/plugins/hoster/FilepostCom.py @@ -10,22 +10,23 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): - __name__ = "FilepostCom" - __type__ = "hoster" - __version__ = "0.28" + __name__ = "FilepostCom" + __type__ = "hoster" + __version__ = "0.29" - __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp.io)/([^/]+).*' + __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/([^/]+).*' __description__ = """Filepost.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_INFO_PATTERN = r'<input type="text" id="url" value=\'<a href[^>]*>(?P<N>[^>]+?) - (?P<S>[0-9\.]+ [kKMG]i?B)</a>\' class="inp_text"/>' + INFO_PATTERN = r'<input type="text" id="url" value=\'<a href[^>]*>(?P<N>[^>]+?) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)</a>\' class="inp_text"/>' OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>|<div class="file_info file_info_deleted">' PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' - RECAPTCHA_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'" - FLP_TOKEN_PATTERN = r"set_store_options\({token: '([^']+)'" + RECAPTCHA_PATTERN = r'Captcha.init\({\s*key:\s*\'(.+?)\'' + FLP_TOKEN_PATTERN = r'set_store_options\({token: \'(.+?)\'' def handleFree(self): @@ -34,12 +35,12 @@ class FilepostCom(SimpleHoster): m = re.search(self.FLP_TOKEN_PATTERN, self.html) if m is None: - self.parseError("Token") + self.error(_("Token")) flp_token = m.group(1) m = re.search(self.RECAPTCHA_PATTERN, self.html) if m is None: - self.parseError("Captcha key") + self.error(_("Captcha key")) captcha_key = m.group(1) # Get wait time @@ -57,14 +58,14 @@ class FilepostCom(SimpleHoster): for file_pass in self.getPassword().splitlines(): get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' post_dict['file_pass'] = file_pass - self.logInfo("Password protected link, trying " + file_pass) + self.logInfo(_("Password protected link, trying ") + file_pass) download_url = self.getJsonResponse(get_dict, post_dict, 'link') if download_url: break else: - self.fail("No or incorrect password") + self.fail(_("No or incorrect password")) else: # Solve recaptcha @@ -87,17 +88,18 @@ class FilepostCom(SimpleHoster): self.invalidCaptcha() else: - self.fail("Invalid captcha") + self.fail(_("Invalid captcha")) # Download self.download(download_url) + def getJsonResponse(self, get_dict, post_dict, field): json_response = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict)) self.logDebug(json_response) if not 'js' in json_response: - self.parseError('JSON %s 1' % field) + self.error(_("JSON %s 1") % field) # i changed js_answer to json_response['js'] since js_answer is nowhere set. # i don't know the JSON-HTTP specs in detail, but the previous author @@ -118,10 +120,9 @@ class FilepostCom(SimpleHoster): return None else: self.fail(json_response['js']['error']) - # ~? self.fail(js_answer['error']) if not 'answer' in json_response['js'] or not field in json_response['js']['answer']: - self.parseError('JSON %s 2' % field) + self.error(_("JSON %s 2") % field) return json_response['js']['answer'][field] diff --git a/pyload/plugins/hoster/FilepupNet.py b/pyload/plugins/hoster/FilepupNet.py index 6c2437f67..0b1247bf4 100644 --- a/pyload/plugins/hoster/FilepupNet.py +++ b/pyload/plugins/hoster/FilepupNet.py @@ -10,19 +10,20 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepupNet(SimpleHoster): - __name__ = "FilepupNet" - __type__ = "hoster" - __version__ = "0.01" + __name__ = "FilepupNet" + __type__ = "hoster" + __version__ = "0.02" __pattern__ = r'http://(?:www\.)?filepup\.net/files/\w+' __description__ = """Filepup.net hoster plugin""" - __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"), + ("Walter Purcaro", "vuolter@gmail.com")] - FILE_NAME_PATTERN = r'>(?P<N>.+?)</h1>' - FILE_SIZE_PATTERN = r'class="fa fa-archive"></i> \((?P<S>[\d.]+) (?P<U>\w+)' + NAME_PATTERN = r'>(?P<N>.+?)</h1>' + SIZE_PATTERN = r'class="fa fa-archive"></i> \((?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>This file has been deleted' @@ -37,14 +38,14 @@ class FilepupNet(SimpleHoster): def handleFree(self): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError("Download link not found") + self.error(_("Download link not found")) dl_link = m.group(1) self.download(dl_link, post={'task': "download"}) check = self.checkDownload({'html': re.compile("html")}) if check == "html": - self.parseError("Downloaded file is an html file") + self.error(_("Downloaded file is an html page")) getInfo = create_getInfo(FilepupNet) diff --git a/pyload/plugins/hoster/FilerNet.py b/pyload/plugins/hoster/FilerNet.py index 71c6b5384..e34a5799e 100644 --- a/pyload/plugins/hoster/FilerNet.py +++ b/pyload/plugins/hoster/FilerNet.py @@ -14,44 +14,34 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilerNet(SimpleHoster): - __name__ = "FilerNet" - __type__ = "hoster" - __version__ = "0.04" + __name__ = "FilerNet" + __type__ = "hoster" + __version__ = "0.07" - __pattern__ = r'https?://(?:www\.)?filer\.net/get/(\w+)' + __pattern__ = r'https?://(?:www\.)?filer\.net/get/\w+' __description__ = """Filer.net hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] - FILE_INFO_PATTERN = r'<h1 class="page-header">Free Download (?P<N>\S+) <small>(?P<S>[\w.]+) (?P<U>\w+)</small></h1>' + INFO_PATTERN = r'<h1 class="page-header">Free Download (?P<N>\S+) <small>(?P<S>[\w.]+) (?P<U>[\w^_]+)</small></h1>' OFFLINE_PATTERN = r'Nicht gefunden' - LINK_PATTERN = r'href="([^"]+)">Get download</a>' + LINK_PATTERN = r'href="([^"]+)">Get download</a>' - def process(self, pyfile): - if self.premium and (not self.FORCE_CHECK_TRAFFIC or self.checkTrafficLeft()): - self.handlePremium() - else: - self.handleFree() def handleFree(self): - self.req.setOption("timeout", 120) - self.html = self.load(self.pyfile.url, decode=not self.TEXT_ENCODING, cookies=self.COOKIES) - # Wait between downloads m = re.search(r'musst du <span id="time">(\d+)</span> Sekunden warten', self.html) if m: - waittime = int(m.group(1)) - self.retry(3, waittime, "Wait between free downloads") - - self.getFileInfo() + self.retry(wait_time=int(m.group(1)), reason=_("Wait between free downloads")) self.html = self.load(self.pyfile.url, decode=True) inputs = self.parseHtmlForm(input_names='token')[1] if 'token' not in inputs: - self.parseError('Unable to detect token') + self.error(_("Unable to detect token")) token = inputs['token'] self.logDebug("Token: " + token) @@ -59,20 +49,15 @@ class FilerNet(SimpleHoster): inputs = self.parseHtmlForm(input_names='hash')[1] if 'hash' not in inputs: - self.parseError('Unable to detect hash') + self.error(_("Unable to detect hash")) hash_data = inputs['hash'] self.logDebug("Hash: " + hash_data) downloadURL = r'' - recaptcha = ReCaptcha(self) - captcha_key = recaptcha.detect_key() - if captcha_key is None: - self.parseError("ReCaptcha key not found") - - for _ in xrange(5): - challenge, response = recaptcha.challenge(captcha_key) + for _i in xrange(5): + challenge, response = recaptcha.challenge() post_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field': response, 'hash': hash_data} @@ -88,14 +73,14 @@ class FilerNet(SimpleHoster): self.correctCaptcha() break else: - self.logInfo("Wrong captcha") self.invalidCaptcha() if not downloadURL: - self.fail("No Download url retrieved/all captcha attempts failed") + self.fail(_("No Download url retrieved/all captcha attempts failed")) self.download(downloadURL, disposition=True) + def handlePremium(self): header = self.load(self.pyfile.url, just_header=True) if 'location' in header: # Direct Download ON @@ -104,7 +89,7 @@ class FilerNet(SimpleHoster): html = self.load(self.pyfile.url) m = re.search(self.LINK_PATTERN, html) if m is None: - self.parseError("Unable to detect direct link, try to enable 'Direct download' in your user settings") + self.error(_("LINK_PATTERN not found")) dl = 'http://filer.net' + m.group(1) self.logDebug("Direct link: " + dl) diff --git a/pyload/plugins/hoster/FilerioCom.py b/pyload/plugins/hoster/FilerioCom.py index 4389a8d1a..52906fc67 100644 --- a/pyload/plugins/hoster/FilerioCom.py +++ b/pyload/plugins/hoster/FilerioCom.py @@ -1,23 +1,24 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class FilerioCom(XFSPHoster): - __name__ = "FilerioCom" - __type__ = "hoster" - __version__ = "0.02" +class FilerioCom(XFSHoster): + __name__ = "FilerioCom" + __type__ = "hoster" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?(filerio\.(in|com)|filekeen\.com)/\w{12}' __description__ = """FileRio.in hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_NAME = "filerio.in" + HOSTER_DOMAIN = "filerio.in" OFFLINE_PATTERN = r'>"File Not Found|File has been removed' - FILE_URL_REPLACEMENTS = [(r'http://.*?/', 'http://filerio.in/')] + URL_REPLACEMENTS = [(r'/(?:embed-)?(\w{12}).*', r'/\1'), (r'filekeen\.com', "filerio.in")] getInfo = create_getInfo(FilerioCom) diff --git a/pyload/plugins/hoster/FilesMailRu.py b/pyload/plugins/hoster/FilesMailRu.py index 176799c1c..c92cd0b0c 100644 --- a/pyload/plugins/hoster/FilesMailRu.py +++ b/pyload/plugins/hoster/FilesMailRu.py @@ -11,15 +11,15 @@ def getInfo(urls): result = [] for chunk in chunks(urls, 10): for url in chunk: - src = getURL(url) - if r'<div class="errorMessage mb10">' in src: + html = getURL(url) + if r'<div class="errorMessage mb10">' in html: result.append((url, 0, 1, url)) - elif r'Page cannot be displayed' in src: + elif r'Page cannot be displayed' in html: result.append((url, 0, 1, url)) else: try: url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' - file_name = re.search(url_pattern, src).group(0).split(', event)">')[1].split('</a>')[0] + file_name = re.search(url_pattern, html).group(0).split(', event)">')[1].split('</a>')[0] result.append((file_name, 0, 2, url)) except: pass @@ -30,20 +30,22 @@ def getInfo(urls): class FilesMailRu(Hoster): - __name__ = "FilesMailRu" - __type__ = "hoster" + __name__ = "FilesMailRu" + __type__ = "hoster" __version__ = "0.31" __pattern__ = r'http://(?:www\.)?files\.mail\.ru/.*' __description__ = """Files.mail.ru hoster plugin""" - __authors__ = [("oZiRiz", "ich@oziriz.de")] + __license__ = "GPLv3" + __authors__ = [("oZiRiz", "ich@oziriz.de")] def setup(self): if not self.account: self.multiDL = False + def process(self, pyfile): self.html = self.load(pyfile.url) self.url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' @@ -67,20 +69,24 @@ class FilesMailRu(Hoster): self.download(self.getFileUrl()) self.myPostProcess() + def prepare(self): """You have to wait some seconds. Otherwise you will get a 40Byte HTML Page instead of the file you expected""" self.setWait(10) self.wait() return True + def getFileUrl(self): """gives you the URL to the file. Extracted from the Files.mail.ru HTML-page stored in self.html""" return re.search(self.url_pattern, self.html).group(0).split('<a href="')[1].split('" onclick="return Act')[0] + def getFileName(self): """gives you the Name for each file. Also extracted from the HTML-Page""" return re.search(self.url_pattern, self.html).group(0).split(', event)">')[1].split('</a>')[0] + def myPostProcess(self): # searches the file for HTMl-Code. Sometimes the Redirect # doesn't work (maybe a curl Problem) and you get only a small diff --git a/pyload/plugins/hoster/FileserveCom.py b/pyload/plugins/hoster/FileserveCom.py index f1969a40e..88da94c46 100644 --- a/pyload/plugins/hoster/FileserveCom.py +++ b/pyload/plugins/hoster/FileserveCom.py @@ -15,7 +15,7 @@ def checkFile(plugin, urls): html = getURL(plugin.URLS[1], post={"urls": "\n".join(urls)}, decode=True) file_info = [] - for li in re.finditer(plugin.LINKCHECK_TR, html, re.DOTALL): + for li in re.finditer(plugin.LINKCHECK_TR, html, re.S): try: cols = re.findall(plugin.LINKCHECK_TD, li.group(1)) if cols: @@ -31,29 +31,30 @@ def checkFile(plugin, urls): class FileserveCom(Hoster): - __name__ = "FileserveCom" - __type__ = "hoster" + __name__ = "FileserveCom" + __type__ = "hoster" __version__ = "0.52" __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<id>[^/]+).*' __description__ = """Fileserve.com hoster plugin""" - __authors__ = [("jeix", "jeix@hasnomail.de"), - ("mkaay", "mkaay@mkaay.de"), - ("Paul King", None), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de"), + ("mkaay", "mkaay@mkaay.de"), + ("Paul King", None), + ("zoidberg", "zoidberg@mujmail.cz")] URLS = ["http://www.fileserve.com/file/", "http://www.fileserve.com/link-checker.php", "http://www.fileserve.com/checkReCaptcha.php"] - LINKCHECK_TR = r'<tr>\s*(<td>http://www.fileserve\.com/file/.*?)</tr>' + LINKCHECK_TR = r'<tr>\s*(<td>http://www\.fileserve\.com/file/.*?)</tr>' LINKCHECK_TD = r'<td>(?:<[^>]*>| )*([^<]*)' - CAPTCHA_KEY_PATTERN = r"var reCAPTCHA_publickey='(?P<key>[^']+)'" + CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(?P<key>.+?)\'' LONG_WAIT_PATTERN = r'<li class="title">You need to wait (\d+) (\w+) to start another download\.</li>' LINK_EXPIRED_PATTERN = r'Your download link has expired' DAILY_LIMIT_PATTERN = r'Your daily download limit has been reached' - NOT_LOGGED_IN_PATTERN = r'<form (name="loginDialogBoxForm"|id="login_form")|<li><a href="/login.php">Login</a></li>' + NOT_LOGGED_IN_PATTERN = r'<form (name="loginDialogBoxForm"|id="login_form")|<li><a href="/login\.php">Login</a></li>' def setup(self): @@ -63,6 +64,7 @@ class FileserveCom(Hoster): self.url = "%s%s" % (self.URLS[0], self.file_id) self.logDebug("File ID: %s URL: %s" % (self.file_id, self.url)) + def process(self, pyfile): pyfile.name, pyfile.size, status, self.url = checkFile(self, [self.url])[0] if status != 2: @@ -74,6 +76,7 @@ class FileserveCom(Hoster): else: self.handleFree() + def handleFree(self): self.html = self.load(self.url) action = self.load(self.url, post={"checkDownload": "check"}, decode=True) @@ -88,11 +91,11 @@ class FileserveCom(Hoster): self.doLongWait(re.search(self.LONG_WAIT_PATTERN, self.html)) elif action['fail'] == "parallelDownload": - self.logWarning(_("Parallel download error, now waiting 60s.")) - self.retry(wait_time=60, reason="parallelDownload") + self.logWarning(_("Parallel download error, now waiting 60s")) + self.retry(wait_time=60, reason=_("parallelDownload")) else: - self.fail("Download check returned %s" % action['fail']) + self.fail(_("Download check returned: %s") % action['fail']) elif "success" in action: if action['success'] == "showCaptcha": @@ -102,13 +105,13 @@ class FileserveCom(Hoster): self.doTimmer() else: - self.fail("Unknown server response") + self.error(_("Unknown server response")) # show download link - response = self.load(self.url, post={"downloadLink": "show"}, decode=True) - self.logDebug("Show downloadLink response : %s" % response) - if "fail" in response: - self.fail("Couldn't retrieve download url") + res = self.load(self.url, post={"downloadLink": "show"}, decode=True) + self.logDebug("Show downloadLink response: %s" % res) + if "fail" in res: + self.error(_("Couldn't retrieve download url")) # this may either download our file or forward us to an error page self.download(self.url, post={"download": "normal"}) @@ -124,50 +127,51 @@ class FileserveCom(Hoster): elif check == "wait": self.doLongWait(self.lastCheck) elif check == "limit": - self.logWarning("Download limited reached for today") + self.logWarning(_("Download limited reached for today")) self.setWait(secondsToMidnight(gmt=2), True) self.wait() self.retry() self.thread.m.reconnecting.wait(3) # Ease issue with later downloads appearing to be in parallel + def doTimmer(self): - response = self.load(self.url, post={"downloadLink": "wait"}, decode=True) - self.logDebug("Wait response : %s" % response[:80]) + res = self.load(self.url, post={"downloadLink": "wait"}, decode=True) + self.logDebug("Wait response: %s" % res[:80]) - if "fail" in response: - self.fail("Failed getting wait time") + if "fail" in res: + self.fail(_("Failed getting wait time")) if self.__name__ == "FilejungleCom": - m = re.search(r'"waitTime":(\d+)', response) + m = re.search(r'"waitTime":(\d+)', res) if m is None: - self.fail("Cannot get wait time") + self.fail(_("Cannot get wait time")) wait_time = int(m.group(1)) else: - wait_time = int(response) + 3 + wait_time = int(res) + 3 self.setWait(wait_time) self.wait() + def doCaptcha(self): captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group("key") recaptcha = ReCaptcha(self) - for _ in xrange(5): + for _i in xrange(5): challenge, code = recaptcha.challenge(captcha_key) - - response = json_loads(self.load(self.URLS[2], - post={'recaptcha_challenge_field': challenge, - 'recaptcha_response_field': code, - 'recaptcha_shortencode_field': self.file_id})) - self.logDebug("reCaptcha response : %s" % response) - if not response['success']: + res = json_loads(self.load(self.URLS[2], + post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': code, + 'recaptcha_shortencode_field': self.file_id})) + if not res['success']: self.invalidCaptcha() else: self.correctCaptcha() break else: - self.fail("Invalid captcha") + self.fail(_("Invalid captcha")) + def doLongWait(self, m): wait_time = (int(m.group(1)) * {'seconds': 1, 'minutes': 60, 'hours': 3600}[m.group(2)]) if m else 12 * 60 @@ -175,27 +179,28 @@ class FileserveCom(Hoster): self.wait() self.retry() + def handlePremium(self): premium_url = None if self.__name__ == "FileserveCom": #try api download - response = self.load("http://app.fileserve.com/api/download/premium/", - post={"username": self.user, - "password": self.account.getAccountData(self.user)['password'], - "shorten": self.file_id}, - decode=True) - if response: - response = json_loads(response) - if response['error_code'] == "302": - premium_url = response['next'] - elif response['error_code'] in ["305", "500"]: + res = self.load("http://app.fileserve.com/api/download/premium/", + post={"username": self.user, + "password": self.account.getAccountData(self.user)['password'], + "shorten": self.file_id}, + decode=True) + if res: + res = json_loads(res) + if res['error_code'] == "302": + premium_url = res['next'] + elif res['error_code'] in ["305", "500"]: self.tempOffline() - elif response['error_code'] in ["403", "605"]: + elif res['error_code'] in ["403", "605"]: self.resetAccount() - elif response['error_code'] in ["606", "607", "608"]: + elif res['error_code'] in ["606", "607", "608"]: self.offline() else: - self.logError(response['error_code'], response['error_message']) + self.logError(res['error_code'], res['error_message']) self.download(premium_url or self.pyfile.url) @@ -204,7 +209,7 @@ class FileserveCom(Hoster): if check == "login": self.account.relogin(self.user) - self.retry(reason=_("Not logged in.")) + self.retry(reason=_("Not logged in")) def getInfo(urls): diff --git a/pyload/plugins/hoster/FileshareInUa.py b/pyload/plugins/hoster/FileshareInUa.py index f2d1ed84b..08e10dccb 100644 --- a/pyload/plugins/hoster/FileshareInUa.py +++ b/pyload/plugins/hoster/FileshareInUa.py @@ -1,83 +1,18 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -from pyload.network.RequestFactory import getURL -from pyload.plugins.base.Hoster import Hoster -from pyload.utils import parseFileSize +class FileshareInUa(DeadHoster): + __name__ = "FileshareInUa" + __type__ = "hoster" + __version__ = "0.02" -class FileshareInUa(Hoster): - __name__ = "FileshareInUa" - __type__ = "hoster" - __version__ = "0.01" - - __pattern__ = r'http://(?:www\.)?fileshare.in.ua/[A-Za-z0-9]+' + __pattern__ = r'https?://(?:www\.)?fileshare\.in\.ua/\w{7}' __description__ = """Fileshare.in.ua hoster plugin""" - __authors__ = [("fwannmacher", "felipe@warhammerproject.com")] - - - PATTERN_FILENAME = r'<h3 class="b-filename">(.*?)</h3>' - PATTERN_FILESIZE = r'<b class="b-filesize">(.*?)</b>' - PATTERN_OFFLINE = r"This file doesn't exist, or has been removed." - - - def setup(self): - self.resumeDownload = self.multiDL = True - - def process(self, pyfile): - self.pyfile = pyfile - self.html = self.load(pyfile.url, decode=True) - - if not self._checkOnline(): - self.offline() - - pyfile.name = self._getName() - - link = self._getLink() - - if not link.startswith('http://'): - link = "http://fileshare.in.ua" + link - - self.download(link) - - def _checkOnline(self): - if re.search(self.PATTERN_OFFLINE, self.html): - return False - else: - return True - - def _getName(self): - name = re.search(self.PATTERN_FILENAME, self.html) - if name is None: - self.fail("%s: Plugin broken." % self.__name__) - - return name.group(1) - - def _getLink(self): - return re.search("<a href=\"(/get/.+)\" class=\"b-button m-blue m-big\" >", self.html).group(1) - - -def getInfo(urls): - result = [] - - for url in urls: - html = getURL(url) - - if re.search(FileshareInUa.PATTERN_OFFLINE, html): - result.append((url, 0, 1, url)) - else: - name = re.search(FileshareInUa.PATTERN_FILENAME, html) - - if name is None: - result.append((url, 0, 1, url)) - continue - - name = name.group(1) - size = re.search(FileshareInUa.PATTERN_FILESIZE, html) - size = parseFileSize(size.group(1)) + __license__ = "GPLv3" + __authors__ = [("fwannmacher", "felipe@warhammerproject.com")] - result.append((name, size, 3, url)) - yield result +getInfo = create_getInfo(FileshareInUa) diff --git a/pyload/plugins/hoster/FilezyNet.py b/pyload/plugins/hoster/FilezyNet.py index 660e9c5e3..2296cf856 100644 --- a/pyload/plugins/hoster/FilezyNet.py +++ b/pyload/plugins/hoster/FilezyNet.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class FilezyNet(DeadHoster): - __name__ = "FilezyNet" - __type__ = "hoster" + __name__ = "FilezyNet" + __type__ = "hoster" __version__ = "0.2" __pattern__ = r'http://(?:www\.)?filezy\.net/\w{12}' __description__ = """Filezy.net hoster plugin""" - __authors__ = [] + __license__ = "GPLv3" + __authors__ = [] getInfo = create_getInfo(FilezyNet) diff --git a/pyload/plugins/hoster/FiredriveCom.py b/pyload/plugins/hoster/FiredriveCom.py index 060b34d5d..0e3a4e847 100644 --- a/pyload/plugins/hoster/FiredriveCom.py +++ b/pyload/plugins/hoster/FiredriveCom.py @@ -1,51 +1,18 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo - -class FiredriveCom(SimpleHoster): - __name__ = "FiredriveCom" - __type__ = "hoster" - __version__ = "0.04" +class FiredriveCom(DeadHoster): + __name__ = "FiredriveCom" + __type__ = "hoster" + __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?(firedrive|putlocker)\.com/(mobile/)?(file|embed)/(?P<ID>\w+)' __description__ = """Firedrive.com hoster plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - FILE_NAME_PATTERN = r'<b>Name:</b> (?P<N>.+) <br>' - FILE_SIZE_PATTERN = r'<b>Size:</b> (?P<S>[\d.]+) (?P<U>[a-zA-Z]+) <br>' - OFFLINE_PATTERN = r'class="sad_face_image"|>No such page here.<' - TEMP_OFFLINE_PATTERN = r'Please try again in a few minutes.<' - - FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.firedrive.com/file/\g<ID>')] - - LINK_PATTERN = r'<a href="(https?://dl\.firedrive\.com/\?key=.+?)"' - - - def setup(self): - self.multiDL = self.resumeDownload = True - self.chunkLimit = -1 - - def handleFree(self): - link = self._getLink() - self.logDebug("Direct link: " + link) - self.download(link, disposition=True) - - def _getLink(self): - f = re.search(self.LINK_PATTERN, self.html) - if f: - return f.group(1) - else: - self.html = self.load(self.pyfile.url, post={"confirm": re.search(r'name="confirm" value="(.+?)"', self.html).group(1)}) - f = re.search(self.LINK_PATTERN, self.html) - if f: - return f.group(1) - else: - self.parseError("Direct download link not found") + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] getInfo = create_getInfo(FiredriveCom) diff --git a/pyload/plugins/hoster/FlyFilesNet.py b/pyload/plugins/hoster/FlyFilesNet.py index b8b392e8b..05e37e95a 100644 --- a/pyload/plugins/hoster/FlyFilesNet.py +++ b/pyload/plugins/hoster/FlyFilesNet.py @@ -9,21 +9,22 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster class FlyFilesNet(SimpleHoster): - __name__ = "FlyFilesNet" - __type__ = "hoster" + __name__ = "FlyFilesNet" + __type__ = "hoster" __version__ = "0.1" __pattern__ = r'http://(?:www\.)?flyfiles\.net/.*' __description__ = """FlyFiles.net hoster plugin""" - __authors__ = [] + __license__ = "GPLv3" + __authors__ = [] SESSION_PATTERN = r'flyfiles\.net/(.*)/.*' - FILE_NAME_PATTERN = r'flyfiles\.net/.*/(.*)' + NAME_PATTERN = r'flyfiles\.net/.*/(.*)' def process(self, pyfile): - name = re.search(self.FILE_NAME_PATTERN, pyfile.url).group(1) + name = re.search(self.NAME_PATTERN, pyfile.url).group(1) pyfile.name = unquote_plus(name) session = re.search(self.SESSION_PATTERN, pyfile.url).group(1) @@ -35,11 +36,10 @@ class FlyFilesNet(SimpleHoster): self.logDebug("Parsed URL: %s" % parsed_url) if parsed_url == '#downlink|' or parsed_url == "#downlink|#": - self.logWarning("Could not get the download URL. Please wait 10 minutes.") + self.logWarning(_("Could not get the download URL. Please wait 10 minutes")) self.wait(10 * 60, True) self.retry() download_url = parsed_url.replace('#downlink|', '') - self.logDebug("Download URL: %s" % download_url) self.download(download_url) diff --git a/pyload/plugins/hoster/FourSharedCom.py b/pyload/plugins/hoster/FourSharedCom.py index 471ac66a2..03500654e 100644 --- a/pyload/plugins/hoster/FourSharedCom.py +++ b/pyload/plugins/hoster/FourSharedCom.py @@ -6,23 +6,24 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FourSharedCom(SimpleHoster): - __name__ = "FourSharedCom" - __type__ = "hoster" - __version__ = "0.29" + __name__ = "FourSharedCom" + __type__ = "hoster" + __version__ = "0.30" __pattern__ = r'https?://(?:www\.)?4shared(\-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|mp3|office|rar|zip|archive|music)/.+?/.*' __description__ = """4Shared.com hoster plugin""" - __authors__ = [("jeix", "jeix@hasnomail.de"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de"), + ("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<meta name="title" content="(?P<N>.+?)"' - FILE_SIZE_PATTERN = r'<span title="Size: (?P<S>[0-9,.]+) (?P<U>[kKMG])i?B">' + NAME_PATTERN = r'<meta name="title" content="(?P<N>.+?)"' + SIZE_PATTERN = r'<span title="Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)">' OFFLINE_PATTERN = r'The file link that you requested is not valid\.|This file was deleted.' - FILE_NAME_REPLACEMENTS = [(r"&#(\d+).", lambda m: unichr(int(m.group(1))))] - FILE_SIZE_REPLACEMENTS = [(",", "")] + NAME_REPLACEMENTS = [(r"&#(\d+).", lambda m: unichr(int(m.group(1))))] + SIZE_REPLACEMENTS = [(",", "")] DOWNLOAD_URL_PATTERN = r'name="d3link" value="(.*?)"' DOWNLOAD_BUTTON_PATTERN = r'id="btnLink" href="(.*?)"' @@ -31,7 +32,7 @@ class FourSharedCom(SimpleHoster): def handleFree(self): if not self.account: - self.fail("User not logged in") + self.fail(_("User not logged in")) m = re.search(self.DOWNLOAD_BUTTON_PATTERN, self.html) if m: @@ -43,13 +44,13 @@ class FourSharedCom(SimpleHoster): m = re.search(self.DOWNLOAD_URL_PATTERN, self.html) if m is None: - self.parseError('Download link') + self.error(_("Download link")) link = m.group(1) try: m = re.search(self.FID_PATTERN, self.html) - response = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1)) - self.logDebug(response) + res = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1)) + self.logDebug(res) except: pass diff --git a/pyload/plugins/hoster/FreakshareCom.py b/pyload/plugins/hoster/FreakshareCom.py index 2405d1f35..1759df04a 100644 --- a/pyload/plugins/hoster/FreakshareCom.py +++ b/pyload/plugins/hoster/FreakshareCom.py @@ -8,23 +8,25 @@ from pyload.plugins.internal.CaptchaService import ReCaptcha class FreakshareCom(Hoster): - __name__ = "FreakshareCom" - __type__ = "hoster" + __name__ = "FreakshareCom" + __type__ = "hoster" __version__ = "0.39" __pattern__ = r'http://(?:www\.)?freakshare\.(net|com)/files/\S*?/' __description__ = """Freakshare.com hoster plugin""" - __authors__ = [("sitacuisses", "sitacuisses@yahoo.de"), - ("spoob", "spoob@pyload.org"), - ("mkaay", "mkaay@mkaay.de"), - ("Toilal", "toilal.dev@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("sitacuisses", "sitacuisses@yahoo.de"), + ("spoob", "spoob@pyload.org"), + ("mkaay", "mkaay@mkaay.de"), + ("Toilal", "toilal.dev@gmail.com")] def setup(self): self.multiDL = False self.req_opts = [] + def process(self, pyfile): self.pyfile = pyfile @@ -48,24 +50,23 @@ class FreakshareCom(Hoster): "downloadserver": "No Downloadserver. Please try again later!"}) if check == "bad": - self.fail("Bad Try.") + self.fail(_("Bad Try")) elif check == "paralell": self.setWait(300, True) self.wait() self.retry() elif check == "empty": - self.fail("File not downloadable") + self.fail(_("File not downloadable")) elif check == "wrong_captcha": self.invalidCaptcha() self.retry() elif check == "downloadserver": - self.retry(5, 15 * 60, "No Download server") + self.retry(5, 15 * 60, _("No Download server")) + def prepare(self): pyfile = self.pyfile - self.wantReconnect = False - self.download_html() if not self.file_exists(): @@ -80,10 +81,12 @@ class FreakshareCom(Hoster): return True + def download_html(self): self.load("http://freakshare.com/index.php", {"language": "EN"}) # Set english language in server session self.html = self.load(self.pyfile.url) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -96,6 +99,7 @@ class FreakshareCom(Hoster): else: self.offline() + def get_file_name(self): if not self.html: self.download_html() @@ -109,6 +113,7 @@ class FreakshareCom(Hoster): else: return self.pyfile.url + def get_file_size(self): size = 0 if not self.html: @@ -123,6 +128,7 @@ class FreakshareCom(Hoster): return size + def get_waiting_time(self): if not self.html: self.download_html() @@ -131,12 +137,13 @@ class FreakshareCom(Hoster): self.wantReconnect = True return secondsToMidnight(gmt=2) - timestring = re.search('\s*var\s(?:downloadWait|time)\s=\s(\d*)[.\d]*;', self.html) + timestring = re.search('\s*var\s(?:downloadWait|time)\s=\s(\d*)[\d.]*;', self.html) if timestring: - return int(timestring.group(1)) + 1 # add 1 sec as tenths of seconds are cut off + return int(timestring.group(1)) else: return 60 + def file_exists(self): """ returns True or False """ @@ -147,6 +154,7 @@ class FreakshareCom(Hoster): else: return True + def get_download_options(self): re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>", self.html).group(0) # get the whole request @@ -162,10 +170,7 @@ class FreakshareCom(Hoster): to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego) request_options = dict((n, v) for (v, n) in to_sort) - # comment this in, when it doesnt work as well - #print "\n\n%s\n\n" % ";".join(["%s=%s" % x for x in to_sort]) - - challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=([0-9A-Za-z]+)", herewego) + challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=(\w+)", herewego) if challenge: re_captcha = ReCaptcha(self) diff --git a/pyload/plugins/hoster/FreeWayMe.py b/pyload/plugins/hoster/FreeWayMe.py index ec99f850f..219333055 100644 --- a/pyload/plugins/hoster/FreeWayMe.py +++ b/pyload/plugins/hoster/FreeWayMe.py @@ -4,14 +4,15 @@ from pyload.plugins.base.Hoster import Hoster class FreeWayMe(Hoster): - __name__ = "FreeWayMe" - __type__ = "hoster" + __name__ = "FreeWayMe" + __type__ = "hoster" __version__ = "0.11" - __pattern__ = r'https://(?:www\.)?free-way.me/.*' + __pattern__ = r'https://(?:www\.)?free-way\.me/.*' __description__ = """FreeWayMe hoster plugin""" - __authors__ = [("Nicolas Giese", "james@free-way.me")] + __license__ = "GPLv3" + __authors__ = [("Nicolas Giese", "james@free-way.me")] def setup(self): @@ -19,10 +20,11 @@ class FreeWayMe(Hoster): self.chunkLimit = 1 self.multiDL = self.premium + def process(self, pyfile): if not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "FreeWayMe") - self.fail("No FreeWay account provided") + self.fail(_("No FreeWay account provided")) self.logDebug("Old URL: %s" % pyfile.url) diff --git a/pyload/plugins/hoster/FreevideoCz.py b/pyload/plugins/hoster/FreevideoCz.py index c2e14471d..7cc0a6ef7 100644 --- a/pyload/plugins/hoster/FreevideoCz.py +++ b/pyload/plugins/hoster/FreevideoCz.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class FreevideoCz(DeadHoster): - __name__ = "FreevideoCz" - __type__ = "hoster" + __name__ = "FreevideoCz" + __type__ = "hoster" __version__ = "0.3" __pattern__ = r'http://(?:www\.)?freevideo\.cz/vase-videa/.+' __description__ = """Freevideo.cz hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] getInfo = create_getInfo(FreevideoCz)
\ No newline at end of file diff --git a/pyload/plugins/hoster/FshareVn.py b/pyload/plugins/hoster/FshareVn.py index 3ecae0394..92f7c659a 100644 --- a/pyload/plugins/hoster/FshareVn.py +++ b/pyload/plugins/hoster/FshareVn.py @@ -10,14 +10,11 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo def getInfo(urls): for url in urls: - html = getURL('http://www.fshare.vn/check_link.php', post={ - "action": "check_link", - "arrlinks": url - }, decode=True) + html = getURL("http://www.fshare.vn/check_link.php", + post={'action': "check_link", 'arrlinks': url}, + decode=True) - file_info = parseFileInfo(FshareVn, url, html) - - yield file_info + yield parseFileInfo(FshareVn, url, html) def doubleDecode(m): @@ -25,20 +22,21 @@ def doubleDecode(m): class FshareVn(SimpleHoster): - __name__ = "FshareVn" - __type__ = "hoster" - __version__ = "0.16" + __name__ = "FshareVn" + __type__ = "hoster" + __version__ = "0.17" - __pattern__ = r'http://(?:www\.)?fshare.vn/file/.*' + __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.*' __description__ = """FshareVn hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_INFO_PATTERN = r'<p>(?P<N>[^<]+)<\\/p>[\\trn\s]*<p>(?P<S>[0-9,.]+)\s*(?P<U>[kKMG])i?B<\\/p>' + INFO_PATTERN = r'<p>(?P<N>[^<]+)<\\/p>[\\trn\s]*<p>(?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)<\\/p>' OFFLINE_PATTERN = r'<div class=\\"f_left file_w\\"|<\\/p>\\t\\t\\t\\t\\r\\n\\t\\t<p><\\/p>\\t\\t\\r\\n\\t\\t<p>0 KB<\\/p>' - FILE_NAME_REPLACEMENTS = [("(.*)", doubleDecode)] + NAME_REPLACEMENTS = [("(.*)", doubleDecode)] LINK_PATTERN = r'action="(http://download.*?)[#"]' WAIT_PATTERN = ur'Lượt tải xuá»ng kế tiếp là :\s*(.*?)\s*<' @@ -57,6 +55,7 @@ class FshareVn(SimpleHoster): self.handleFree() self.checkDownloadedFile() + def handleFree(self): self.html = self.load(self.pyfile.url, decode=True) @@ -66,16 +65,16 @@ class FshareVn(SimpleHoster): self.url = self.pyfile.url + action if not inputs: - self.parseError('FORM') + self.error(_("No FORM")) elif 'link_file_pwd_dl' in inputs: for password in self.getPassword().splitlines(): - self.logInfo("Password protected link, trying", password) + self.logInfo(_("Password protected link, trying ") + password) inputs['link_file_pwd_dl'] = password self.html = self.load(self.url, post=inputs, decode=True) if not 'name="link_file_pwd_dl"' in self.html: break else: - self.fail("No or incorrect password") + self.fail(_("No or incorrect password")) else: self.html = self.load(self.url, post=inputs, decode=True) @@ -86,29 +85,33 @@ class FshareVn(SimpleHoster): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError('FREE DL URL') + self.error(_("LINK_PATTERN not found")) self.url = m.group(1) self.logDebug("FREE DL URL: %s" % self.url) self.wait() self.download(self.url) + def handlePremium(self): self.download(self.pyfile.url) + def checkErrors(self): if '/error.php?' in self.req.lastEffectiveURL or u"Liên kết bạn chá»n khÃŽng tá»n" in self.html: self.offline() m = re.search(self.WAIT_PATTERN, self.html) if m: - self.logInfo("Wait until %s ICT" % m.group(1)) + self.logInfo(_("Wait until %s ICT") % m.group(1)) wait_until = mktime(strptime(m.group(1), "%d/%m/%Y %H:%M")) self.wait(wait_until - mktime(gmtime()) - 7 * 60 * 60, True) self.retry() elif '<ul class="message-error">' in self.html: - self.logError("Unknown error occured or wait time not parsed") - self.retry(30, 2 * 60, "Unknown error") + msg = "Unknown error occured or wait time not parsed" + self.logError(msg) + self.retry(30, 2 * 60, msg) + def checkDownloadedFile(self): # check download @@ -117,4 +120,4 @@ class FshareVn(SimpleHoster): }) if check == "not_found": - self.fail("File not m on server") + self.fail(_("File not m on server")) diff --git a/pyload/plugins/hoster/Ftp.py b/pyload/plugins/hoster/Ftp.py index f092bd0a4..a846d2b5f 100644 --- a/pyload/plugins/hoster/Ftp.py +++ b/pyload/plugins/hoster/Ftp.py @@ -10,22 +10,24 @@ from pyload.plugins.base.Hoster import Hoster class Ftp(Hoster): - __name__ = "Ftp" - __type__ = "hoster" - __version__ = "0.42" + __name__ = "Ftp" + __type__ = "hoster" + __version__ = "0.43" - __pattern__ = r'(ftps?|sftp)://(.*?:.*?@)?.*?/.*' #: ftp://user:password@ftp.server.org/path/to/file + __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' __description__ = """Download from ftp directory""" - __authors__ = [("jeix", "jeix@hasnomail.com"), - ("mkaay", "mkaay@mkaay.de"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.com"), + ("mkaay", "mkaay@mkaay.de"), + ("zoidberg", "zoidberg@mujmail.cz")] def setup(self): self.chunkLimit = -1 self.resumeDownload = True + def process(self, pyfile): parsed_url = urlparse(pyfile.url) netloc = parsed_url.netloc @@ -43,7 +45,7 @@ class Ftp(Hoster): self.logDebug("Logging on to %s" % netloc) self.req.addAuth(self.account.accounts[netloc]['password']) else: - for pwd in pyfile.package().password.splitlines(): + for pwd in self.getPassword().splitlines(): if ":" in pwd: self.req.addAuth(pwd.strip()) break @@ -51,14 +53,14 @@ class Ftp(Hoster): self.req.http.c.setopt(pycurl.NOBODY, 1) try: - response = self.load(pyfile.url) + res = self.load(pyfile.url) except pycurl.error, e: - self.fail("Error %d: %s" % e.args) + self.fail(_("Error %d: %s") % e.args) self.req.http.c.setopt(pycurl.NOBODY, 0) self.logDebug(self.req.http.header) - m = re.search(r"Content-Length:\s*(\d+)", response) + m = re.search(r"Content-Length:\s*(\d+)", res) if m: pyfile.size = int(m.group(1)) self.download(pyfile.url) @@ -69,9 +71,9 @@ class Ftp(Hoster): pkgname = "/".join(pyfile.package().name, urlparse(pyfile.url).path.rpartition('/')[2]) pyfile.url += '/' self.req.http.c.setopt(48, 1) # CURLOPT_DIRLISTONLY - response = self.load(pyfile.url, decode=False) - links = [pyfile.url + quote(x) for x in response.splitlines()] + res = self.load(pyfile.url, decode=False) + links = [pyfile.url + quote(x) for x in res.splitlines()] self.logDebug("LINKS", links) self.core.api.addPackage(pkgname, links) else: - self.fail("Unexpected server response") + self.fail(_("Unexpected server response")) diff --git a/pyload/plugins/hoster/GamefrontCom.py b/pyload/plugins/hoster/GamefrontCom.py index b19de0717..f502d9af4 100644 --- a/pyload/plugins/hoster/GamefrontCom.py +++ b/pyload/plugins/hoster/GamefrontCom.py @@ -8,25 +8,27 @@ from pyload.utils import parseFileSize class GamefrontCom(Hoster): - __name__ = "GamefrontCom" - __type__ = "hoster" + __name__ = "GamefrontCom" + __type__ = "hoster" __version__ = "0.04" - __pattern__ = r'http://(?:www\.)?gamefront.com/files/[A-Za-z0-9]+' + __pattern__ = r'http://(?:www\.)?gamefront\.com/files/\w+' __description__ = """Gamefront.com hoster plugin""" - __authors__ = [("fwannmacher", "felipe@warhammerproject.com")] + __license__ = "GPLv3" + __authors__ = [("fwannmacher", "felipe@warhammerproject.com")] PATTERN_FILENAME = r'<title>(.*?) | Game Front' PATTERN_FILESIZE = r'<dt>File Size:</dt>[\n\s]*<dd>(.*?)</dd>' - PATTERN_OFFLINE = r"This file doesn't exist, or has been removed." + PATTERN_OFFLINE = r'This file doesn\'t exist, or has been removed.' def setup(self): self.resumeDownload = self.multiDL = True self.chunkLimit = -1 + def process(self, pyfile): self.pyfile = pyfile self.html = self.load(pyfile.url, decode=True) @@ -43,23 +45,26 @@ class GamefrontCom(Hoster): self.download(link) + def _checkOnline(self): if re.search(self.PATTERN_OFFLINE, self.html): return False else: return True + def _getName(self): name = re.search(self.PATTERN_FILENAME, self.html) if name is None: - self.fail("%s: Plugin broken." % self.__name__) + self.fail(_("Plugin broken") return name.group(1) + def _getLink(self): - self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=[A-Za-z0-9]+)", + self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=\w+)", self.html).group(1)) - return re.search("<a href=\"(http://media[0-9]+\.gamefront.com/.*)\">click here</a>", self.html2).group(1).replace("&", "&") + return re.search("<a href=\"(http://media\d+\.gamefront.com/.*)\">click here</a>", self.html2).group(1).replace("&", "&") def getInfo(urls): diff --git a/pyload/plugins/hoster/GigapetaCom.py b/pyload/plugins/hoster/GigapetaCom.py index 08e889bb9..74d2b3e49 100644 --- a/pyload/plugins/hoster/GigapetaCom.py +++ b/pyload/plugins/hoster/GigapetaCom.py @@ -9,18 +9,19 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class GigapetaCom(SimpleHoster): - __name__ = "GigapetaCom" - __type__ = "hoster" - __version__ = "0.01" + __name__ = "GigapetaCom" + __type__ = "hoster" + __version__ = "0.02" __pattern__ = r'http://(?:www\.)?gigapeta\.com/dl/\w+' __description__ = """GigaPeta.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<img src=".*" alt="file" />-->\s*(?P<N>.*?)\s*</td>' - FILE_SIZE_PATTERN = r'<th>\s*Size\s*</th>\s*<td>\s*(?P<S>.*?)\s*</td>' + NAME_PATTERN = r'<img src=".*" alt="file" />-->\s*(?P<N>.*?)\s*</td>' + SIZE_PATTERN = r'<th>\s*Size\s*</th>\s*<td>\s*(?P<S>.*?)\s*</td>' OFFLINE_PATTERN = r'<div id="page_error">' COOKIES = [(".gigapeta.com", "lang", "us")] @@ -32,7 +33,7 @@ class GigapetaCom(SimpleHoster): self.req.http.c.setopt(FOLLOWLOCATION, 0) - for _ in xrange(5): + for _i in xrange(5): self.checkErrors() captcha = self.decryptCaptcha(captcha_url) @@ -41,22 +42,22 @@ class GigapetaCom(SimpleHoster): "captcha": captcha, "download": "Download"}) - m = re.search(r"Location\s*:\s*(.*)", self.req.http.header, re.I) + m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I) if m: - download_url = m.group(1) + download_url = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 break elif "Entered figures don`t coincide with the picture" in self.html: self.invalidCaptcha() else: - self.fail("No valid captcha code entered") + self.fail(_("No valid captcha code entered")) self.req.http.c.setopt(FOLLOWLOCATION, 1) - self.logDebug("Download URL: %s" % download_url) self.download(download_url) + def checkErrors(self): if "All threads for IP" in self.html: - self.logDebug("Your IP is already downloading a file - wait and retry") + self.logDebug("Your IP is already downloading a file") self.wait(5 * 60, True) self.retry() diff --git a/pyload/plugins/hoster/GooIm.py b/pyload/plugins/hoster/GooIm.py index 5b48087f3..28f50661b 100644 --- a/pyload/plugins/hoster/GooIm.py +++ b/pyload/plugins/hoster/GooIm.py @@ -9,23 +9,25 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class GooIm(SimpleHoster): - __name__ = "GooIm" - __type__ = "hoster" + __name__ = "GooIm" + __type__ = "hoster" __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?goo\.im/.+' __description__ = """Goo.im hoster plugin""" - __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - FILE_NAME_PATTERN = r'You will be redirected to .*(?P<N>[^/ ]+) in' + NAME_PATTERN = r'You will be redirected to .*(?P<N>[^/ ]+) in' OFFLINE_PATTERN = r'The file you requested was not found' def setup(self): self.multiDL = self.resumeDownload = True + def handleFree(self): url = self.pyfile.url self.html = self.load(url, cookies=True) diff --git a/pyload/plugins/hoster/HellshareCz.py b/pyload/plugins/hoster/HellshareCz.py index 7edba3a7d..90dfb4dd6 100644 --- a/pyload/plugins/hoster/HellshareCz.py +++ b/pyload/plugins/hoster/HellshareCz.py @@ -6,18 +6,19 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class HellshareCz(SimpleHoster): - __name__ = "HellshareCz" - __type__ = "hoster" - __version__ = "0.82" + __name__ = "HellshareCz" + __type__ = "hoster" + __version__ = "0.83" __pattern__ = r'(http://(?:www\.)?hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+).*' __description__ = """Hellshare.cz hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<h1 id="filename"[^>]*>(?P<N>[^<]+)</h1>' - FILE_SIZE_PATTERN = r'<strong id="FileSize_master">(?P<S>[0-9.]*) (?P<U>[kKMG])i?B</strong>' + NAME_PATTERN = r'<h1 id="filename"[^>]*>(?P<N>[^<]+)</h1>' + SIZE_PATTERN = r'<strong id="FileSize_master">(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' OFFLINE_PATTERN = r'<h1>File not found.</h1>' SHOW_WINDOW_PATTERN = r'<a href="([^?]+/(\d+)/\?do=(fileDownloadButton|relatedFileDownloadButton-\2)-showDownloadWindow)"' @@ -26,21 +27,21 @@ class HellshareCz(SimpleHoster): self.resumeDownload = self.multiDL = True if self.account else False self.chunkLimit = 1 + def process(self, pyfile): if not self.account: - self.fail("User not logged in") + self.fail(_("User not logged in")) pyfile.url = re.match(self.__pattern__, pyfile.url).group(1) self.html = self.load(pyfile.url, decode=True) self.getFileInfo() if not self.checkTrafficLeft(): - self.fail("Not enough traffic left for user %s." % self.user) + self.fail(_("Not enough traffic left for user ") + self.user) m = re.search(self.SHOW_WINDOW_PATTERN, self.html) if m is None: - self.parseError('SHOW WINDOW') - self.url = "http://www.hellshare.com" + m.group(1) - self.logDebug("DOWNLOAD URL: " + self.url) + self.error(_("SHOW_WINDOW_PATTERN not found")) + self.url = "http://www.hellshare.com" + m.group(1) self.download(self.url) diff --git a/pyload/plugins/hoster/HellspyCz.py b/pyload/plugins/hoster/HellspyCz.py index fabd3de35..f3578c0f3 100644 --- a/pyload/plugins/hoster/HellspyCz.py +++ b/pyload/plugins/hoster/HellspyCz.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class HellspyCz(DeadHoster): - __name__ = "HellspyCz" - __type__ = "hoster" + __name__ = "HellspyCz" + __type__ = "hoster" __version__ = "0.28" - __pattern__ = r'http://(?:www\.)?(?:hellspy\.(?:cz|com|sk|hu|pl)|sciagaj.pl)(/\S+/\d+)/?.*' + __pattern__ = r'http://(?:www\.)?(?:hellspy\.(?:cz|com|sk|hu|pl)|sciagaj\.pl)(/\S+/\d+)/?.*' __description__ = """HellSpy.cz hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] getInfo = create_getInfo(HellspyCz) diff --git a/pyload/plugins/hoster/HotfileCom.py b/pyload/plugins/hoster/HotfileCom.py index 313547275..bede362e5 100644 --- a/pyload/plugins/hoster/HotfileCom.py +++ b/pyload/plugins/hoster/HotfileCom.py @@ -4,17 +4,18 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class HotfileCom(DeadHoster): - __name__ = "HotfileCom" - __type__ = "hoster" + __name__ = "HotfileCom" + __type__ = "hoster" __version__ = "0.37" __pattern__ = r'https?://(?:www\.)?hotfile\.com/dl/\d+/\w+' __description__ = """Hotfile.com hoster plugin""" - __authors__ = [("sitacuisses", "sitacuisses@yhoo.de"), - ("spoob", "spoob@pyload.org"), - ("mkaay", "mkaay@mkaay.de"), - ("JoKoT3", "jokot3@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("sitacuisses", "sitacuisses@yhoo.de"), + ("spoob", "spoob@pyload.org"), + ("mkaay", "mkaay@mkaay.de"), + ("JoKoT3", "jokot3@gmail.com")] getInfo = create_getInfo(HotfileCom) diff --git a/pyload/plugins/hoster/HugefilesNet.py b/pyload/plugins/hoster/HugefilesNet.py index 3b9f81eb0..cbbce119f 100644 --- a/pyload/plugins/hoster/HugefilesNet.py +++ b/pyload/plugins/hoster/HugefilesNet.py @@ -3,23 +3,24 @@ # Test links: # http://hugefiles.net/prthf9ya4w6s -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class HugefilesNet(XFSPHoster): - __name__ = "HugefilesNet" - __type__ = "hoster" - __version__ = "0.01" +class HugefilesNet(XFSHoster): + __name__ = "HugefilesNet" + __type__ = "hoster" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?hugefiles\.net/\w{12}' __description__ = """Hugefiles.net hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] - HOSTER_NAME = "hugefiles.net" + HOSTER_DOMAIN = "hugefiles.net" - FILE_SIZE_PATTERN = r'File Size:</span>\s*<span[^>]*>(?P<S>[^<]+)</span></div>' + SIZE_PATTERN = r'File Size:</span>\s*<span[^>]*>(?P<S>[^<]+)</span></div>' getInfo = create_getInfo(HugefilesNet) diff --git a/pyload/plugins/hoster/HundredEightyUploadCom.py b/pyload/plugins/hoster/HundredEightyUploadCom.py index 191b9156a..48e0c3d8c 100644 --- a/pyload/plugins/hoster/HundredEightyUploadCom.py +++ b/pyload/plugins/hoster/HundredEightyUploadCom.py @@ -3,24 +3,25 @@ # Test links: # http://180upload.com/js9qdm6kjnrs -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class HundredEightyUploadCom(XFSPHoster): - __name__ = "HundredEightyUploadCom" - __type__ = "hoster" - __version__ = "0.01" +class HundredEightyUploadCom(XFSHoster): + __name__ = "HundredEightyUploadCom" + __type__ = "hoster" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?180upload\.com/\w{12}' __description__ = """180upload.com hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] - HOSTER_NAME = "180upload.com" + HOSTER_DOMAIN = "180upload.com" - FILE_NAME_PATTERN = r'Filename:</b></td><td nowrap>(?P<N>.+)</td></tr>-->' - FILE_SIZE_PATTERN = r'Size:</b></td><td>(?P<S>[\d.]+) (?P<U>[A-Z]+)\s*<small>' + NAME_PATTERN = r'Filename:</b></td><td nowrap>(?P<N>.+)</td></tr>-->' + SIZE_PATTERN = r'Size:</b></td><td>(?P<S>[\d.,]+) (?P<U>[\w^_]+)\s*<small>' getInfo = create_getInfo(HundredEightyUploadCom) diff --git a/pyload/plugins/hoster/IFileWs.py b/pyload/plugins/hoster/IFileWs.py index b0cdab64b..d92ec087d 100644 --- a/pyload/plugins/hoster/IFileWs.py +++ b/pyload/plugins/hoster/IFileWs.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class IFileWs(DeadHoster): - __name__ = "IFileWs" - __type__ = "hoster" + __name__ = "IFileWs" + __type__ = "hoster" __version__ = "0.02" __pattern__ = r'http://(?:www\.)?ifile\.ws/\w{12}' __description__ = """Ifile.ws hoster plugin""" - __authors__ = [("z00nx", "z00nx0@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("z00nx", "z00nx0@gmail.com")] getInfo = create_getInfo(IFileWs) diff --git a/pyload/plugins/hoster/IcyFilesCom.py b/pyload/plugins/hoster/IcyFilesCom.py index 637136e9d..126b9208d 100644 --- a/pyload/plugins/hoster/IcyFilesCom.py +++ b/pyload/plugins/hoster/IcyFilesCom.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class IcyFilesCom(DeadHoster): - __name__ = "IcyFilesCom" - __type__ = "hoster" + __name__ = "IcyFilesCom" + __type__ = "hoster" __version__ = "0.06" __pattern__ = r'http://(?:www\.)?icyfiles\.com/(.*)' __description__ = """IcyFiles.com hoster plugin""" - __authors__ = [("godofdream", "soilfiction@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("godofdream", "soilfiction@gmail.com")] getInfo = create_getInfo(IcyFilesCom) diff --git a/pyload/plugins/hoster/IfileIt.py b/pyload/plugins/hoster/IfileIt.py index ec6a86dc7..75c2f115c 100644 --- a/pyload/plugins/hoster/IfileIt.py +++ b/pyload/plugins/hoster/IfileIt.py @@ -8,19 +8,20 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class IfileIt(SimpleHoster): - __name__ = "IfileIt" - __type__ = "hoster" - __version__ = "0.27" + __name__ = "IfileIt" + __type__ = "hoster" + __version__ = "0.28" __pattern__ = r'^unmatchable$' __description__ = """Ifile.it""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] LINK_PATTERN = r'</span> If it doesn\'t, <a target="_blank" href="([^"]+)">' - RECAPTCHA_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" - FILE_INFO_PATTERN = r'<span style="cursor: default;[^>]*>\s*(?P<N>.*?)\s* \s*<strong>\s*(?P<S>[0-9.]+)\s*(?P<U>[kKMG])i?B\s*</strong>\s*</span>' + RECAPTCHA_PATTERN = r'var __recaptcha_public\s*=\s*\'(.+?)\'' + INFO_PATTERN = r'<span style="cursor: default;[^>]*>\s*(?P<N>.*?)\s* \s*<strong>\s*(?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)\s*</strong>\s*</span>' OFFLINE_PATTERN = r'<span style="cursor: default;[^>]*>\s* \s*<strong>\s*</strong>\s*</span>' TEMP_OFFLINE_PATTERN = r'<span class="msg_red">Downloading of this file is temporarily disabled</span>' @@ -41,7 +42,7 @@ class IfileIt(SimpleHoster): recaptcha = ReCaptcha(self) post_data['ctype'] = "recaptcha" - for _ in xrange(5): + for _i in xrange(5): post_data['recaptcha_challenge'], post_data['recaptcha_response'] = recaptcha.challenge(captcha_key) json_response = json_loads(self.load(json_url, post=post_data)) self.logDebug(json_response) @@ -52,10 +53,10 @@ class IfileIt(SimpleHoster): self.correctCaptcha() break else: - self.fail("Incorrect captcha") + self.fail(_("Incorrect captcha")) if not "ticket_url" in json_response: - self.parseError("Download URL") + self.error(_("No download URL")) self.download(json_response['ticket_url']) diff --git a/pyload/plugins/hoster/IfolderRu.py b/pyload/plugins/hoster/IfolderRu.py index 3de9b2e38..2a961f780 100644 --- a/pyload/plugins/hoster/IfolderRu.py +++ b/pyload/plugins/hoster/IfolderRu.py @@ -6,24 +6,25 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class IfolderRu(SimpleHoster): - __name__ = "IfolderRu" - __type__ = "hoster" + __name__ = "IfolderRu" + __type__ = "hoster" __version__ = "0.38" __pattern__ = r'http://(?:www\.)?(?:ifolder\.ru|rusfolder\.(?:com|net|ru))/(?:files/)?(?P<ID>\d+).*' __description__ = """Ifolder.ru hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_SIZE_REPLACEMENTS = [(u'Ðб', 'KB'), (u'Ðб', 'MB'), (u'Ðб', 'GB')] - FILE_NAME_PATTERN = ur'(?:<div><span>)?ÐазваМОе:(?:</span>)? <b>(?P<N>[^<]+)</b><(?:/div|br)>' - FILE_SIZE_PATTERN = ur'(?:<div><span>)?РазЌеÑ:(?:</span>)? <b>(?P<S>[^<]+)</b><(?:/div|br)>' + SIZE_REPLACEMENTS = [(u'Ðб', 'KB'), (u'Ðб', 'MB'), (u'Ðб', 'GB')] + NAME_PATTERN = ur'(?:<div><span>)?ÐазваМОе:(?:</span>)? <b>(?P<N>[^<]+)</b><(?:/div|br)>' + SIZE_PATTERN = ur'(?:<div><span>)?РазЌеÑ:(?:</span>)? <b>(?P<S>[^<]+)</b><(?:/div|br)>' OFFLINE_PATTERN = ur'<p>Ѐайл ÐœÐŸÐŒÐµÑ <b>[^<]*</b> (Ме МайЎеМ|ÑЎалеМ) !!!</p>' - SESSION_ID_PATTERN = r'<a href=(http://ints.(?:rusfolder.com|ifolder.ru)/ints/sponsor/\?bi=\d*&session=([^&]+)&u=[^>]+)>' - INTS_SESSION_PATTERN = r'\(\'ints_session\'\);\s*if\(tag\)\{tag.value = "([^"]+)";\}' - HIDDEN_INPUT_PATTERN = r"var v = .*?name='([^']+)' value='1'" + SESSION_ID_PATTERN = r'<a href=(http://ints\.(?:rusfolder\.com|ifolder\.ru)/ints/sponsor/\?bi=\d*&session=([^&]+)&u=[^>]+)>' + INTS_SESSION_PATTERN = r'\(\'ints_session\'\);\s*if\(tag\)\{tag\.value = "([^"]+)";\}' + HIDDEN_INPUT_PATTERN = r'var v = .*?name=\'(.+?)\' value=\'1\'' LINK_PATTERN = r'<a id="download_file_href" href="([^"]+)"' WRONG_CAPTCHA_PATTERN = ur'<font color=Red>МевеÑÐœÑй кПЎ,<br>ввеЎОÑе еÑе Ñаз</font><br>' @@ -32,6 +33,7 @@ class IfolderRu(SimpleHoster): self.resumeDownload = self.multiDL = True if self.account else False self.chunkLimit = 1 + def process(self, pyfile): file_id = re.match(self.__pattern__, pyfile.url).group('ID') self.html = self.load("http://rusfolder.com/%s" % file_id, cookies=True, decode=True) @@ -49,7 +51,7 @@ class IfolderRu(SimpleHoster): self.wait(31, False) captcha_url = "http://ints.rusfolder.com/random/images/?session=%s" % session_id - for _ in xrange(5): + for _i in xrange(5): self.html = self.load(url, cookies=True) action, inputs = self.parseHtmlForm('ID="Form1"') inputs['ints_session'] = re.search(self.INTS_SESSION_PATTERN, self.html).group(1) @@ -64,11 +66,10 @@ class IfolderRu(SimpleHoster): else: break else: - self.fail("Invalid captcha") + self.fail(_("Invalid captcha")) download_url = re.search(self.LINK_PATTERN, self.html).group(1) self.correctCaptcha() - self.logDebug("Download URL: %s" % download_url) self.download(download_url) diff --git a/pyload/plugins/hoster/JumbofilesCom.py b/pyload/plugins/hoster/JumbofilesCom.py index c17a2d454..e39bbcc20 100644 --- a/pyload/plugins/hoster/JumbofilesCom.py +++ b/pyload/plugins/hoster/JumbofilesCom.py @@ -6,17 +6,18 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class JumbofilesCom(SimpleHoster): - __name__ = "JumbofilesCom" - __type__ = "hoster" + __name__ = "JumbofilesCom" + __type__ = "hoster" __version__ = "0.02" - __pattern__ = r'http://(?:www\.)?jumbofiles.com/(\w{12}).*' + __pattern__ = r'http://(?:www\.)?jumbofiles\.com/(\w{12}).*' __description__ = """JumboFiles.com hoster plugin""" - __authors__ = [("godofdream", "soilfiction@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("godofdream", "soilfiction@gmail.com")] - FILE_INFO_PATTERN = r'<TR><TD>(?P<N>[^<]+?)\s*<small>\((?P<S>[\d.]+)\s*(?P<U>[KMG][bB])\)</small></TD></TR>' + INFO_PATTERN = r'<TR><TD>(?P<N>[^<]+?)\s*<small>\((?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)' OFFLINE_PATTERN = r'Not Found or Deleted / Disabled due to inactivity or DMCA' LINK_PATTERN = r'<meta http-equiv="refresh" content="10;url=(.+)">' @@ -24,12 +25,12 @@ class JumbofilesCom(SimpleHoster): def setup(self): self.resumeDownload = self.multiDL = True + def handleFree(self): ukey = re.match(self.__pattern__, self.pyfile.url).group(1) post_data = {"id": ukey, "op": "download3", "rand": ""} html = self.load(self.pyfile.url, post=post_data, decode=True) url = re.search(self.LINK_PATTERN, html).group(1) - self.logDebug("Download " + url) self.download(url) diff --git a/pyload/plugins/hoster/Keep2shareCC.py b/pyload/plugins/hoster/Keep2shareCC.py deleted file mode 100644 index 7e030a685..000000000 --- a/pyload/plugins/hoster/Keep2shareCC.py +++ /dev/null @@ -1,113 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from urlparse import urlparse, urljoin - -from pyload.plugins.internal.CaptchaService import ReCaptcha -from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo - - -class Keep2shareCC(SimpleHoster): - __name__ = "Keep2shareCC" - __type__ = "hoster" - __version__ = "0.10" - - __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+)' - - __description__ = """Keep2share.cc hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - FILE_NAME_PATTERN = r'File: <span>(?P<N>.+)</span>' - FILE_SIZE_PATTERN = r'Size: (?P<S>[^<]+)</div>' - OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' - - LINK_PATTERN = r'To download this file with slow speed, use <a href="([^"]+)">this link</a>' - WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' - MULTIDL_ERROR = r'Free account does not allow to download more than one file at the same time' - - - def handleFree(self): - self.sanitize_url() - self.html = self.load(self.pyfile.url) - - self.fid = re.search(r'<input type="hidden" name="slow_id" value="([^"]+)">', self.html).group(1) - self.html = self.load(self.pyfile.url, post={'yt0': '', 'slow_id': self.fid}) - - m = re.search(r"function download\(\){.*window\.location\.href = '([^']+)';", self.html, re.DOTALL) - if m: # Direct mode - self.startDownload(m.group(1)) - else: - self.handleCaptcha() - - self.wait(30) - - self.html = self.load(self.pyfile.url, post={'uniqueId': self.fid, 'free': 1}) - - m = re.search(self.WAIT_PATTERN, self.html) - if m: - self.logDebug("Hoster told us to wait for %s" % m.group(1)) - # string to time convert courtesy of https://stackoverflow.com/questions/10663720 - ftr = [3600, 60, 1] - wait_time = sum([a * b for a, b in zip(ftr, map(int, m.group(1).split(':')))]) - self.wait(wait_time, reconnect=True) - self.retry() - - m = re.search(self.MULTIDL_ERROR, self.html) - if m: - # if someone is already downloading on our line, wait 30min and retry - self.logDebug("Already downloading, waiting for 30 minutes") - self.wait(30 * 60, reconnect=True) - self.retry() - - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.parseError("Unable to detect direct link") - self.startDownload(m.group(1)) - - - def handleCaptcha(self): - recaptcha = ReCaptcha(self) - - captcha_key = recaptcha.detect_key() - if captcha_key is None: - self.parseError("ReCaptcha key not found") - - for _ in xrange(5): - challenge, response = recaptcha.challenge(captcha_key) - post_data = {'recaptcha_challenge_field': challenge, - 'recaptcha_response_field': response, - 'CaptchaForm%5Bcode%5D': '', - 'free': 1, - 'freeDownloadRequest': 1, - 'uniqueId': self.fid, - 'yt0': ''} - - self.html = self.load(self.pyfile.url, post=post_data) - - if 'recaptcha' not in self.html: - self.correctCaptcha() - break - else: - self.logInfo("Wrong captcha") - self.invalidCaptcha() - else: - self.fail("All captcha attempts failed") - - - def startDownload(self, url): - d = urljoin(self.base_url, url) - self.logDebug("Direct Link: " + d) - self.download(d, disposition=True) - - - def sanitize_url(self): - header = self.load(self.pyfile.url, just_header=True) - if 'location' in header: - self.pyfile.url = header['location'] - p = urlparse(self.pyfile.url) - self.base_url = "%s://%s" % (p.scheme, p.hostname) - - -getInfo = create_getInfo(Keep2shareCC) diff --git a/pyload/plugins/hoster/LemUploadsCom.py b/pyload/plugins/hoster/LemUploadsCom.py index 62da76783..0ef739a56 100644 --- a/pyload/plugins/hoster/LemUploadsCom.py +++ b/pyload/plugins/hoster/LemUploadsCom.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class LemUploadsCom(DeadHoster): - __name__ = "LemUploadsCom" - __type__ = "hoster" + __name__ = "LemUploadsCom" + __type__ = "hoster" __version__ = "0.02" __pattern__ = r'https?://(?:www\.)?lemuploads\.com/\w{12}' __description__ = """LemUploads.com hoster plugin""" - __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] + __license__ = "GPLv3" + __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] getInfo = create_getInfo(LemUploadsCom) diff --git a/pyload/plugins/hoster/LetitbitNet.py b/pyload/plugins/hoster/LetitbitNet.py index f1256f53a..16f01bf06 100644 --- a/pyload/plugins/hoster/LetitbitNet.py +++ b/pyload/plugins/hoster/LetitbitNet.py @@ -9,6 +9,7 @@ import re from urllib import urlencode, urlopen +from urlparse import urljoin from pyload.utils import json_loads, json_dumps from pyload.plugins.hoster.UnrestrictLi import secondsToMidnight @@ -34,28 +35,27 @@ def getInfo(urls): class LetitbitNet(SimpleHoster): - __name__ = "LetitbitNet" - __type__ = "hoster" - __version__ = "0.24" + __name__ = "LetitbitNet" + __type__ = "hoster" + __version__ = "0.26" - __pattern__ = r'http://(?:www\.)?(letitbit|shareflare).net/download/.*' + __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.*' __description__ = """Letitbit.net hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("z00nx", "z00nx0@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("z00nx", "z00nx0@gmail.com")] - FILE_URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")] - - HOSTER_NAME = "letitbit.net" + URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")] SECONDS_PATTERN = r'seconds\s*=\s*(\d+);' - CAPTCHA_CONTROL_FIELD = r"recaptcha_control_field\s=\s'(?P<value>[^']+)'" + CAPTCHA_CONTROL_FIELD = r'recaptcha_control_field\s=\s\'(?P<value>.+?)\'' def setup(self): self.resumeDownload = True - #TODO confirm that resume works + def getFileInfo(self): api_rep = api_download_info(self.pyfile.url) @@ -66,33 +66,17 @@ class LetitbitNet(SimpleHoster): else: self.offline() + def handleFree(self): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: - self.parseError("page 1 / ifree_form") + self.error(_("ifree_form")) - domain = "http://www." + self.HOSTER_NAME self.pyfile.size = float(inputs['sssize']) self.logDebug(action, inputs) inputs['desc'] = "" - self.html = self.load(domain + action, post=inputs, cookies=True) - - # action, inputs = self.parseHtmlForm('id="d3_form"') - # if not action: - # self.parseError("page 2 / d3_form") - # self.logDebug(action, inputs) - # - # self.html = self.load(action, post = inputs, cookies = True) - # - # try: - # ajax_check_url, captcha_url = re.search(self.CHECK_URL_PATTERN, self.html).groups() - # m = re.search(self.SECONDS_PATTERN, self.html) - # seconds = int(m.group(1)) if m else 60 - # self.wait(seconds+1) - # except Exception, e: - # self.logError(e) - # self.parseError("page 3 / js") + self.html = self.load(urljoin("http://letitbit.net/", action), post=inputs, cookies=True) m = re.search(self.SECONDS_PATTERN, self.html) seconds = int(m.group(1)) if m else 60 @@ -100,53 +84,48 @@ class LetitbitNet(SimpleHoster): m = re.search(self.CAPTCHA_CONTROL_FIELD, self.html) recaptcha_control_field = m.group(1) self.logDebug("ReCaptcha control field found", recaptcha_control_field) - self.wait(seconds + 1) + self.wait(seconds) - response = self.load("%s/ajax/download3.php" % domain, post=" ", cookies=True) - if response != '1': - self.parseError('Unknown response - ajax_check_url') - self.logDebug(response) + res = self.load("http://letitbit.net/ajax/download3.php", post=" ", cookies=True) + if res != '1': + self.error(_("Unknown response - ajax_check_url")) + self.logDebug(res) recaptcha = ReCaptcha(self) + challenge, response = recaptcha.challenge() - captcha_key = recaptcha.detect_key() - if captcha_key is None: - self.parseError("ReCaptcha key not found") - - challenge, response = recaptcha.challenge(captcha_key) - - post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, + post_data = {"recaptcha_challenge_field": challenge, + "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field} self.logDebug("Post data to send", post_data) - response = self.load('%s/ajax/check_recaptcha.php' % domain, post=post_data, cookies=True) - self.logDebug(response) - if not response: + res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True) + self.logDebug(res) + if not res: self.invalidCaptcha() - if response == "error_free_download_blocked": - self.logWarning("Daily limit reached") + if res == "error_free_download_blocked": + self.logWarning(_("Daily limit reached")) self.wait(secondsToMidnight(gmt=2), True) - if response == "error_wrong_captcha": - self.logError("Wrong Captcha") + if res == "error_wrong_captcha": self.invalidCaptcha() self.retry() - elif response.startswith('['): - urls = json_loads(response) - elif response.startswith('http://'): - urls = [response] + elif res.startswith('['): + urls = json_loads(res) + elif res.startswith('http://'): + urls = [res] else: - self.parseError("Unknown response - captcha check") + self.error(_("Unknown response - captcha check")) self.correctCaptcha() for download_url in urls: try: - self.logDebug("Download URL", download_url) self.download(download_url) break except Exception, e: self.logError(e) else: - self.fail("Download did not finish correctly") + self.fail(_("Download did not finish correctly")) + def handlePremium(self): api_key = self.user diff --git a/pyload/plugins/hoster/LinksnappyCom.py b/pyload/plugins/hoster/LinksnappyCom.py index ff9df1dff..c37006ac2 100644 --- a/pyload/plugins/hoster/LinksnappyCom.py +++ b/pyload/plugins/hoster/LinksnappyCom.py @@ -9,14 +9,15 @@ from pyload.plugins.base.Hoster import Hoster class LinksnappyCom(Hoster): - __name__ = "LinksnappyCom" - __type__ = "hoster" + __name__ = "LinksnappyCom" + __type__ = "hoster" __version__ = "0.02" __pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com' __description__ = """Linksnappy.com hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] SINGLE_CHUNK_HOSTERS = ('easybytez.com') @@ -26,12 +27,13 @@ class LinksnappyCom(Hoster): self.chunkLimit = -1 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "Linksnappy.com") - self.fail("No Linksnappy.com account provided") + self.fail(_("No Linksnappy.com account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) host = self._get_host(pyfile.url) @@ -46,8 +48,9 @@ class LinksnappyCom(Hoster): j = json_loads(r)['links'][0] if j['error']: - self.logError("Error converting the link: %s" % j['error']) - self.fail('Error converting the link') + msg = _("Error converting the link") + self.logError(msg, j['error']) + self.fail(msg) pyfile.name = j['filename'] new_url = j['generated'] @@ -64,7 +67,8 @@ class LinksnappyCom(Hoster): check = self.checkDownload({"html302": "<title>302 Found</title>"}) if check == "html302": - self.retry(wait_time=5, reason="Linksnappy returns only HTML data.") + self.retry(wait_time=5, reason=_("Linksnappy returns only HTML data")) + @staticmethod def _get_host(url): diff --git a/pyload/plugins/hoster/LoadTo.py b/pyload/plugins/hoster/LoadTo.py index 4f5197f13..974a27d29 100644 --- a/pyload/plugins/hoster/LoadTo.py +++ b/pyload/plugins/hoster/LoadTo.py @@ -11,25 +11,26 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LoadTo(SimpleHoster): - __name__ = "LoadTo" - __type__ = "hoster" - __version__ = "0.16" + __name__ = "LoadTo" + __type__ = "hoster" + __version__ = "0.18" __pattern__ = r'http://(?:www\.)?load\.to/\w+' __description__ = """Load.to hoster plugin""" - __authors__ = [("halfman", "Pulpan3@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("halfman", "Pulpan3@gmail.com"), + ("stickell", "l.stickell@yahoo.it")] - FILE_NAME_PATTERN = r'<h1>(?P<N>.+)</h1>' - FILE_SIZE_PATTERN = r'Size: (?P<S>[\d.]+) (?P<U>\w+)' + NAME_PATTERN = r'<h1>(?P<N>.+)</h1>' + SIZE_PATTERN = r'Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>Can\'t find file' LINK_PATTERN = r'<form method="post" action="(.+?)"' WAIT_PATTERN = r'type="submit" value="Download \((\d+)\)"' - FILE_URL_REPLACEMENTS = [(r'(\w)$', r'\1/')] + URL_REPLACEMENTS = [(r'(\w)$', r'\1/')] def setup(self): @@ -41,7 +42,7 @@ class LoadTo(SimpleHoster): # Search for Download URL m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError("Unable to detect download URL") + self.error(_("LINK_PATTERN not found")) download_url = m.group(1) @@ -59,11 +60,13 @@ class LoadTo(SimpleHoster): else: captcha_challenge, captcha_response = solvemedia.challenge(captcha_key) self.download(download_url, post={"adcopy_challenge": captcha_challenge, "adcopy_response": captcha_response}) - check = self.checkDownload({"404": re.compile("\A<h1>404 Not Found</h1>")}) + check = self.checkDownload({'404': re.compile("\A<h1>404 Not Found</h1>"), 'html': re.compile("html")}) if check == "404": - self.logWarning("The captcha you entered was incorrect. Please try again.") self.invalidCaptcha() self.retry() + elif check == "html": + self.logWarning(_("Downloaded file is an html page, will retry")) + self.retry() getInfo = create_getInfo(LoadTo) diff --git a/pyload/plugins/hoster/LomafileCom.py b/pyload/plugins/hoster/LomafileCom.py index a7f14b179..a7ce39d37 100644 --- a/pyload/plugins/hoster/LomafileCom.py +++ b/pyload/plugins/hoster/LomafileCom.py @@ -1,29 +1,30 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFileSharingPro import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class LomafileCom(XFSPHoster): - __name__ = "LomafileCom" - __type__ = "hoster" - __version__ = "0.3" +class LomafileCom(XFSHoster): + __name__ = "LomafileCom" + __type__ = "hoster" + __version__ = "0.51" __pattern__ = r'http://lomafile\.com/\w{12}' __description__ = """Lomafile.com hoster plugin""" - __authors__ = [("nath_schwarz", "nathan.notwhite@gmail.com"), - ("guidobelix", "guidobelix@hotmail.it")] + __license__ = "GPLv3" + __authors__ = [("nath_schwarz", "nathan.notwhite@gmail.com"), + ("guidobelix", "guidobelix@hotmail.it")] - HOSTER_NAME = "lomafile.com" + HOSTER_DOMAIN = "lomafile.com" - FILE_NAME_PATTERN = r'<a href="http://lomafile\.com/w{12}/(?P<N>.+?)">' - FILE_SIZE_PATTERN = r'Size:</b></td><td>(?P<S>[\d.]+) (?P<U>\w+)' + NAME_PATTERN = r'<a href="http://lomafile\.com/w{12}/(?P<N>.+?)">' + SIZE_PATTERN = r'Size:</b></td><td>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>(No such file|Software error:<)' TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' - CAPTCHA_URL_PATTERN = r'(http://lomafile\.com/captchas/[^"\']+)' + CAPTCHA_PATTERN = r'(http://lomafile\.com/captchas/[^"\']+)' getInfo = create_getInfo(LomafileCom) diff --git a/pyload/plugins/hoster/LuckyShareNet.py b/pyload/plugins/hoster/LuckyShareNet.py index 32f1c03bf..31de417b7 100644 --- a/pyload/plugins/hoster/LuckyShareNet.py +++ b/pyload/plugins/hoster/LuckyShareNet.py @@ -9,17 +9,18 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LuckyShareNet(SimpleHoster): - __name__ = "LuckyShareNet" - __type__ = "hoster" - __version__ = "0.02" + __name__ = "LuckyShareNet" + __type__ = "hoster" + __version__ = "0.03" - __pattern__ = r'https?://(?:www\.)?luckyshare.net/(?P<ID>\d{10,})' + __pattern__ = r'https?://(?:www\.)?luckyshare\.net/(?P<ID>\d{10,})' __description__ = """LuckyShare.net hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] - FILE_INFO_PATTERN = r"<h1 class='file_name'>(?P<N>\S+)</h1>\s*<span class='file_size'>Filesize: (?P<S>[\d.]+)(?P<U>\w+)</span>" + INFO_PATTERN = r'<h1 class=\'file_name\'>(?P<N>\S+)</h1>\s*<span class=\'file_size\'>Filesize: (?P<S>[\d.,]+)(?P<U>[\w^_]+)</span>' OFFLINE_PATTERN = r'There is no such file available' @@ -28,15 +29,16 @@ class LuckyShareNet(SimpleHoster): html = self.load(self.pyfile.url, decode=True) m = re.search(r"waitingtime = (\d+);", html) if m: - waittime = int(m.group(1)) - self.logDebug("You have to wait %d seconds between free downloads" % waittime) - self.retry(wait_time=waittime) + seconds = int(m.group(1)) + self.logDebug("You have to wait %d seconds between free downloads" % seconds) + self.retry(wait_time=seconds) else: - self.parseError('Unable to detect wait time between free downloads') + self.error(_("Unable to detect wait time between free downloads")) elif 'Hash expired' in rep: - self.retry(reason="Hash expired") + self.retry(reason=_("Hash expired")) return json_loads(rep) + # TODO: There should be a filesize limit for free downloads # TODO: Some files could not be downloaded in free mode def handleFree(self): @@ -50,12 +52,8 @@ class LuckyShareNet(SimpleHoster): recaptcha = ReCaptcha(self) - captcha_key = recaptcha.detect_key() - if captcha_key is None: - self.parseError("ReCaptcha key not found") - - for _ in xrange(5): - challenge, response = recaptcha.challenge(captcha_key) + for _i in xrange(5): + challenge, response = recaptcha.challenge() rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % (challenge, response, json['hash']), decode=True) self.logDebug("JSON: " + rep) @@ -64,13 +62,12 @@ class LuckyShareNet(SimpleHoster): self.correctCaptcha() break elif 'Verification failed' in rep: - self.logInfo("Wrong captcha") self.invalidCaptcha() else: - self.parseError('Unable to get downlaod link') + self.error(_("Unable to get downlaod link")) if not json['link']: - self.fail("No Download url retrieved/all captcha attempts failed") + self.fail(_("No Download url retrieved/all captcha attempts failed")) self.logDebug("Direct URL: " + json['link']) self.download(json['link']) diff --git a/pyload/plugins/hoster/MediafireCom.py b/pyload/plugins/hoster/MediafireCom.py index f8b204d2f..10d25ab9d 100644 --- a/pyload/plugins/hoster/MediafireCom.py +++ b/pyload/plugins/hoster/MediafireCom.py @@ -13,7 +13,7 @@ def replace_eval(js_expr): def checkHTMLHeader(url): try: - for _ in xrange(3): + for _i in xrange(3): header = getURL(url, just_header=True) for line in header.splitlines(): line = line.lower() @@ -37,39 +37,43 @@ def checkHTMLHeader(url): def getInfo(urls): for url in urls: location, status = checkHTMLHeader(url) + if status: file_info = (url, 0, status, url) else: file_info = parseFileInfo(MediafireCom, url, getURL(url, decode=True)) + yield file_info class MediafireCom(SimpleHoster): - __name__ = "MediafireCom" - __type__ = "hoster" - __version__ = "0.79" + __name__ = "MediafireCom" + __type__ = "hoster" + __version__ = "0.80" - __pattern__ = r'http://(?:www\.)?mediafire\.com/(file/|(view/?|download.php)?\?)(\w{11}|\w{15})($|/)' + __pattern__ = r'http://(?:www\.)?mediafire\.com/(file/|(view/?|download\.php)?\?)(\w{11}|\w{15})($|/)' __description__ = """Mediafire.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] LINK_PATTERN = r'<div class="download_link"[^>]*(?:z-index:(?P<zindex>\d+))?[^>]*>\s*<a href="(?P<href>http://[^"]+)"' - JS_KEY_PATTERN = r"DoShow\('mfpromo1'\);[^{]*{((\w+)='';.*?)eval\(\2\);" - JS_ZMODULO_PATTERN = r"\('z-index'\)\) \% (\d+)\)\);" + JS_KEY_PATTERN = r'DoShow\(\'mfpromo1\'\);[^{]*{((\w+)=\'\';.*?)eval\(\2\);' + JS_ZMODULO_PATTERN = r'\(\'z-index\'\)\) \% (\d+)\)\);' PAGE1_ACTION_PATTERN = r'<link rel="canonical" href="([^"]+)"/>' PASSWORD_PATTERN = r'<form name="form_password"' - FILE_NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>[^"]+)"/>' - FILE_INFO_PATTERN = r"oFileSharePopup\.ald\('(?P<ID>[^']*)','(?P<N>[^']*)','(?P<S>[^']*)','','(?P<sha256>[^']*)'\)" + NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>[^"]+)"/>' + INFO_PATTERN = r'oFileSharePopup\.ald\(\'(?P<ID>[^\']*)\',\'(?P<N>[^\']*)\',\'(?P<S>[^\']*)\',\'\',\'(?P<sha256>[^\']*)\'\)' OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>' def setup(self): self.multiDL = False + def process(self, pyfile): pyfile.url = re.sub(r'/view/?\?', '/?', pyfile.url) @@ -92,31 +96,27 @@ class MediafireCom(SimpleHoster): self.multiDL = True self.download(self.url, disposition=True) + def handleFree(self): passwords = self.getPassword().splitlines() while self.PASSWORD_PATTERN in self.html: if len(passwords): password = passwords.pop(0) - self.logInfo("Password protected link, trying " + password) + self.logInfo(_("Password protected link, trying ") + password) self.html = self.load(self.url, post={"downloadp": password}) else: - self.fail("No or incorrect password") + self.fail(_("No or incorrect password")) m = re.search(r'kNO = r"(http://.*?)";', self.html) if m is None: - self.parseError("Download URL") - download_url = m.group(1) - self.logDebug("DOWNLOAD LINK:", download_url) + self.error(_("No download URL")) + download_url = m.group(1) self.download(download_url) + def checkCaptcha(self): solvemedia = SolveMedia(self) - - captcha_key = solvemedia.detect_key() - if captcha_key is None: - self.parseError("SolveMedia key not found") - - captcha_challenge, captcha_response = solvemedia.challenge(captcha_key) + captcha_challenge, captcha_response = solvemedia.challenge() self.html = self.load(self.url, post={"adcopy_challenge": captcha_challenge, "adcopy_response": captcha_response}, decode=True) diff --git a/pyload/plugins/hoster/MegaDebridEu.py b/pyload/plugins/hoster/MegaDebridEu.py index 79a42b1cb..aaf5419e6 100644 --- a/pyload/plugins/hoster/MegaDebridEu.py +++ b/pyload/plugins/hoster/MegaDebridEu.py @@ -9,14 +9,15 @@ from pyload.plugins.base.Hoster import Hoster class MegaDebridEu(Hoster): - __name__ = "MegaDebridEu" - __type__ = "hoster" + __name__ = "MegaDebridEu" + __type__ = "hoster" __version__ = "0.4" - __pattern__ = r'^https?://(?:w{3}\d+\.mega-debrid.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[^/]+/.+$' + __pattern__ = r'^https?://(?:w{3}\d+\.mega-debrid\.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[^/]+/.+$' __description__ = """mega-debrid.eu hoster plugin""" - __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] + __license__ = "GPLv3" + __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] API_URL = "https://www.mega-debrid.eu/api.php" @@ -28,14 +29,15 @@ class MegaDebridEu(Hoster): except IndexError: return "" + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url elif not self.account: - self.exitOnFail(_("Please enter your %s account or deactivate this plugin") % "Mega-debrid.eu") + self.exitOnFail("Please enter your %s account or deactivate this plugin" % "Mega-debrid.eu") else: if not self.connectToApi(): - self.exitOnFail(_("Unable to connect to %s") % "Mega-debrid.eu") + self.exitOnFail("Unable to connect to Mega-debrid.eu") self.logDebug("Old URL: %s" % pyfile.url) new_url = self.debridLink(pyfile.url) @@ -46,6 +48,7 @@ class MegaDebridEu(Hoster): pyfile.name = filename self.download(new_url, disposition=True) + def connectToApi(self): """ Connexion to the mega-debrid API @@ -54,14 +57,15 @@ class MegaDebridEu(Hoster): user, data = self.account.selectAccount() jsonResponse = self.load(self.API_URL, get={'action': 'connectUser', 'login': user, 'password': data['password']}) - response = json_loads(jsonResponse) + res = json_loads(jsonResponse) - if response['response_code'] == "ok": - self.token = response['token'] + if res['response_code'] == "ok": + self.token = res['token'] return True else: return False + def debridLink(self, linkToDebrid): """ Debrid a link @@ -69,21 +73,22 @@ class MegaDebridEu(Hoster): """ jsonResponse = self.load(self.API_URL, get={'action': 'getLink', 'token': self.token}, post={"link": linkToDebrid}) - response = json_loads(jsonResponse) + res = json_loads(jsonResponse) - if response['response_code'] == "ok": - debridedLink = response['debridLink'][1:-1] + if res['response_code'] == "ok": + debridedLink = res['debridLink'][1:-1] return debridedLink else: self.exitOnFail("Unable to debrid %s" % linkToDebrid) + def exitOnFail(self, msg): """ exit the plugin on fail case And display the reason of this failure """ if self.getConfig("unloadFailing"): - self.logError(msg) + self.logError(_(msg)) self.resetAccount() else: - self.fail(msg) + self.fail(_(msg)) diff --git a/pyload/plugins/hoster/MegaFilesSe.py b/pyload/plugins/hoster/MegaFilesSe.py index 448e49802..4bcaa22fb 100644 --- a/pyload/plugins/hoster/MegaFilesSe.py +++ b/pyload/plugins/hoster/MegaFilesSe.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class MegaFilesSe(DeadHoster): - __name__ = "MegaFilesSe" - __type__ = "hoster" + __name__ = "MegaFilesSe" + __type__ = "hoster" __version__ = "0.02" __pattern__ = r'http://(?:www\.)?megafiles\.se/\w{12}' __description__ = """MegaFiles.se hoster plugin""" - __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] + __license__ = "GPLv3" + __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] getInfo = create_getInfo(MegaFilesSe) diff --git a/pyload/plugins/hoster/MegaNz.py b/pyload/plugins/hoster/MegaNz.py deleted file mode 100644 index bfe51b081..000000000 --- a/pyload/plugins/hoster/MegaNz.py +++ /dev/null @@ -1,132 +0,0 @@ -# -*- coding: utf-8 -*- - -import random -import re - -from Crypto.Cipher import AES -from Crypto.Util import Counter -from array import array -from base64 import standard_b64decode -from os import remove - -from pyload.utils import json_loads, json_dumps -from pyload.plugins.base.Hoster import Hoster - - -class MegaNz(Hoster): - __name__ = "MegaNz" - __type__ = "hoster" - __version__ = "0.14" - - __pattern__ = r'https?://([a-z0-9]+\.)?mega\.co\.nz/#!([a-zA-Z0-9!_\-]+)' - - __description__ = """Mega.co.nz hoster plugin""" - __authors__ = [("RaNaN", "ranan@pyload.org")] - - - API_URL = "https://g.api.mega.co.nz/cs?id=%d" - FILE_SUFFIX = ".crypted" - - - def b64_decode(self, data): - data = data.replace("-", "+").replace("_", "/") - return standard_b64decode(data + '=' * (-len(data) % 4)) - - def getCipherKey(self, key): - """ Construct the cipher key from the given data """ - a = array("I", key) - key_array = array("I", [a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7]]) - return key_array - - def callApi(self, **kwargs): - """ Dispatch a call to the api, see https://mega.co.nz/#developers """ - # generate a session id, no idea where to obtain elsewhere - uid = random.randint(10 << 9, 10 ** 10) - - resp = self.load(self.API_URL % uid, post=json_dumps([kwargs])) - self.logDebug("Api Response: " + resp) - return json_loads(resp) - - def decryptAttr(self, data, key): - - cbc = AES.new(self.getCipherKey(key), AES.MODE_CBC, "\0" * 16) - attr = cbc.decrypt(self.b64_decode(data)) - self.logDebug("Decrypted Attr: " + attr) - if not attr.startswith("MEGA"): - self.fail(_("Decryption failed")) - - # Data is padded, 0-bytes must be stripped - return json_loads(attr.replace("MEGA", "").rstrip("\0").strip()) - - def decryptFile(self, key): - """ Decrypts the file at lastDownload` """ - - # upper 64 bit of counter start - n = key[16:24] - - # convert counter to long and shift bytes - ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) - cipher = AES.new(self.getCipherKey(key), AES.MODE_CTR, counter=ctr) - - self.pyfile.setStatus("decrypting") - - file_crypted = self.lastDownload - file_decrypted = file_crypted.rsplit(self.FILE_SUFFIX)[0] - f = open(file_crypted, "rb") - df = open(file_decrypted, "wb") - - # TODO: calculate CBC-MAC for checksum - - size = 2 ** 15 # buffer size, 32k - while True: - buf = f.read(size) - if not buf: - break - - df.write(cipher.decrypt(buf)) - - f.close() - df.close() - remove(file_crypted) - - self.lastDownload = file_decrypted - - def process(self, pyfile): - - key = None - - # match is guaranteed because plugin was chosen to handle url - node = re.match(self.__pattern__, pyfile.url).group(2) - if "!" in node: - node, key = node.split("!") - - self.logDebug("File id: %s | Key: %s" % (node, key)) - - if not key: - self.fail(_("No file key provided in the URL")) - - # g is for requesting a download url - # this is similar to the calls in the mega js app, documentation is very bad - dl = self.callApi(a="g", g=1, p=node, ssl=1)[0] - - if "e" in dl: - e = dl['e'] - # ETEMPUNAVAIL (-18): Resource temporarily not available, please try again later - if e == -18: - self.retry() - else: - self.fail(_("Error code:") + e) - - # TODO: map other error codes, e.g - # EACCESS (-11): Access violation (e.g., trying to write to a read-only share) - - key = self.b64_decode(key) - attr = self.decryptAttr(dl['at'], key) - - pyfile.name = attr['n'] + self.FILE_SUFFIX - - self.download(dl['g']) - self.decryptFile(key) - - # Everything is finished and final name can be set - pyfile.name = attr['n'] diff --git a/pyload/plugins/hoster/MegacrypterCom.py b/pyload/plugins/hoster/MegacrypterCom.py index de47b70f6..4633f7d30 100644 --- a/pyload/plugins/hoster/MegacrypterCom.py +++ b/pyload/plugins/hoster/MegacrypterCom.py @@ -3,18 +3,20 @@ import re from pyload.utils import json_loads, json_dumps -from pyload.plugins.hoster.MegaNz import MegaNz +from module.plugins.hoster.MegaCoNz import MegaCoNz -class MegacrypterCom(MegaNz): - __name__ = "MegacrypterCom" - __type__ = "hoster" - __version__ = "0.2" - __pattern__ = r'(https?://[a-z0-9]{0,10}\.?megacrypter\.com/[a-zA-Z0-9!_\-]+)' +class MegacrypterCom(MegaCoNz): + __name__ = "MegacrypterCom" + __type__ = "hoster" + __version__ = "0.21" + + __pattern__ = r'(https?://\w{0,10}\.?megacrypter\.com/[\w!-]+)' __description__ = """Megacrypter.com decrypter plugin""" - __authors__ = [("GonzaloSR", "gonzalo@gonzalosr.com")] + __license__ = "GPLv3" + __authors__ = [("GonzaloSR", "gonzalo@gonzalosr.com")] API_URL = "http://megacrypter.com/api" @@ -24,9 +26,10 @@ class MegacrypterCom(MegaNz): def callApi(self, **kwargs): """ Dispatch a call to the api, see megacrypter.com/api_doc """ self.logDebug("JSON request: " + json_dumps(kwargs)) - resp = self.load(self.API_URL, post=json_dumps(kwargs)) - self.logDebug("API Response: " + resp) - return json_loads(resp) + res = self.load(self.API_URL, post=json_dumps(kwargs)) + self.logDebug("API Response: " + res) + return json_loads(res) + def process(self, pyfile): # match is guaranteed because plugin was chosen to handle url diff --git a/pyload/plugins/hoster/MegareleaseOrg.py b/pyload/plugins/hoster/MegareleaseOrg.py index 5dd27b5b2..7f978c94e 100644 --- a/pyload/plugins/hoster/MegareleaseOrg.py +++ b/pyload/plugins/hoster/MegareleaseOrg.py @@ -4,15 +4,16 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class MegareleaseOrg(DeadHoster): - __name__ = "MegareleaseOrg" - __type__ = "hoster" + __name__ = "MegareleaseOrg" + __type__ = "hoster" __version__ = "0.02" __pattern__ = r'https?://(?:www\.)?megarelease\.org/\w{12}' __description__ = """Megarelease.org hoster plugin""" - __authors__ = [("derek3x", "derek3x@vmail.me"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("derek3x", "derek3x@vmail.me"), + ("stickell", "l.stickell@yahoo.it")] getInfo = create_getInfo(MegareleaseOrg) diff --git a/pyload/plugins/hoster/MegasharesCom.py b/pyload/plugins/hoster/MegasharesCom.py index 23b5fbabc..fcb53a486 100644 --- a/pyload/plugins/hoster/MegasharesCom.py +++ b/pyload/plugins/hoster/MegasharesCom.py @@ -8,24 +8,26 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): - __name__ = "MegasharesCom" - __type__ = "hoster" - __version__ = "0.25" + __name__ = "MegasharesCom" + __type__ = "hoster" + __version__ = "0.27" - __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index.php)?\?d\d{2}=|dl/)\w+' + __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+' __description__ = """Megashares.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] - FILE_NAME_PATTERN = r'<h1 class="black xxl"[^>]*title="(?P<N>[^"]+)">' - FILE_SIZE_PATTERN = r'<strong><span class="black">Filesize:</span></strong> (?P<S>[\d.]+) (?P<U>\w+)' + NAME_PATTERN = r'<h1 class="black xxl"[^>]*title="(?P<N>[^"]+)">' + SIZE_PATTERN = r'<strong><span class="black">Filesize:</span></strong> (?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'<dd class="red">(Invalid Link Request|Link has been deleted|Invalid link)' LINK_PATTERN = r'<div id="show_download_button_%d"[^>]*>\s*<a href="([^"]+)">' PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <[^>]*>(\w+).*?You have.*?<[^>]*>.*?([\d.]+) (\w+)' - PASSPORT_RENEW_PATTERN = r'Your download passport will renew(?:.|\n)*?(\d+).*?(\d+).*?(\d+)' + PASSPORT_RENEW_PATTERN = r'(\d+):<strong>(\d+)</strong>:<strong>(\d+)</strong>' REACTIVATE_NUM_PATTERN = r'<input[^>]*id="random_num" value="(\d+)" />' REACTIVATE_PASSPORT_PATTERN = r'<input[^>]*id="passport_num" value="(\w+)" />' REQUEST_URI_PATTERN = r'var request_uri = "([^"]+)";' @@ -42,52 +44,53 @@ class MegasharesCom(SimpleHoster): def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) - if self.NO_SLOTS_PATTERN in self.html: self.retry(wait_time=5 * 60) - self.getFileInfo() - m = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) if m: passport_num = m.group(1) request_uri = re.search(self.REQUEST_URI_PATTERN, self.html).group(1) - for _ in xrange(5): + for _i in xrange(5): random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1) verifyinput = self.decryptCaptcha( "http://d01.megashares.com/index.php?secgfx=gfx&random_num=%s" % random_num) - self.logInfo("Reactivating passport %s: %s %s" % (passport_num, random_num, verifyinput)) + self.logInfo(_("Reactivating passport %s: %s %s") % (passport_num, random_num, verifyinput)) url = ("http://d01.megashares.com%s&rs=check_passport_renewal" % request_uri + "&rsargs[]=%s&rsargs[]=%s&rsargs[]=%s" % (verifyinput, random_num, passport_num) + "&rsargs[]=replace_sec_pprenewal&rsrnd=%s" % str(int(time() * 1000))) self.logDebug(url) - response = self.load(url) + res = self.load(url) - if 'Thank you for reactivating your passport.' in response: + if 'Thank you for reactivating your passport.' in res: self.correctCaptcha() self.retry() else: self.invalidCaptcha() else: - self.fail("Failed to reactivate passport") + self.fail(_("Failed to reactivate passport")) + + m = re.search(self.PASSPORT_RENEW_PATTERN, self.html) + if m: + time = [int(x) for x in m.groups()] + renew = time[0] + (time[1] * 60) + (time[2] * 60) + self.logDebug("Waiting %d seconds for a new passport" % renew) + self.retry(wait_time=renew, reason=_("Passport renewal")) # Check traffic left on passport m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S) if m is None: - self.fail('Passport not found') - self.logInfo("Download passport: %s" % m.group(1)) + self.fail(_("Passport not found")) + + self.logInfo(_("Download passport: %s") % m.group(1)) data_left = float(m.group(2)) * 1024 ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] - self.logInfo("Data left: %s %s (%d MB needed)" % (m.group(2), m.group(3), self.pyfile.size / 1048576)) + self.logInfo(_("Data left: %s %s (%d MB needed)") % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: - m = re.search(self.PASSPORT_RENEW_PATTERN, self.html) - renew = int(m.group(1) + 60 * (m.group(2) + 60 * m.group(3))) if found else 600 - self.logDebug('Waiting %d seconds for a new passport' % renew) - self.retry(wait_time=renew, reason="Passport renewal") + self.retry(wait_time=600, reason=_("Passport renewal")) self.handleDownload(False) @@ -95,9 +98,9 @@ class MegasharesCom(SimpleHoster): def handleDownload(self, premium=False): # Find download link; m = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) - msg = '%s download URL' % ('Premium' if premium else 'Free') + msg = _('%s download URL' % ('Premium' if premium else 'Free')) if m is None: - self.parseError(msg) + self.error(msg) download_url = m.group(1) self.logDebug("%s: %s" % (msg, download_url)) diff --git a/pyload/plugins/hoster/MovReelCom.py b/pyload/plugins/hoster/MovReelCom.py index 07a54a27c..cd1626f6f 100644 --- a/pyload/plugins/hoster/MovReelCom.py +++ b/pyload/plugins/hoster/MovReelCom.py @@ -1,23 +1,24 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class MovReelCom(XFSPHoster): - __name__ = "MovReelCom" - __type__ = "hoster" - __version__ = "1.21" +class MovReelCom(XFSHoster): + __name__ = "MovReelCom" + __type__ = "hoster" + __version__ = "1.24" __pattern__ = r'http://(?:www\.)?movreel\.com/\w{12}' __description__ = """MovReel.com hoster plugin""" - __authors__ = [("JorisV83", "jorisv83-pyload@yahoo.com")] + __license__ = "GPLv3" + __authors__ = [("JorisV83", "jorisv83-pyload@yahoo.com")] - HOSTER_NAME = "movreel.com" + HOSTER_DOMAIN = "movreel.com" - FILE_NAME_PATTERN = r'Filename: <b>(?P<N>.+?)<' - FILE_SIZE_PATTERN = r'Size: (?P<S>[\d.]+) (?P<U>\w+)' + NAME_PATTERN = r'Filename: <b>(?P<N>.+?)<' + SIZE_PATTERN = r'Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' LINK_PATTERN = r'<a href="([^"]+)">Download Link' diff --git a/pyload/plugins/hoster/MultishareCz.py b/pyload/plugins/hoster/MultishareCz.py index 3d9afa392..60d02b6e0 100644 --- a/pyload/plugins/hoster/MultishareCz.py +++ b/pyload/plugins/hoster/MultishareCz.py @@ -8,19 +8,20 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MultishareCz(SimpleHoster): - __name__ = "MultishareCz" - __type__ = "hoster" + __name__ = "MultishareCz" + __type__ = "hoster" __version__ = "0.34" - __pattern__ = r'http://(?:www\.)?multishare.cz/stahnout/(?P<ID>\d+).*' + __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+).*' __description__ = """MultiShare.cz hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_INFO_PATTERN = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>' + INFO_PATTERN = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>' OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>PoÅŸadovanÃœ soubor neexistuje.</strong></p>' - FILE_SIZE_REPLACEMENTS = [(' ', '')] + SIZE_REPLACEMENTS = [(' ', '')] def process(self, pyfile): @@ -37,34 +38,38 @@ class MultishareCz(SimpleHoster): else: self.handleOverriden() + def handleFree(self): self.download("http://www.multishare.cz/html/download_free.php?ID=%s" % self.fileID) + def handlePremium(self): if not self.checkCredit(): - self.logWarning("Not enough credit left to download file") + self.logWarning(_("Not enough credit left to download file")) self.resetAccount() self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.fileID) + def handleOverriden(self): if not self.premium: - self.fail("Only premium users can download from other hosters") + self.fail(_("Only premium users can download from other hosters")) self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": self.pyfile.url}, decode=True) self.getFileInfo() if not self.checkCredit(): - self.fail("Not enough credit left to download file") + self.fail(_("Not enough credit left to download file")) url = "http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()) params = {"u_ID": self.acc_info['u_ID'], "u_hash": self.acc_info['u_hash'], "link": self.pyfile.url} self.logDebug(url, params) self.download(url, get=params) + def checkCredit(self): self.acc_info = self.account.getAccountInfo(self.user, True) - self.logInfo("User %s has %i MB left" % (self.user, self.acc_info['trafficleft'] / 1024)) + self.logInfo(_("User %s has %i MB left") % (self.user, self.acc_info['trafficleft'] / 1024)) return self.pyfile.size / 1024 <= self.acc_info['trafficleft'] diff --git a/pyload/plugins/hoster/MyfastfileCom.py b/pyload/plugins/hoster/MyfastfileCom.py index 219cee92f..14ed51ea7 100644 --- a/pyload/plugins/hoster/MyfastfileCom.py +++ b/pyload/plugins/hoster/MyfastfileCom.py @@ -7,14 +7,15 @@ from pyload.utils import json_loads class MyfastfileCom(Hoster): - __name__ = "MyfastfileCom" - __type__ = "hoster" + __name__ = "MyfastfileCom" + __type__ = "hoster" __version__ = "0.04" __pattern__ = r'http://(?:www\.)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' __description__ = """Myfastfile.com hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] @@ -22,21 +23,22 @@ class MyfastfileCom(Hoster): self.chunkLimit = -1 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "Myfastfile.com") - self.fail("No Myfastfile.com account provided") + self.fail(_("No Myfastfile.com account provided")) else: self.logDebug("Original URL: %s" % pyfile.url) - page = self.req.load('http://myfastfile.com/api.php', - get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'], - 'link': pyfile.url}) + page = self.load('http://myfastfile.com/api.php', + get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'], + 'link': pyfile.url}) self.logDebug("JSON data: " + page) page = json_loads(page) if page['status'] != 'ok': - self.fail('Unable to unrestrict link') + self.fail(_("Unable to unrestrict link")) new_url = page['link'] if new_url != pyfile.url: diff --git a/pyload/plugins/hoster/MyvideoDe.py b/pyload/plugins/hoster/MyvideoDe.py index bf96014f9..886896056 100644 --- a/pyload/plugins/hoster/MyvideoDe.py +++ b/pyload/plugins/hoster/MyvideoDe.py @@ -7,14 +7,15 @@ from pyload.utils import html_unescape class MyvideoDe(Hoster): - __name__ = "MyvideoDe" - __type__ = "hoster" + __name__ = "MyvideoDe" + __type__ = "hoster" __version__ = "0.9" - __pattern__ = r'http://(?:www\.)?myvideo.de/watch/' + __pattern__ = r'http://(?:www\.)?myvideo\.de/watch/' __description__ = """Myvideo.de hoster plugin""" - __authors__ = [("spoob", "spoob@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org")] def process(self, pyfile): @@ -23,19 +24,23 @@ class MyvideoDe(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) + def download_html(self): self.html = self.load(self.pyfile.url) + def get_file_url(self): videoId = re.search(r"addVariable\('_videoid','(.*)'\);p.addParam\('quality'", self.html).group(1) videoServer = re.search("rel='image_src' href='(.*)thumbs/.*' />", self.html).group(1) file_url = videoServer + videoId + ".flv" return file_url + def get_file_name(self): file_name_pattern = r"<h1 class='globalHd'>(.*)</h1>" return html_unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv') + def file_exists(self): self.download_html() self.load(str(self.pyfile.url), cookies=False, just_header=True) diff --git a/pyload/plugins/hoster/NarodRu.py b/pyload/plugins/hoster/NarodRu.py index 574135192..67d940519 100644 --- a/pyload/plugins/hoster/NarodRu.py +++ b/pyload/plugins/hoster/NarodRu.py @@ -8,34 +8,35 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class NarodRu(SimpleHoster): - __name__ = "NarodRu" - __type__ = "hoster" - __version__ = "0.1" + __name__ = "NarodRu" + __type__ = "hoster" + __version__ = "0.11" - __pattern__ = r'http://(?:www\.)?narod(\.yandex)?\.ru/(disk|start/[0-9]+\.\w+-narod\.yandex\.ru)/(?P<ID>\d+)/.+' + __pattern__ = r'http://(?:www\.)?narod(\.yandex)?\.ru/(disk|start/\d+\.\w+-narod\.yandex\.ru)/(?P<ID>\d+)/.+' __description__ = """Narod.ru hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<dt class="name">(?:<[^<]*>)*(?P<N>[^<]+)</dt>' - FILE_SIZE_PATTERN = r'<dd class="size">(?P<S>\d[^<]*)</dd>' + NAME_PATTERN = r'<dt class="name">(?:<[^<]*>)*(?P<N>[^<]+)</dt>' + SIZE_PATTERN = r'<dd class="size">(?P<S>\d[^<]*)</dd>' OFFLINE_PATTERN = r'<title>404</title>|Ѐайл ÑЎалеМ Ñ ÑеÑвОÑа|ÐакПМÑОлÑÑ ÑÑПк Ñ
ÑÐ°ÐœÐµÐœÐžÑ Ñайла\.' - FILE_SIZE_REPLACEMENTS = [(u'ÐÐ', 'KB'), (u'ÐÐ', 'MB'), (u'ÐÐ', 'GB')] - FILE_URL_REPLACEMENTS = [("narod.yandex.ru/", "narod.ru/"), - (r"/start/[0-9]+\.\w+-narod\.yandex\.ru/([0-9]{6,15})/\w+/(\w+)", r"/disk/\1/\2")] + SIZE_REPLACEMENTS = [(u'ÐÐ', 'KB'), (u'ÐÐ', 'MB'), (u'ÐÐ', 'GB')] + URL_REPLACEMENTS = [("narod.yandex.ru/", "narod.ru/"), + (r"/start/\d+\.\w+-narod\.yandex\.ru/(\d{6,15})/\w+/(\w+)", r"/disk/\1/\2")] CAPTCHA_PATTERN = r'<number url="(.*?)">(\w+)</number>' LINK_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">' def handleFree(self): - for _ in xrange(5): + for _i in xrange(5): self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random() * 777)) m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: - self.parseError('Captcha') + self.error(_("Captcha")) post_data = {"action": "sendcapcha"} captcha_url, post_data['key'] = m.groups() post_data['rep'] = self.decryptCaptcha(captcha_url) @@ -49,11 +50,10 @@ class NarodRu(SimpleHoster): elif u'<b class="error-msg"><strong>ÐÑОблОÑÑ?</strong>' in self.html: self.invalidCaptcha() else: - self.parseError('Download link') + self.error(_("Download link")) else: - self.fail("No valid captcha code entered") + self.fail(_("No valid captcha code entered")) - self.logDebug("Download link: " + url) self.download(url) diff --git a/pyload/plugins/hoster/NetloadIn.py b/pyload/plugins/hoster/NetloadIn.py index d6b1b77e2..5889611bb 100644 --- a/pyload/plugins/hoster/NetloadIn.py +++ b/pyload/plugins/hoster/NetloadIn.py @@ -26,10 +26,11 @@ def getInfo(urls): api = getURL(apiurl + ids, decode=True) if api is None or len(api) < 10: - print "Netload prefetch: failed " + self.logDebug("Prefetch failed") return if api.find("unknown_auth") >= 0: - print "Netload prefetch: Outdated auth code " + print + self.logDebug("Outdated auth code") return result = [] @@ -43,34 +44,36 @@ def getInfo(urls): size = 0 result.append((tmp[1], size, 2 if tmp[3] == "online" else 1, chunk[i])) except: - print "Netload prefetch: Error while processing response: " - print r + self.logDebug("Error while processing response: %s" % r) yield result class NetloadIn(Hoster): - __name__ = "NetloadIn" - __type__ = "hoster" + __name__ = "NetloadIn" + __type__ = "hoster" __version__ = "0.45" - __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)' + __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index\.php?id=10&file_id=)' __description__ = """Netload.in hoster plugin""" - __authors__ = [("spoob", "spoob@pyload.org"), - ("RaNaN", "ranan@pyload.org"), - ("Gregy", "gregy@gregy.cz")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org"), + ("RaNaN", "ranan@pyload.org"), + ("Gregy", "gregy@gregy.cz")] def setup(self): self.multiDL = self.resumeDownload = self.premium + def process(self, pyfile): self.url = pyfile.url self.prepare() pyfile.setStatus("downloading") self.proceed(self.url) + def prepare(self): self.download_api_data() @@ -78,7 +81,7 @@ class NetloadIn(Hoster): self.pyfile.name = self.api_data['filename'] if self.premium: - self.logDebug("Netload: Use Premium Account") + self.logDebug("Use Premium Account") settings = self.load("http://www.netload.in/index.php?id=2&lang=en") if '<option value="2" selected="selected">Direkter Download' in settings: self.logDebug("Using direct download") @@ -89,9 +92,10 @@ class NetloadIn(Hoster): if self.download_html(): return True else: - self.fail("Failed") + self.fail(_("Failed")) return False + def download_api_data(self, n=0): url = self.url id_regex = re.compile(self.__pattern__) @@ -106,18 +110,18 @@ class NetloadIn(Hoster): return apiurl = "http://api.netload.in/info.php" - src = self.load(apiurl, cookies=False, + html = self.load(apiurl, cookies=False, get={"file_id": match.group(1), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1", "md5": "1"}, decode=True).strip() - if not src and n <= 3: + if not html and n <= 3: sleep(0.2) self.download_api_data(n + 1) return - self.logDebug("Netload: APIDATA: " + src) + self.logDebug("APIDATA: " + html) self.api_data = {} - if src and ";" in src and src not in ("unknown file_data", "unknown_server_data", "No input file specified."): - lines = src.split(";") + if html and ";" in html and html not in ("unknown file_data", "unknown_server_data", "No input file specified."): + lines = html.split(";") self.api_data['exists'] = True self.api_data['fileid'] = lines[0] self.api_data['filename'] = lines[1] @@ -133,20 +137,22 @@ class NetloadIn(Hoster): else: self.api_data = False + def final_wait(self, page): wait_time = self.get_wait_time(page) self.setWait(wait_time) - self.logDebug("Netload: final wait %d seconds" % wait_time) + self.logDebug("Final wait %d seconds" % wait_time) self.wait() self.url = self.get_file_url(page) + def download_html(self): - self.logDebug("Netload: Entering download_html") + self.logDebug("Entering download_html") page = self.load(self.url, decode=True) t = time() + 30 if "/share/templates/download_hddcrash.tpl" in page: - self.logError("Netload HDD Crash") + self.logError(_("Netload HDD Crash")) self.fail(_("File temporarily not available")) if not self.api_data: @@ -155,7 +161,7 @@ class NetloadIn(Hoster): if "* The file was deleted" in page: self.offline() - name = re.search(r'class="dl_first_filename">([^<]+)', page, re.MULTILINE) + name = re.search(r'class="dl_first_filename">([^<]+)', page, re.M) # the found filename is not truncated if name: name = name.group(1).strip() @@ -170,28 +176,27 @@ class NetloadIn(Hoster): t = time() + 30 if "/share/templates/download_hddcrash.tpl" in page: - self.logError("Netload HDD Crash") + self.logError(_("Netload HDD Crash")) self.fail(_("File temporarily not available")) - self.logDebug("Netload: try number %d " % i) + self.logDebug("Try number %d " % i) if ">Your download is being prepared.<" in page: - self.logDebug("Netload: We will prepare your download") + self.logDebug("We will prepare your download") self.final_wait(page) return True if ">An access request has been made from IP address <" in page: wait = self.get_wait_time(page) if not wait: - self.logDebug("Netload: Wait was 0 setting 30") + self.logDebug("Wait was 0 setting 30") wait = 30 * 60 - self.logInfo(_("Netload: waiting between downloads %d s." % wait)) - self.wantReconnect = True - self.setWait(wait) + self.logInfo(_("Waiting between downloads %d seconds") % wait) + self.setWait(wait, True) self.wait() return self.download_html() - self.logDebug("Netload: Trying to find captcha") + self.logDebug("Trying to find captcha") try: url_captcha_html = "http://netload.in/" + re.search('(index.php\?id=10&.*&captcha=1)', @@ -204,7 +209,7 @@ class NetloadIn(Hoster): page = self.load(url_captcha_html, cookies=True) captcha_url = "http://netload.in/" + re.search('(share/includes/captcha.php\?t=\d*)', page).group(1) except: - self.logDebug("Netload: Could not find captcha, try again from beginning") + self.logDebug("Could not find captcha, try again from beginning") captchawaited = False continue @@ -215,7 +220,7 @@ class NetloadIn(Hoster): self.pyfile.waitUntil = time() # dont wait contrary to time on website else: self.pyfile.waitUntil = t - self.logInfo(_("Netload: waiting for captcha %d s.") % (self.pyfile.waitUntil - time())) + self.logInfo(_("Waiting for captcha %d seconds") % (self.pyfile.waitUntil - time())) #self.setWait(wait) self.wait() captchawaited = True @@ -226,27 +231,30 @@ class NetloadIn(Hoster): return False + def get_file_url(self, page): try: - file_url_pattern = r"<a class=\"Orange_Link\" href=\"(http://.+)\".?>Or click here" + file_url_pattern = r'<a class="Orange_Link" href="(http://.+)".?>Or click here' attempt = re.search(file_url_pattern, page) if attempt is not None: return attempt.group(1) else: - self.logDebug("Netload: Backup try for final link") - file_url_pattern = r"<a href=\"(.+)\" class=\"Orange_Link\">Click here" + self.logDebug("Backup try for final link") + file_url_pattern = r'<a href="(.+)" class="Orange_Link">Click here' attempt = re.search(file_url_pattern, page) return "http://netload.in/" + attempt.group(1) except: - self.logDebug("Netload: Getting final link failed") + self.logDebug("Getting final link failed") return None + def get_wait_time(self, page): wait_seconds = int(re.search(r"countdown\((.+),'change\(\)'\)", page).group(1)) / 100 return wait_seconds + def proceed(self, url): - self.logDebug("Netload: Downloading..") + self.logDebug("Downloading..") self.download(url, disposition=True) diff --git a/pyload/plugins/hoster/NosuploadCom.py b/pyload/plugins/hoster/NosuploadCom.py index e761a0504..b2255ca54 100644 --- a/pyload/plugins/hoster/NosuploadCom.py +++ b/pyload/plugins/hoster/NosuploadCom.py @@ -2,23 +2,24 @@ import re -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class NosuploadCom(XFSPHoster): - __name__ = "NosuploadCom" - __type__ = "hoster" - __version__ = "0.1" +class NosuploadCom(XFSHoster): + __name__ = "NosuploadCom" + __type__ = "hoster" + __version__ = "0.31" __pattern__ = r'http://(?:www\.)?nosupload\.com/\?d=\w{12}' __description__ = """Nosupload.com hoster plugin""" - __authors__ = [("igel", "igelkun@myopera.com")] + __license__ = "GPLv3" + __authors__ = [("igel", "igelkun@myopera.com")] - HOSTER_NAME = "nosupload.com" + HOSTER_DOMAIN = "nosupload.com" - FILE_SIZE_PATTERN = r'<p><strong>Size:</strong> (?P<S>[0-9\.]+) (?P<U>[kKMG]?B)</p>' + SIZE_PATTERN = r'<p><strong>Size:</strong> (?P<S>[\d.,]+) (?P<U>[\w^_]+)</p>' LINK_PATTERN = r'<a class="select" href="(http://.+?)">Download</a>' WAIT_PATTERN = r'Please wait.*?>(\d+)</span>' @@ -30,7 +31,7 @@ class NosuploadCom(XFSPHoster): # stage2: wait some time and press the "Download File" button data = self.getPostParameters() - wait_time = re.search(self.WAIT_PATTERN, self.html, re.MULTILINE | re.DOTALL).group(1) + wait_time = re.search(self.WAIT_PATTERN, self.html, re.M | re.S).group(1) self.logDebug("Hoster told us to wait %s seconds" % wait_time) self.wait(wait_time) self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True) diff --git a/pyload/plugins/hoster/NovafileCom.py b/pyload/plugins/hoster/NovafileCom.py index db5a769b3..5c4dfddca 100644 --- a/pyload/plugins/hoster/NovafileCom.py +++ b/pyload/plugins/hoster/NovafileCom.py @@ -4,24 +4,25 @@ # http://novafile.com/vfun4z6o2cit # http://novafile.com/s6zrr5wemuz4 -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class NovafileCom(XFSPHoster): - __name__ = "NovafileCom" - __type__ = "hoster" - __version__ = "0.02" +class NovafileCom(XFSHoster): + __name__ = "NovafileCom" + __type__ = "hoster" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?novafile\.com/\w{12}' __description__ = """Novafile.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] - HOSTER_NAME = "novafile.com" + HOSTER_DOMAIN = "novafile.com" - FILE_SIZE_PATTERN = r'<div class="size">(?P<S>.+?)</div>' + SIZE_PATTERN = r'<div class="size">(?P<S>.+?)</div>' ERROR_PATTERN = r'class="alert[^"]*alert-separate"[^>]*>\s*(?:<p>)?(.*?)\s*</' LINK_PATTERN = r'<a href="(http://s\d+\.novafile\.com/.*?)" class="btn btn-green">Download File</a>' WAIT_PATTERN = r'<p>Please wait <span id="count"[^>]*>(\d+)</span> seconds</p>' diff --git a/pyload/plugins/hoster/NowDownloadEu.py b/pyload/plugins/hoster/NowDownloadEu.py index 11b5ea5fa..2b1b8bc0a 100644 --- a/pyload/plugins/hoster/NowDownloadEu.py +++ b/pyload/plugins/hoster/NowDownloadEu.py @@ -7,37 +7,39 @@ from pyload.utils import fixup class NowDownloadEu(SimpleHoster): - __name__ = "NowDownloadEu" - __type__ = "hoster" + __name__ = "NowDownloadEu" + __type__ = "hoster" __version__ = "0.05" - __pattern__ = r'http://(?:www\.)?nowdownload\.(ch|co|eu|sx)/(dl/|download\.php\?id=)(?P<ID>\w+)' + __pattern__ = r'http://(?:www\.)?nowdownload\.(at|ch|co|eu|sx)/(dl/|download\.php\?id=)\w+' - __description__ = """NowDownload.ch hoster plugin""" - __authors__ = [("godofdream", "soilfiction@gmail.com"), - ("Walter Purcaro", "vuolter@gmail.com")] + __description__ = """NowDownload.at hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("godofdream", "soilfiction@gmail.com"), + ("Walter Purcaro", "vuolter@gmail.com")] - FILE_INFO_PATTERN = r'Downloading</span> <br> (?P<N>.*) (?P<S>[0-9,.]+) (?P<U>[kKMG])i?B </h4>' - OFFLINE_PATTERN = r'(This file does not exist!)' + INFO_PATTERN = r'Downloading</span> <br> (?P<N>.*) (?P<S>[\d.,]+) (?P<U>[\w^_]+) </h4>' + OFFLINE_PATTERN = r'>This file does not exist' - TOKEN_PATTERN = r'"(/api/token\.php\?token=[a-z0-9]+)"' - CONTINUE_PATTERN = r'"(/dl2/[a-z0-9]+/[a-z0-9]+)"' + TOKEN_PATTERN = r'"(/api/token\.php\?token=\w+)"' + CONTINUE_PATTERN = r'"(/dl2/\w+/\w+)"' WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),' - LINK_PATTERN = r'"(http://f\d+\.nowdownload\.ch/dl/[a-z0-9]+/[a-z0-9]+/[^<>"]*?)"' + LINK_PATTERN = r'"(http://f\d+\.nowdownload\.at/dl/\w+/\w+)' - FILE_NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<[^>]*>', '')] + NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<[^>]*>', '')] def setup(self): self.multiDL = self.resumeDownload = True self.chunkLimit = -1 + def handleFree(self): tokenlink = re.search(self.TOKEN_PATTERN, self.html) continuelink = re.search(self.CONTINUE_PATTERN, self.html) if tokenlink is None or continuelink is None: - self.fail('Plugin out of Date') + self.error() m = re.search(self.WAIT_PATTERN, self.html) if m: @@ -45,7 +47,7 @@ class NowDownloadEu(SimpleHoster): else: wait = 60 - baseurl = "http://www.nowdownload.ch" + baseurl = "http://www.nowdownload.at" self.html = self.load(baseurl + str(tokenlink.group(1))) self.wait(wait) @@ -53,8 +55,8 @@ class NowDownloadEu(SimpleHoster): url = re.search(self.LINK_PATTERN, self.html) if url is None: - self.fail('Download Link not Found (Plugin out of Date?)') - self.logDebug("Download link", url.group(1)) + self.error(_("Download link not found")) + self.download(str(url.group(1))) diff --git a/pyload/plugins/hoster/OboomCom.py b/pyload/plugins/hoster/OboomCom.py index 5ade1bd8b..fcd73bf05 100644 --- a/pyload/plugins/hoster/OboomCom.py +++ b/pyload/plugins/hoster/OboomCom.py @@ -11,14 +11,15 @@ from pyload.plugins.internal.CaptchaService import ReCaptcha class OboomCom(Hoster): - __name__ = "OboomCom" - __type__ = "hoster" + __name__ = "OboomCom" + __type__ = "hoster" __version__ = "0.3" __pattern__ = r'https?://(?:www\.)?oboom\.com/(#(id=|/)?)?(?P<ID>\w{8})' __description__ = """oboom.com hoster plugin""" - __authors__ = [("stanley", "stanley.foerster@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("stanley", "stanley.foerster@gmail.com")] RECAPTCHA_KEY = "6LdqpO0SAAAAAJGHXo63HyalP7H4qlRs_vff0kJX" @@ -59,20 +60,20 @@ class OboomCom(Hoster): if "session" in accountInfo: self.sessionToken = accountInfo['session'] else: - self.fail("Could not retrieve premium session") + self.fail(_("Could not retrieve premium session")) else: apiUrl = "https://www.oboom.com/1.0/guestsession" result = self.loadUrl(apiUrl) if result[0] == 200: self.sessionToken = result[1] else: - self.fail("Could not retrieve token for guest session. Error code %s" % result[0]) + self.fail(_("Could not retrieve token for guest session. Error code: %s") % result[0]) def solveCaptcha(self): recaptcha = ReCaptcha(self) - for _ in xrange(5): + for _i in xrange(5): challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) apiUrl = "https://www.oboom.com/1.0/download/ticket" params = {"recaptcha_challenge_field": challenge, @@ -95,18 +96,18 @@ class OboomCom(Hoster): elif result[1] == "captcha-timeout": self.invalidCaptcha() elif result[1] == "forbidden": - self.retry(5, 15 * 60, "Service unavailable") + self.retry(5, 15 * 60, _("Service unavailable")) elif result[0] == 403: if result[1] == -1: # another download is running self.setWait(15 * 60) else: - self.setWait(result[1], reconnect=True) + self.setWait(result[1], True) self.wait() self.retry(5) else: self.invalidCaptcha() - self.fail("Received invalid captcha 5 times") + self.fail(_("Received invalid captcha 5 times")) def getFileInfo(self, token, fileId): @@ -122,7 +123,7 @@ class OboomCom(Hoster): else: self.offline() else: - self.fail("Could not retrieve file info. Error code %s: %s" % (result[0], result[1])) + self.fail(_("Could not retrieve file info. Error code %s: %s") % (result[0], result[1])) def getDownloadTicket(self): @@ -139,6 +140,6 @@ class OboomCom(Hoster): self.downloadDomain = result[1] self.downloadTicket = result[2] elif result[0] == 421: - self.retry(wait_time=result[2] + 60, reason="Connection limit exceeded") + self.retry(wait_time=result[2] + 60, reason=_("Connection limit exceeded")) else: - self.fail("Could not retrieve download ticket. Error code %s" % result[0]) + self.fail(_("Could not retrieve download ticket. Error code: %s") % result[0]) diff --git a/pyload/plugins/hoster/OneFichierCom.py b/pyload/plugins/hoster/OneFichierCom.py index 72d3917a0..299665bb5 100644 --- a/pyload/plugins/hoster/OneFichierCom.py +++ b/pyload/plugins/hoster/OneFichierCom.py @@ -6,26 +6,29 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): - __name__ = "OneFichierCom" - __type__ = "hoster" - __version__ = "0.64" + __name__ = "OneFichierCom" + __type__ = "hoster" + __version__ = "0.72" - __pattern__ = r'https?://(?P<ID>\w+)\.(?P<HOST>(1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl\.fr)' + __pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?' __description__ = """1fichier.com hoster plugin""" - __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es"), - ("the-razer", "daniel_ AT gmx DOT net"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("imclem", None), - ("stickell", "l.stickell@yahoo.it"), - ("Elrick69", "elrick69[AT]rocketmail[DOT]com")] + __license__ = "GPLv3" + __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es"), + ("the-razer", "daniel_ AT gmx DOT net"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("imclem", None), + ("stickell", "l.stickell@yahoo.it"), + ("Elrick69", "elrick69[AT]rocketmail[DOT]com"), + ("Walter Purcaro", "vuolter@gmail.com")] - FILE_NAME_PATTERN = r'>Filename :</th>\s*<td>(?P<N>.+?)<' - FILE_SIZE_PATTERN = r'>Size :</th>\s*<td>(?P<S>[\d.,]+) (?P<U>\w+)' - OFFLINE_PATTERN = r'>The (requested)? file (could not be found|has been deleted)' + NAME_PATTERN = r'>FileName :</td>\s*<td.*>(?P<N>.+?)<' + SIZE_PATTERN = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' - FILE_URL_REPLACEMENTS = [(__pattern__, r'http://\g<ID>.\g<HOST>/en/')] + OFFLINE_PATTERN = r'File not found !\s*<' + + COOKIES = [(".1fichier.com", "LG", "en")] WAIT_PATTERN = r'>You must wait (\d+)' @@ -35,52 +38,34 @@ class OneFichierCom(SimpleHoster): self.resumeDownload = True - def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) + def handle(self, reconnect): m = re.search(self.WAIT_PATTERN, self.html) if m: - wait_time = int(m.group(1)) + 1 #: One minute more than what the page displays to be safe - self.logInfo("You have to wait been each free download", "Retrying in %d minutes." % wait_time) - self.wait(wait_time * 60, True) - self.retry() - - url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['ID']) - if not url: - self.parseError("Download link not found") + wait_time = int(m.group(1)) * 60 - # Check for protection - if "pass" in inputs: - inputs['pass'] = self.getPassword() - inputs['submit'] = "Download" + self.wait(wait_time, reconnect) + self.retry(reason="You have to wait been each free download") - self.download(url, post=inputs) + id = self.info['ID1'] or self.info['ID2'] + url, inputs = self.parseHtmlForm('action="https://1fichier.com/\?%s' % id) - # Check download - self.checkDownloadedFile() - - - def handlePremium(self): - url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['ID']) if not url: - self.parseError("Download link not found") + self.fail(_("Download link not found")) - # Check for protection if "pass" in inputs: inputs['pass'] = self.getPassword() + inputs['submit'] = "Download" self.download(url, post=inputs) - # Check download - self.checkDownloadedFile() + + def handleFree(self): + return self.handle(True) - def checkDownloadedFile(self): - check = self.checkDownload({'wait': self.WAIT_PATTERN}) - if check == "wait": - wait_time = int(self.lastcheck.group(1)) * 60 - self.wait(wait_time, True) - self.retry() + def handlePremium(self): + return self.handle(False) getInfo = create_getInfo(OneFichierCom) diff --git a/pyload/plugins/hoster/OverLoadMe.py b/pyload/plugins/hoster/OverLoadMe.py index b46421d8a..1cea276f9 100644 --- a/pyload/plugins/hoster/OverLoadMe.py +++ b/pyload/plugins/hoster/OverLoadMe.py @@ -11,14 +11,15 @@ from pyload.utils import parseFileSize class OverLoadMe(Hoster): - __name__ = "OverLoadMe" - __type__ = "hoster" - __version__ = "0.01" + __name__ = "OverLoadMe" + __type__ = "hoster" + __version__ = "0.02" __pattern__ = r'https?://.*overload\.me.*' __description__ = """Over-Load.me hoster plugin""" - __authors__ = [("marley", "marley@over-load.me")] + __license__ = "GPLv3" + __authors__ = [("marley", "marley@over-load.me")] def getFilename(self, url): @@ -26,20 +27,22 @@ class OverLoadMe(Hoster): name = unquote(url.rsplit("/", 1)[1]) except IndexError: name = "Unknown_Filename..." - if name.endswith("..."): # incomplete filename, append random stuff + if name.endswith("..."): #: incomplete filename, append random stuff name += "%s.tmp" % randrange(100, 999) return name + def setup(self): self.chunkLimit = 5 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "Over-Load") - self.fail("No Over-Load account provided") + self.fail(_("No Over-Load account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) data = self.account.getAccountData(self.user) @@ -50,7 +53,7 @@ class OverLoadMe(Hoster): self.logDebug("Returned Data: %s" % data) - if data['err'] == 1: + if data['error'] == 1: self.logWarning(data['msg']) self.tempOffline() else: @@ -78,4 +81,4 @@ class OverLoadMe(Hoster): if check == "error": # usual this download can safely be retried - self.retry(reason="An error occured while generating link.", wait_time=60) + self.retry(wait_time=60, reason=_("An error occured while generating link.")) diff --git a/pyload/plugins/hoster/PandaPlaNet.py b/pyload/plugins/hoster/PandaPlaNet.py deleted file mode 100644 index fed55d278..000000000 --- a/pyload/plugins/hoster/PandaPlaNet.py +++ /dev/null @@ -1,17 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo - - -class PandaPlaNet(DeadHoster): - __name__ = "PandaPlaNet" - __type__ = "hoster" - __version__ = "0.02" - - __pattern__ = r'http://(?:www\.)?pandapla\.net/\w{12}' - - __description__ = """Pandapla.net hoster plugin""" - __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] - - -getInfo = create_getInfo(PandaPlaNet) diff --git a/pyload/plugins/hoster/PornhostCom.py b/pyload/plugins/hoster/PornhostCom.py index b8abb2b8a..d83b61c10 100644 --- a/pyload/plugins/hoster/PornhostCom.py +++ b/pyload/plugins/hoster/PornhostCom.py @@ -6,14 +6,15 @@ from pyload.plugins.base.Hoster import Hoster class PornhostCom(Hoster): - __name__ = "PornhostCom" - __type__ = "hoster" + __name__ = "PornhostCom" + __type__ = "hoster" __version__ = "0.2" - __pattern__ = r'http://(?:www\.)?pornhost\.com/([0-9]+/[0-9]+\.html|[0-9]+)' + __pattern__ = r'http://(?:www\.)?pornhost\.com/(\d+/\d+\.html|\d+)' __description__ = """Pornhost.com hoster plugin""" - __authors__ = [("jeix", "jeix@hasnomail.de")] + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de")] def process(self, pyfile): @@ -24,11 +25,13 @@ class PornhostCom(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) + # Old interface def download_html(self): url = self.pyfile.url self.html = self.load(url) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -37,15 +40,16 @@ class PornhostCom(Hoster): url = re.search(r'download this file</label>.*?<a href="(.*?)"', self.html) if url is None: - url = re.search(r'"(http://dl[0-9]+\.pornhost\.com/files/.*?/.*?/.*?/.*?/.*?/.*?\..*?)"', self.html) + url = re.search(r'"(http://dl\d+\.pornhost\.com/files/.*?/.*?/.*?/.*?/.*?/.*?\..*?)"', self.html) if url is None: url = re.search(r'width: 894px; height: 675px">.*?<img src="(.*?)"', self.html) if url is None: - url = re.search(r'"http://file[0-9]+\.pornhost\.com/[0-9]+/.*?"', + url = re.search(r'"http://file\d+\.pornhost\.com/\d+/.*?"', self.html) # TODO: fix this one since it doesn't match return url.group(1).strip() + def get_file_name(self): if not self.html: self.download_html() @@ -56,12 +60,13 @@ class PornhostCom(Hoster): if name is None: name = re.search(r'<title>pornhost\.com - free file hosting with a twist -(.*?)</title>', self.html) if name is None: - name = re.search(r'"http://file[0-9]+\.pornhost\.com/.*?/(.*?)"', self.html) + name = re.search(r'"http://file\d+\.pornhost\.com/.*?/(.*?)"', self.html) name = name.group(1).strip() + ".flv" return name + def file_exists(self): """ returns True or False """ diff --git a/pyload/plugins/hoster/PornhubCom.py b/pyload/plugins/hoster/PornhubCom.py index 8a5fd9075..d6cbdfede 100644 --- a/pyload/plugins/hoster/PornhubCom.py +++ b/pyload/plugins/hoster/PornhubCom.py @@ -6,14 +6,15 @@ from pyload.plugins.base.Hoster import Hoster class PornhubCom(Hoster): - __name__ = "PornhubCom" - __type__ = "hoster" + __name__ = "PornhubCom" + __type__ = "hoster" __version__ = "0.5" - __pattern__ = r'http://(?:www\.)?pornhub\.com/view_video\.php\?viewkey=[\w\d]+' + __pattern__ = r'http://(?:www\.)?pornhub\.com/view_video\.php\?viewkey=\w+' __description__ = """Pornhub.com hoster plugin""" - __authors__ = [("jeix", "jeix@hasnomail.de")] + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de")] def process(self, pyfile): @@ -24,10 +25,12 @@ class PornhubCom(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) + def download_html(self): url = self.pyfile.url self.html = self.load(url) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -43,7 +46,7 @@ class PornhubCom(Hoster): post_data += "\x02\x00\x02\x2d\x31\x02\x00\x20" post_data += "add299463d4410c6d1b1c418868225f7" - content = self.req.load(url, post=str(post_data)) + content = self.load(url, post=str(post_data)) new_content = "" for x in content: @@ -56,6 +59,7 @@ class PornhubCom(Hoster): return re.search(r'flv_url.*(http.*?)##post_roll', content).group(1) + def get_file_name(self): if not self.html: self.download_html() @@ -72,6 +76,7 @@ class PornhubCom(Hoster): return name + '.flv' + def file_exists(self): """ returns True or False """ diff --git a/pyload/plugins/hoster/PotloadCom.py b/pyload/plugins/hoster/PotloadCom.py index 39f76a923..19da16b33 100644 --- a/pyload/plugins/hoster/PotloadCom.py +++ b/pyload/plugins/hoster/PotloadCom.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class PotloadCom(DeadHoster): - __name__ = "PotloadCom" - __type__ = "hoster" + __name__ = "PotloadCom" + __type__ = "hoster" __version__ = "0.02" __pattern__ = r'http://(?:www\.)?potload\.com/\w{12}' __description__ = """Potload.com hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] getInfo = create_getInfo(PotloadCom) diff --git a/pyload/plugins/hoster/PremiumTo.py b/pyload/plugins/hoster/PremiumTo.py index b1efdcc50..680b0b25d 100644 --- a/pyload/plugins/hoster/PremiumTo.py +++ b/pyload/plugins/hoster/PremiumTo.py @@ -9,16 +9,17 @@ from pyload.utils import fs_encode class PremiumTo(Hoster): - __name__ = "PremiumTo" - __type__ = "hoster" + __name__ = "PremiumTo" + __type__ = "hoster" __version__ = "0.10" __pattern__ = r'https?://(?:www\.)?premium\.to/.+' __description__ = """Premium.to hoster plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] def setup(self): @@ -29,7 +30,7 @@ class PremiumTo(Hoster): def process(self, pyfile): if not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "premium.to") - self.fail("No premium.to account provided") + self.fail(_("No premium.to account provided")) self.logDebug("Old URL: %s" % pyfile.url) @@ -53,15 +54,14 @@ class PremiumTo(Hoster): lastDownload = fs_encode(self.lastDownload) if exists(lastDownload): - f = open(lastDownload, "rb") - err = f.read(256).strip() - f.close() + with open(lastDownload, "rb") as f: + err = f.read(256).strip() remove(lastDownload) else: - err = 'File does not exist' + err = _('File does not exist') trb = self.getTraffic() - self.logInfo("Filesize: %d, Traffic used %d, traffic left %d" % (pyfile.size, tra - trb, trb)) + self.logInfo(_("Filesize: %d, Traffic used %d, traffic left %d") % (pyfile.size, tra - trb, trb)) if err: self.fail(err) diff --git a/pyload/plugins/hoster/PremiumizeMe.py b/pyload/plugins/hoster/PremiumizeMe.py index abd4cf698..9eab5888c 100644 --- a/pyload/plugins/hoster/PremiumizeMe.py +++ b/pyload/plugins/hoster/PremiumizeMe.py @@ -5,21 +5,22 @@ from pyload.plugins.base.Hoster import Hoster class PremiumizeMe(Hoster): - __name__ = "PremiumizeMe" - __type__ = "hoster" + __name__ = "PremiumizeMe" + __type__ = "hoster" __version__ = "0.12" - __pattern__ = None #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady + __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady __description__ = """Premiumize.me hoster plugin""" - __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] 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") % "premiumize.me") - self.fail("No valid premiumize.me account provided") + self.fail(_("No valid premiumize.me 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) @@ -45,7 +46,7 @@ class PremiumizeMe(Hoster): if status == 200: self.download(data['result']['location'], disposition=True) elif status == 400: - self.fail("Invalid link") + self.fail(_("Invalid link")) elif status == 404: self.offline() elif status >= 500: diff --git a/pyload/plugins/hoster/PromptfileCom.py b/pyload/plugins/hoster/PromptfileCom.py index 12cb41290..73324e6ab 100644 --- a/pyload/plugins/hoster/PromptfileCom.py +++ b/pyload/plugins/hoster/PromptfileCom.py @@ -6,37 +6,38 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class PromptfileCom(SimpleHoster): - __name__ = "PromptfileCom" - __type__ = "hoster" - __version__ = "0.1" + __name__ = "PromptfileCom" + __type__ = "hoster" + __version__ = "0.12" __pattern__ = r'https?://(?:www\.)?promptfile\.com/' __description__ = """Promptfile.com hoster plugin""" - __authors__ = [("igel", "igelkun@myopera.com")] + __license__ = "GPLv3" + __authors__ = [("igel", "igelkun@myopera.com")] - FILE_INFO_PATTERN = r'<span style="[^"]*" title="[^"]*">(?P<N>.*?) \((?P<S>[\d.]+) (?P<U>\w+)\)</span>' + INFO_PATTERN = r'<span style="[^"]*" title="[^"]*">(?P<N>.*?) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</span>' OFFLINE_PATTERN = r'<span style="[^"]*" title="File Not Found">File Not Found</span>' CHASH_PATTERN = r'<input type="hidden" name="chash" value="([^"]*)" />' - LINK_PATTERN = r"clip: {\s*url: '(https?://(?:www\.)promptfile[^']*)'," + LINK_PATTERN = r'<a href=\"(.+)\" target=\"_blank\" class=\"view_dl_link\">Download File</a>' def handleFree(self): # STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: - self.parseError("Unable to detect chash") + self.error(_("CHASH_PATTERN not found")) chash = m.group(1) self.logDebug("Read chash %s" % chash) # continue to stage2 self.html = self.load(self.pyfile.url, decode=True, post={'chash': chash}) # STAGE 2: get the direct link - m = re.search(self.LINK_PATTERN, self.html, re.MULTILINE | re.DOTALL) + m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError("Unable to detect direct link") + self.error(_("LINK_PATTERN not found")) direct = m.group(1) self.logDebug("Found direct link: " + direct) self.download(direct, disposition=True) diff --git a/pyload/plugins/hoster/QuickshareCz.py b/pyload/plugins/hoster/QuickshareCz.py index 4e42c7c85..5203f90c7 100644 --- a/pyload/plugins/hoster/QuickshareCz.py +++ b/pyload/plugins/hoster/QuickshareCz.py @@ -8,19 +8,20 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class QuickshareCz(SimpleHoster): - __name__ = "QuickshareCz" - __type__ = "hoster" - __version__ = "0.54" + __name__ = "QuickshareCz" + __type__ = "hoster" + __version__ = "0.55" - __pattern__ = r'http://(?:[^/]*\.)?quickshare.cz/stahnout-soubor/.*' + __pattern__ = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.*' __description__ = """Quickshare.cz hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<th width="145px">Název:</th>\s*<td style="word-wrap:break-word;">(?P<N>[^<]+)</td>' - FILE_SIZE_PATTERN = r'<th>Velikost:</th>\s*<td>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</td>' - OFFLINE_PATTERN = r'<script type="text/javascript">location.href=\'/chyba\';</script>' + NAME_PATTERN = r'<th width="145px">Název:</th>\s*<td style="word-wrap:break-word;">(?P<N>[^<]+)</td>' + SIZE_PATTERN = r'<th>Velikost:</th>\s*<td>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</td>' + OFFLINE_PATTERN = r'<script type="text/javascript">location\.href=\'/chyba\';</script>' def process(self, pyfile): @@ -28,7 +29,7 @@ class QuickshareCz(SimpleHoster): self.getFileInfo() # parse js variables - self.jsvars = dict((x, y.strip("'")) for x, y in re.findall(r"var (\w+) = ([0-9.]+|'[^']*')", self.html)) + self.jsvars = dict((x, y.strip("'")) for x, y in re.findall(r"var (\w+) = ([\d.]+|'[^']*')", self.html)) self.logDebug(self.jsvars) pyfile.name = self.jsvars['ID3'] @@ -36,11 +37,11 @@ class QuickshareCz(SimpleHoster): if self.premium: if 'UU_prihlasen' in self.jsvars: if self.jsvars['UU_prihlasen'] == '0': - self.logWarning("User not logged in") + self.logWarning(_("User not logged in")) self.relogin(self.user) self.retry() elif float(self.jsvars['UU_kredit']) < float(self.jsvars['kredit_odecet']): - self.logWarning("Not enough credit left") + self.logWarning(_("Not enough credit left")) self.premium = False if self.premium: @@ -50,7 +51,8 @@ class QuickshareCz(SimpleHoster): check = self.checkDownload({"err": re.compile(r"\AChyba!")}, max_size=100) if check == "err": - self.fail("File not m or plugin defect") + self.fail(_("File not m or plugin defect")) + def handleFree(self): # get download url @@ -63,10 +65,10 @@ class QuickshareCz(SimpleHoster): self.header = self.req.http.header self.req.http.c.setopt(FOLLOWLOCATION, 1) - m = re.search("Location\s*:\s*(.*)", self.header, re.I) + m = re.search(r'Location\s*:\s*(.+)', self.header, re.I) if m is None: - self.fail('File not found') - download_url = m.group(1) + self.fail(_("File not found")) + download_url = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 self.logDebug("FREE URL2:" + download_url) # check errors @@ -77,11 +79,12 @@ class QuickshareCz(SimpleHoster): elif m.group(1) == '2': self.retry(60, 60, "No free slots available") else: - self.fail('Error %d' % m.group(1)) + self.fail(_("Error %d") % m.group(1)) # download file self.download(download_url) + def handlePremium(self): download_url = '%s/download_premium.php' % self.jsvars['server'] data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID4", "ID5")) diff --git a/pyload/plugins/hoster/RPNetBiz.py b/pyload/plugins/hoster/RPNetBiz.py index b4982dd8d..30c6773bd 100644 --- a/pyload/plugins/hoster/RPNetBiz.py +++ b/pyload/plugins/hoster/RPNetBiz.py @@ -7,38 +7,42 @@ from pyload.utils import json_loads class RPNetBiz(Hoster): - __name__ = "RPNetBiz" - __type__ = "hoster" + __name__ = "RPNetBiz" + __type__ = "hoster" __version__ = "0.1" __description__ = """RPNet.biz hoster plugin""" + __license__ = "GPLv3" __pattern__ = r'https?://.*rpnet\.biz' - __authors__ = [("Dman", "dmanugm@gmail.com")] + __authors__ = [("Dman", "dmanugm@gmail.com")] def setup(self): self.chunkLimit = -1 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): link_status = {'generated': pyfile.url} elif not self.account: # Check account self.logError(_("Please enter your %s account or deactivate this plugin") % "rpnet") - self.fail("No rpnet account provided") + self.fail(_("No rpnet account provided")) else: (user, data) = self.account.selectAccount() self.logDebug("Original URL: %s" % pyfile.url) # Get the download link - response = self.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, "password": data['password'], - "action": "generate", "links": pyfile.url}) + res = self.load("https://premium.rpnet.biz/client_api.php", + get={"username": user, + "password": data['password'], + "action": "generate", + "links": pyfile.url}) - self.logDebug("JSON data: %s" % response) - link_status = json_loads(response)['links'][0] # get the first link... since we only queried one + self.logDebug("JSON data: %s" % res) + link_status = json_loads(res)['links'][0] # get the first link... since we only queried one # Check if we only have an id as a HDD link if 'id' in link_status: @@ -51,11 +55,13 @@ class RPNetBiz(Hoster): my_try = 0 while (my_try <= max_tries): self.logDebug("Try: %d ; Max Tries: %d" % (my_try, max_tries)) - response = self.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, "password": data['password'], - "action": "downloadInformation", "id": link_status['id']}) - self.logDebug("JSON data hdd query: %s" % response) - download_status = json_loads(response)['download'] + res = self.load("https://premium.rpnet.biz/client_api.php", + get={"username": user, + "password": data['password'], + "action": "downloadInformation", + "id": link_status['id']}) + self.logDebug("JSON data hdd query: %s" % res) + download_status = json_loads(res)['download'] if download_status['status'] == '100': link_status['generated'] = download_status['rpnet_link'] @@ -69,11 +75,11 @@ class RPNetBiz(Hoster): my_try += 1 if my_try > max_tries: # We went over the limit! - self.fail("Waited for about 15 minutes for download to finish but failed") + self.fail(_("Waited for about 15 minutes for download to finish but failed")) if 'generated' in link_status: self.download(link_status['generated'], disposition=True) elif 'error' in link_status: self.fail(link_status['error']) else: - self.fail("Something went wrong, not supposed to enter here") + self.fail(_("Something went wrong, not supposed to enter here")) diff --git a/pyload/plugins/hoster/RapidgatorNet.py b/pyload/plugins/hoster/RapidgatorNet.py index 572b3e121..f9efa2461 100644 --- a/pyload/plugins/hoster/RapidgatorNet.py +++ b/pyload/plugins/hoster/RapidgatorNet.py @@ -12,30 +12,31 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RapidgatorNet(SimpleHoster): - __name__ = "RapidgatorNet" - __type__ = "hoster" - __version__ = "0.22" + __name__ = "RapidgatorNet" + __type__ = "hoster" + __version__ = "0.25" __pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' __description__ = """Rapidgator.net hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("chrox", None), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("chrox", None), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] API_URL = "http://rapidgator.net/api/file" - FILE_NAME_PATTERN = r'<title>Download file (?P<N>.*)</title>' - FILE_SIZE_PATTERN = r'File size:\s*<strong>(?P<S>[\d\.]+) (?P<U>\w+)</strong>' + NAME_PATTERN = r'<title>Download file (?P<N>.*)</title>' + SIZE_PATTERN = r'File size:\s*<strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' OFFLINE_PATTERN = r'>(File not found|Error 404)' - JSVARS_PATTERN = r"\s+var\s*(startTimerUrl|getDownloadUrl|captchaUrl|fid|secs)\s*=\s*'?(.*?)'?;" + JSVARS_PATTERN = r'\s+var\s*(startTimerUrl|getDownloadUrl|captchaUrl|fid|secs)\s*=\s*\'?(.*?)\'?;' PREMIUM_ONLY_ERROR_PATTERN = r'You can download files up to|This file can be downloaded by premium only<' DOWNLOAD_LIMIT_ERROR_PATTERN = r'You have reached your (daily|hourly) downloads limit' WAIT_PATTERN = r'(?:Delay between downloads must be not less than|Try again in)\s*(\d+)\s*(hour|min)' - LINK_PATTERN = r"return '(http://\w+.rapidgator.net/.*)';" + LINK_PATTERN = r'return \'(http://\w+.rapidgator.net/.*)\';' RECAPTCHA_PATTERN = r'"http://api\.recaptcha\.net/challenge\?k=(.*?)"' ADSCAPTCHA_PATTERN = r'(http://api\.adscaptcha\.com/Get\.aspx[^"\']*)' @@ -43,19 +44,17 @@ class RapidgatorNet(SimpleHoster): def setup(self): - self.resumeDownload = self.multiDL = self.premium - self.sid = None - self.chunkLimit = 1 - self.req.setOption("timeout", 120) - - def process(self, pyfile): if self.account: self.sid = self.account.getAccountData(self.user).get('SID', None) + else: + self.sid = None if self.sid: - self.handlePremium() - else: - self.handleFree() + self.premium = True + + self.resumeDownload = self.multiDL = self.premium + self.chunkLimit = 1 + def api_response(self, cmd): try: @@ -66,20 +65,24 @@ class RapidgatorNet(SimpleHoster): json = json_loads(json) status = json['response_status'] msg = json['response_details'] + except BadHeader, e: - self.logError("API:%s" % cmd, e, "SID: %s" % self.sid) + self.logError("API: %s" % cmd, e, "SID: %s" % self.sid) status = e.code msg = e if status == 200: return json['response'] + elif status == 423: self.account.empty(self.user) self.retry() + else: self.account.relogin(self.user) self.retry(wait_time=60) + def handlePremium(self): #self.logDebug("ACCOUNT_DATA", self.account.getAccountData(self.user)) self.api_data = self.api_response('info') @@ -89,9 +92,8 @@ class RapidgatorNet(SimpleHoster): url = self.api_response('download')['url'] self.download(url) - def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) + def handleFree(self): self.checkFree() jsvars = dict(re.findall(self.JSVARS_PATTERN, self.html)) @@ -104,7 +106,7 @@ class RapidgatorNet(SimpleHoster): jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars['fid']) jsvars.update(self.getJsonResponse(url)) - self.wait(int(jsvars.get('secs', 45)) + 1, False) + self.wait(int(jsvars.get('secs', 45)), False) url = "http://rapidgator.net%s?sid=%s" % ( jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars['sid']) @@ -116,7 +118,7 @@ class RapidgatorNet(SimpleHoster): url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha') self.html = self.load(url) - for _ in xrange(5): + for _i in xrange(5): m = re.search(self.LINK_PATTERN, self.html) if m: link = m.group(1) @@ -138,7 +140,8 @@ class RapidgatorNet(SimpleHoster): else: self.correctCaptcha() else: - self.parseError("Download link") + self.error(_("Download link")) + def getCaptcha(self): m = re.search(self.ADSCAPTCHA_PATTERN, self.html) @@ -156,14 +159,15 @@ class RapidgatorNet(SimpleHoster): captcha_key = m.group(1) captcha = SolveMedia(self) else: - self.parseError("Captcha") + self.error(_("Captcha")) return captcha, captcha_key + def checkFree(self): m = re.search(self.PREMIUM_ONLY_ERROR_PATTERN, self.html) if m: - self.fail("Premium account needed for download") + self.fail(_("Premium account needed for download")) else: m = re.search(self.WAIT_PATTERN, self.html) @@ -174,7 +178,7 @@ class RapidgatorNet(SimpleHoster): if m is None: return elif m.group(1) == "daily": - self.logWarning("You have reached your daily downloads limit for today") + self.logWarning(_("You have reached your daily downloads limit for today")) wait_time = secondsToMidnight(gmt=2) else: wait_time = 1 * 60 * 60 @@ -183,12 +187,13 @@ class RapidgatorNet(SimpleHoster): self.wait(wait_time, True) self.retry() + def getJsonResponse(self, url): - response = self.load(url, decode=True) - if not response.startswith('{'): + res = self.load(url, decode=True) + if not res.startswith('{'): self.retry() - self.logDebug(url, response) - return json_loads(response) + self.logDebug(url, res) + return json_loads(res) getInfo = create_getInfo(RapidgatorNet) diff --git a/pyload/plugins/hoster/RapidshareCom.py b/pyload/plugins/hoster/RapidshareCom.py index afbab10c9..4b8633fef 100644 --- a/pyload/plugins/hoster/RapidshareCom.py +++ b/pyload/plugins/hoster/RapidshareCom.py @@ -42,19 +42,17 @@ def getInfo(urls): class RapidshareCom(Hoster): - __name__ = "RapidshareCom" - __type__ = "hoster" - __version__ = "1.39" + __name__ = "RapidshareCom" + __type__ = "hoster" + __version__ = "1.40" - __pattern__ = r'https?://(?:www\.)?rapidshare.com/(?:files/(?P<id>\d*?)/(?P<name>[^?]+)|#!download\|(?:\w+)\|(?P<id_new>\d+)\|(?P<name_new>[^|]+))' - __config__ = [("server", - "Cogent;Deutsche Telekom;Level(3);Level(3) #2;GlobalCrossing;Level(3) #3;Teleglobe;GlobalCrossing #2;TeliaSonera #2;Teleglobe #2;TeliaSonera #3;TeliaSonera", - "Preferred Server", "None")] + __pattern__ = r'https?://(?:www\.)?rapidshare\.com/(?:files/(?P<id>\d+)/(?P<name>[^?]+)|#!download\|(?:\w+)\|(?P<id_new>\d+)\|(?P<name_new>[^|]+))' __description__ = """Rapidshare.com hoster plugin""" - __authors__ = [("spoob", "spoob@pyload.org"), - ("RaNaN", "ranan@pyload.org"), - ("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org"), + ("RaNaN", "ranan@pyload.org"), + ("mkaay", "mkaay@mkaay.de")] def setup(self): @@ -69,10 +67,12 @@ class RapidshareCom(Hoster): self.chunkLimit = -1 if self.premium else 1 self.multiDL = self.resumeDownload = self.premium + def process(self, pyfile): self.url = pyfile.url self.prepare() + def prepare(self): m = re.match(self.__pattern__, self.url) @@ -103,7 +103,8 @@ class RapidshareCom(Hoster): elif self.api_data['status'] == "3": self.tempOffline() else: - self.fail("Unknown response code.") + self.error(_("Unknown response code")) + def handleFree(self): while self.no_download: @@ -127,12 +128,14 @@ class RapidshareCom(Hoster): self.offset += 5 self.handleFree() + def handlePremium(self): info = self.account.getAccountInfo(self.user, True) - self.logDebug("%s: Use Premium Account" % self.__name__) + self.logDebug("Use Premium Account") url = self.api_data['mirror'] self.download(url, get={"directstart": 1}) + def download_api_data(self, force=False): """ http://images.rapidshare.com/apidoc.txt @@ -141,11 +144,11 @@ class RapidshareCom(Hoster): return api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" api_param_file = {"sub": "checkfiles", "incmd5": "1", "files": self.id, "filenames": self.name} - src = self.load(api_url_base, cookies=False, get=api_param_file).strip() - self.logDebug("RS INFO API: %s" % src) - if src.startswith("ERROR"): + html = self.load(api_url_base, cookies=False, get=api_param_file).strip() + self.logDebug("RS INFO API: %s" % html) + if html.startswith("ERROR"): return - fields = src.split(",") + fields = html.split(",") # status codes: # 0=File not found @@ -167,6 +170,7 @@ class RapidshareCom(Hoster): self.api_data['mirror'] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data + def freeWait(self): """downloads html with the important information """ @@ -198,8 +202,7 @@ class RapidshareCom(Hoster): elif "Filename invalid." in result: self.fail(_("Filename reported invalid")) elif between_wait: - self.setWait(int(between_wait.group(1))) - self.wantReconnect = True + self.setWait(int(between_wait.group(1)), True) self.wait() else: self.no_download = False @@ -218,6 +221,7 @@ class RapidshareCom(Hoster): return dl_dict + def get_file_name(self): if self.api_data['filename']: return self.api_data['filename'] diff --git a/pyload/plugins/hoster/RarefileNet.py b/pyload/plugins/hoster/RarefileNet.py index c59f27d07..cd60ec65e 100644 --- a/pyload/plugins/hoster/RarefileNet.py +++ b/pyload/plugins/hoster/RarefileNet.py @@ -2,25 +2,26 @@ import re -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo from pyload.utils import html_unescape -class RarefileNet(XFSPHoster): - __name__ = "RarefileNet" - __type__ = "hoster" - __version__ = "0.03" +class RarefileNet(XFSHoster): + __name__ = "RarefileNet" + __type__ = "hoster" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?rarefile\.net/\w{12}' __description__ = """Rarefile.net hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_NAME = "rarefile.net" + HOSTER_DOMAIN = "rarefile.net" - FILE_NAME_PATTERN = r'<td><font color="red">(?P<N>.*?)</font></td>' - FILE_SIZE_PATTERN = r'<td>Size : (?P<S>.+?) ' + NAME_PATTERN = r'<td><font color="red">(?P<N>.*?)</font></td>' + SIZE_PATTERN = r'<td>Size : (?P<S>.+?) ' LINK_PATTERN = r'<a href="(?P<link>[^"]+)">(?P=link)</a>' diff --git a/pyload/plugins/hoster/RealdebridCom.py b/pyload/plugins/hoster/RealdebridCom.py index 09c8d7f7e..f839dc613 100644 --- a/pyload/plugins/hoster/RealdebridCom.py +++ b/pyload/plugins/hoster/RealdebridCom.py @@ -12,14 +12,15 @@ from pyload.utils import parseFileSize class RealdebridCom(Hoster): - __name__ = "RealdebridCom" - __type__ = "hoster" + __name__ = "RealdebridCom" + __type__ = "hoster" __version__ = "0.53" __pattern__ = r'https?://(?:[^/]*\.)?real-debrid\..*' __description__ = """Real-Debrid.com hoster plugin""" - __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] + __license__ = "GPLv3" + __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] def getFilename(self, url): @@ -27,20 +28,22 @@ class RealdebridCom(Hoster): name = unquote(url.rsplit("/", 1)[1]) except IndexError: name = "Unknown_Filename..." - if not name or name.endswith(".."): # incomplete filename, append random stuff + if not name or name.endswith(".."): #: incomplete filename, append random stuff name += "%s.tmp" % randrange(100, 999) return name + def setup(self): self.chunkLimit = 3 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "Real-debrid") - self.fail("No Real-debrid account provided") + self.fail(_("No Real-debrid account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) password = self.getPassword().splitlines() @@ -87,4 +90,4 @@ class RealdebridCom(Hoster): if check == "error": #usual this download can safely be retried - self.retry(wait_time=60, reason="An error occured while generating link.") + self.retry(wait_time=60, reason=_("An error occured while generating link")) diff --git a/pyload/plugins/hoster/RedtubeCom.py b/pyload/plugins/hoster/RedtubeCom.py index d874f10c9..50c6ba9e3 100644 --- a/pyload/plugins/hoster/RedtubeCom.py +++ b/pyload/plugins/hoster/RedtubeCom.py @@ -7,14 +7,15 @@ from pyload.utils import html_unescape class RedtubeCom(Hoster): - __name__ = "RedtubeCom" - __type__ = "hoster" + __name__ = "RedtubeCom" + __type__ = "hoster" __version__ = "0.2" __pattern__ = r'http://(?:www\.)?redtube\.com/\d+' __description__ = """Redtube.com hoster plugin""" - __authors__ = [("jeix", "jeix@hasnomail.de")] + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de")] def process(self, pyfile): @@ -25,10 +26,12 @@ class RedtubeCom(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) + def download_html(self): url = self.pyfile.url self.html = self.load(url) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -39,12 +42,14 @@ class RedtubeCom(Hoster): return file_url + def get_file_name(self): if not self.html: self.download_html() return re.search('<title>(.*?)- RedTube - Free Porn Videos</title>', self.html).group(1).strip() + ".flv" + def file_exists(self): """ returns True or False """ diff --git a/pyload/plugins/hoster/RehostTo.py b/pyload/plugins/hoster/RehostTo.py index 0e6af0edb..08c43ad16 100644 --- a/pyload/plugins/hoster/RehostTo.py +++ b/pyload/plugins/hoster/RehostTo.py @@ -6,27 +6,30 @@ from pyload.plugins.base.Hoster import Hoster class RehostTo(Hoster): - __name__ = "RehostTo" - __type__ = "hoster" + __name__ = "RehostTo" + __type__ = "hoster" __version__ = "0.13" - __pattern__ = r'https?://.*rehost.to\..*' + __pattern__ = r'https?://.*rehost\.to\..*' __description__ = """Rehost.com hoster plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] def getFilename(self, url): return unquote(url.rsplit("/", 1)[1]) + def setup(self): self.chunkLimit = 1 self.resumeDownload = True + def process(self, pyfile): if not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "rehost.to") - self.fail("No rehost.to account provided") + self.fail(_("No rehost.to account provided")) data = self.account.getAccountInfo(self.user) long_ses = data['long_ses'] diff --git a/pyload/plugins/hoster/RemixshareCom.py b/pyload/plugins/hoster/RemixshareCom.py index 41bba2569..fee898654 100644 --- a/pyload/plugins/hoster/RemixshareCom.py +++ b/pyload/plugins/hoster/RemixshareCom.py @@ -14,18 +14,19 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RemixshareCom(SimpleHoster): - __name__ = "RemixshareCom" - __type__ = "hoster" - __version__ = "0.01" + __name__ = "RemixshareCom" + __type__ = "hoster" + __version__ = "0.02" __pattern__ = r'https?://remixshare\.com/(download|dl)/\w+' __description__ = """Remixshare.com hoster plugin""" - __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"), + ("Walter Purcaro", "vuolter@gmail.com")] - FILE_INFO_PATTERN = r'title=\'.+?\'>(?P<N>.+?)</span><span class=\'light2\'> \((?P<S>\d+) (?P<U>\w+)\)<' + INFO_PATTERN = r'title=\'.+?\'>(?P<N>.+?)</span><span class=\'light2\'> \((?P<S>\d+) (?P<U>[\w^_]+)\)<' OFFLINE_PATTERN = r'<h1>Ooops!<' LINK_PATTERN = r'(http://remixshare\.com/downloadfinal/.+?)"' @@ -37,13 +38,14 @@ class RemixshareCom(SimpleHoster): self.multiDL = True self.chunkLimit = 1 + def handleFree(self): b = re.search(self.LINK_PATTERN, self.html) if not b: - self.parseError("Cannot parse download url") + self.error(_("Cannot parse download url")) c = re.search(self.TOKEN_PATTERN, self.html) if not c: - self.parseError("Cannot parse file token") + self.error(_("Cannot parse file token")) dl_url = b.group(1) + c.group(1) #Check if we have to wait @@ -53,7 +55,6 @@ class RemixshareCom(SimpleHoster): self.wait(seconds.group(1)) # Finally start downloading... - self.logDebug("Download URL = r" + dl_url) self.download(dl_url, disposition=True) diff --git a/pyload/plugins/hoster/RgHostNet.py b/pyload/plugins/hoster/RgHostNet.py index 5db278bbf..82a5b88c5 100644 --- a/pyload/plugins/hoster/RgHostNet.py +++ b/pyload/plugins/hoster/RgHostNet.py @@ -6,17 +6,18 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RgHostNet(SimpleHoster): - __name__ = "RgHostNet" - __type__ = "hoster" - __version__ = "0.01" + __name__ = "RgHostNet" + __type__ = "hoster" + __version__ = "0.02" __pattern__ = r'http://(?:www\.)?rghost\.net/\d+(?:r=\d+)?' __description__ = """RgHost.net hoster plugin""" - __authors__ = [("z00nx", "z00nx0@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("z00nx", "z00nx0@gmail.com")] - FILE_INFO_PATTERN = r'<h1>\s+(<a[^>]+>)?(?P<N>[^<]+)(</a>)?\s+<small[^>]+>\s+\((?P<S>[^)]+)\)\s+</small>\s+</h1>' + INFO_PATTERN = r'<h1>\s+(<a[^>]+>)?(?P<N>[^<]+)(</a>)?\s+<small[^>]+>\s+\((?P<S>[^)]+)\)\s+</small>\s+</h1>' OFFLINE_PATTERN = r'File is deleted|this page is not found' LINK_PATTERN = r'''<a\s+href="([^"]+)"\s+class="btn\s+large\s+download"[^>]+>Download</a>''' @@ -24,7 +25,7 @@ class RgHostNet(SimpleHoster): def handleFree(self): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError("Unable to detect the direct link") + self.error(_("LINK_PATTERN not found")) download_link = m.group(1) self.download(download_link, disposition=True) diff --git a/pyload/plugins/hoster/RyushareCom.py b/pyload/plugins/hoster/RyushareCom.py index 6c08e5cd7..f41e4bfbf 100644 --- a/pyload/plugins/hoster/RyushareCom.py +++ b/pyload/plugins/hoster/RyushareCom.py @@ -5,26 +5,27 @@ import re -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo from pyload.plugins.internal.CaptchaService import SolveMedia -class RyushareCom(XFSPHoster): - __name__ = "RyushareCom" - __type__ = "hoster" - __version__ = "0.16" +class RyushareCom(XFSHoster): + __name__ = "RyushareCom" + __type__ = "hoster" + __version__ = "0.20" __pattern__ = r'http://(?:www\.)?ryushare\.com/\w+' __description__ = """Ryushare.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("quareevo", "quareevo@arcor.de")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it"), + ("quareevo", "quareevo@arcor.de")] - HOSTER_NAME = "ryushare.com" + HOSTER_DOMAIN = "ryushare.com" - FILE_SIZE_PATTERN = r'You have requested <font color="red">[^<]+</font> \((?P<S>[\d\.]+) (?P<U>\w+)' + SIZE_PATTERN = r'You have requested <font color="red">[^<]+</font> \((?P<S>[\d.,]+) (?P<U>[\w^_]+)' WAIT_PATTERN = r'You have to wait ((?P<hour>\d+) hour[s]?, )?((?P<min>\d+) minute[s], )?(?P<sec>\d+) second[s]' LINK_PATTERN = r'<a href="([^"]+)">Click here to download<' @@ -57,14 +58,9 @@ class RyushareCom(XFSPHoster): if retry: self.retry() - for _ in xrange(5): - captcha = SolveMedia(self) - - captcha_key = captcha.detect_key() - if captcha_key is None: - self.parseError("SolveMedia key not found") - - challenge, response = captcha.challenge(captcha_key) + for _i in xrange(5): + solvemedia = SolveMedia(self) + challenge, response = solvemedia.challenge() inputs['adcopy_challenge'] = challenge inputs['adcopy_response'] = response @@ -72,12 +68,11 @@ class RyushareCom(XFSPHoster): self.html = self.load(self.pyfile.url, post=inputs) if "WRONG CAPTCHA" in self.html: self.invalidCaptcha() - self.logInfo("Invalid Captcha") else: self.correctCaptcha() break else: - self.fail("You have entered 5 invalid captcha codes") + self.fail(_("You have entered 5 invalid captcha codes")) if "Click here to download" in self.html: return re.search(r'<a href="([^"]+)">Click here to download</a>', self.html).group(1) diff --git a/pyload/plugins/hoster/SecureUploadEu.py b/pyload/plugins/hoster/SecureUploadEu.py index d6d0207e8..64e6456a9 100644 --- a/pyload/plugins/hoster/SecureUploadEu.py +++ b/pyload/plugins/hoster/SecureUploadEu.py @@ -1,22 +1,23 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class SecureUploadEu(XFSPHoster): - __name__ = "SecureUploadEu" - __type__ = "hoster" - __version__ = "0.02" +class SecureUploadEu(XFSHoster): + __name__ = "SecureUploadEu" + __type__ = "hoster" + __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?secureupload\.eu/\w{12}' __description__ = """SecureUpload.eu hoster plugin""" - __authors__ = [("z00nx", "z00nx0@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("z00nx", "z00nx0@gmail.com")] - HOSTER_NAME = "secureupload.eu" + HOSTER_DOMAIN = "secureupload.eu" - FILE_INFO_PATTERN = r'<h3>Downloading (?P<N>[^<]+) \((?P<S>[^<]+)\)</h3>' + INFO_PATTERN = r'<h3>Downloading (?P<N>[^<]+) \((?P<S>[^<]+)\)</h3>' getInfo = create_getInfo(SecureUploadEu) diff --git a/pyload/plugins/hoster/SendmywayCom.py b/pyload/plugins/hoster/SendmywayCom.py index 71cdf804d..4254922fc 100644 --- a/pyload/plugins/hoster/SendmywayCom.py +++ b/pyload/plugins/hoster/SendmywayCom.py @@ -1,23 +1,24 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class SendmywayCom(XFSPHoster): - __name__ = "SendmywayCom" - __type__ = "hoster" - __version__ = "0.01" +class SendmywayCom(XFSHoster): + __name__ = "SendmywayCom" + __type__ = "hoster" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?sendmyway\.com/\w{12}' __description__ = """SendMyWay hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_NAME = "sendmyway.com" + HOSTER_DOMAIN = "sendmyway.com" - FILE_NAME_PATTERN = r'<p class="file-name" ><.*?>\s*(?P<N>.+)' - FILE_SIZE_PATTERN = r'<small>\((?P<S>\d+) bytes\)</small>' + NAME_PATTERN = r'<p class="file-name" ><.*?>\s*(?P<N>.+)' + SIZE_PATTERN = r'<small>\((?P<S>\d+) bytes\)</small>' getInfo = create_getInfo(SendmywayCom) diff --git a/pyload/plugins/hoster/SendspaceCom.py b/pyload/plugins/hoster/SendspaceCom.py index eb7fad5cd..2915d47c0 100644 --- a/pyload/plugins/hoster/SendspaceCom.py +++ b/pyload/plugins/hoster/SendspaceCom.py @@ -6,28 +6,29 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class SendspaceCom(SimpleHoster): - __name__ = "SendspaceCom" - __type__ = "hoster" - __version__ = "0.13" + __name__ = "SendspaceCom" + __type__ = "hoster" + __version__ = "0.14" - __pattern__ = r'http://(?:www\.)?sendspace.com/file/.*' + __pattern__ = r'http://(?:www\.)?sendspace\.com/file/.*' __description__ = """Sendspace.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<h2 class="bgray">\s*<(?:b|strong)>(?P<N>[^<]+)</' - FILE_SIZE_PATTERN = r'<div class="file_description reverse margin_center">\s*<b>File Size:</b>\s*(?P<S>[0-9.]+)(?P<U>[kKMG])i?B\s*</div>' + NAME_PATTERN = r'<h2 class="bgray">\s*<(?:b|strong)>(?P<N>[^<]+)</' + SIZE_PATTERN = r'<div class="file_description reverse margin_center">\s*<b>File Size:</b>\s*(?P<S>[\d.,]+)(?P<U>[\w^_]+)\s*</div>' OFFLINE_PATTERN = r'<div class="msg error" style="cursor: default">Sorry, the file you requested is not available.</div>' LINK_PATTERN = r'<a id="download_button" href="([^"]+)"' - CAPTCHA_PATTERN = r'<td><img src="(/captchas/captcha.php?captcha=([^"]+))"></td>' - USER_CAPTCHA_PATTERN = r'<td><img src="/captchas/captcha.php?user=([^"]+))"></td>' + CAPTCHA_PATTERN = r'<td><img src="(/captchas/captcha\.php?captcha=([^"]+))"></td>' + USER_CAPTCHA_PATTERN = r'<td><img src="/captchas/captcha\.php?user=([^"]+))"></td>' def handleFree(self): params = {} - for _ in xrange(3): + for _i in xrange(3): m = re.search(self.LINK_PATTERN, self.html) if m: if 'captcha_hash' in params: @@ -51,10 +52,9 @@ class SendspaceCom(SimpleHoster): self.logDebug(params) self.html = self.load(self.pyfile.url, post=params) else: - self.fail("Download link not found") + self.fail(_("Download link not found")) - self.logDebug("Download URL: %s" % download_url) self.download(download_url) -create_getInfo(SendspaceCom) +getInfo = create_getInfo(SendspaceCom) diff --git a/pyload/plugins/hoster/Share4webCom.py b/pyload/plugins/hoster/Share4webCom.py index ac8623464..9449ec959 100644 --- a/pyload/plugins/hoster/Share4webCom.py +++ b/pyload/plugins/hoster/Share4webCom.py @@ -5,17 +5,18 @@ from pyload.plugins.internal.SimpleHoster import create_getInfo class Share4webCom(UnibytesCom): - __name__ = "Share4webCom" - __type__ = "hoster" - __version__ = "0.1" + __name__ = "Share4webCom" + __type__ = "hoster" + __version__ = "0.11" - __pattern__ = r'http://(?:www\.)?share4web\.com/get/\w+' + __pattern__ = r'https?://(?:www\.)?share4web\.com/get/\w+' __description__ = """Share4web.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_NAME = "share4web.com" + HOSTER_DOMAIN = "share4web.com" getInfo = create_getInfo(UnibytesCom) diff --git a/pyload/plugins/hoster/Share76Com.py b/pyload/plugins/hoster/Share76Com.py index ebcec3e0c..fb6fc041f 100644 --- a/pyload/plugins/hoster/Share76Com.py +++ b/pyload/plugins/hoster/Share76Com.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class Share76Com(DeadHoster): - __name__ = "Share76Com" - __type__ = "hoster" + __name__ = "Share76Com" + __type__ = "hoster" __version__ = "0.04" - __pattern__ = r'http://(?:www\.)?share76.com/\w{12}' + __pattern__ = r'http://(?:www\.)?share76\.com/\w{12}' __description__ = """Share76.com hoster plugin""" - __authors__ = [] + __license__ = "GPLv3" + __authors__ = [] getInfo = create_getInfo(Share76Com) diff --git a/pyload/plugins/hoster/ShareFilesCo.py b/pyload/plugins/hoster/ShareFilesCo.py index 5b7d7a863..db51c2024 100644 --- a/pyload/plugins/hoster/ShareFilesCo.py +++ b/pyload/plugins/hoster/ShareFilesCo.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class ShareFilesCo(DeadHoster): - __name__ = "ShareFilesCo" - __type__ = "hoster" + __name__ = "ShareFilesCo" + __type__ = "hoster" __version__ = "0.02" __pattern__ = r'http://(?:www\.)?sharefiles\.co/\w{12}' __description__ = """Sharefiles.co hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] getInfo = create_getInfo(ShareFilesCo) diff --git a/pyload/plugins/hoster/ShareRapidCom.py b/pyload/plugins/hoster/ShareRapidCom.py deleted file mode 100644 index 0a56fa54d..000000000 --- a/pyload/plugins/hoster/ShareRapidCom.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pycurl import HTTPHEADER - -from pyload.network.RequestFactory import getRequest -from pyload.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo - - -def getInfo(urls): - h = getRequest() - h.c.setopt(HTTPHEADER, - ["Accept: text/html", - "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"]) - for url in urls: - html = h.load(url, decode=True) - file_info = parseFileInfo(ShareRapidCom, url, html) - yield file_info - - -class ShareRapidCom(SimpleHoster): - __name__ = "ShareRapidCom" - __type__ = "hoster" - __version__ = "0.54" - - __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' - - __description__ = """MegaRapid.cz hoster plugin""" - __authors__ = [("MikyWoW", "mikywow@seznam.cz"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] - - - FILE_NAME_PATTERN = r'<h1[^>]*><span[^>]*>(?:<a[^>]*>)?(?P<N>[^<]+)' - FILE_SIZE_PATTERN = r'<td class="i">Velikost:</td>\s*<td class="h"><strong>\s*(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</strong></td>' - OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán' - - FORCE_CHECK_TRAFFIC = True - - LINK_PATTERN = r'<a href="([^"]+)" title="Stahnout">([^<]+)</a>' - ERR_LOGIN_PATTERN = ur'<div class="error_div"><strong>Stahovánà je pÅÃstupné pouze pÅihlášenÃœm uÅŸivatelům' - ERR_CREDIT_PATTERN = ur'<div class="error_div"><strong>Stahovánà zdarma je moÅŸné jen pÅes náš' - - - def setup(self): - self.chunkLimit = 1 - - def handlePremium(self): - try: - self.html = self.load(self.pyfile.url, decode=True) - except BadHeader, e: - self.account.relogin(self.user) - self.retry(max_tries=3, reason=str(e)) - - m = re.search(self.LINK_PATTERN, self.html) - if m: - link = m.group(1) - self.logDebug("Premium link: %s" % link) - self.download(link, disposition=True) - else: - if re.search(self.ERR_LOGIN_PATTERN, self.html): - self.relogin(self.user) - self.retry(max_tries=3, reason="User login failed") - elif re.search(self.ERR_CREDIT_PATTERN, self.html): - self.fail("Not enough credit left") - else: - self.fail("Download link not found") diff --git a/pyload/plugins/hoster/SharebeesCom.py b/pyload/plugins/hoster/SharebeesCom.py index f8892b441..07f0e8bfd 100644 --- a/pyload/plugins/hoster/SharebeesCom.py +++ b/pyload/plugins/hoster/SharebeesCom.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class SharebeesCom(DeadHoster): - __name__ = "SharebeesCom" - __type__ = "hoster" + __name__ = "SharebeesCom" + __type__ = "hoster" __version__ = "0.02" - __pattern__ = r'http://(?:www\.)?sharebees.com/\w{12}' + __pattern__ = r'http://(?:www\.)?sharebees\.com/\w{12}' __description__ = """ShareBees hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] getInfo = create_getInfo(SharebeesCom) diff --git a/pyload/plugins/hoster/ShareonlineBiz.py b/pyload/plugins/hoster/ShareonlineBiz.py index d48d76018..73d598cb9 100644 --- a/pyload/plugins/hoster/ShareonlineBiz.py +++ b/pyload/plugins/hoster/ShareonlineBiz.py @@ -18,9 +18,9 @@ def getInfo(urls): for chunk in chunks(urls, 90): api_param_file = {"links": "\n".join(x.replace("http://www.share-online.biz/dl/", "").rstrip("/") for x in chunk)} # api only supports old style links - src = getURL(api_url_base, post=api_param_file, decode=True) + html = getURL(api_url_base, post=api_param_file, decode=True) result = [] - for i, res in enumerate(src.split("\n")): + for i, res in enumerate(html.split("\n")): if not res: continue fields = res.split(";") @@ -37,73 +37,65 @@ def getInfo(urls): class ShareonlineBiz(Hoster): - __name__ = "ShareonlineBiz" - __type__ = "hoster" - __version__ = "0.40" + __name__ = "ShareonlineBiz" + __type__ = "hoster" + __version__ = "0.41" - __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download.php\?id=|dl/)(?P<ID>\w+)' + __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)' __description__ = """Shareonline.biz hoster plugin""" - __authors__ = [("spoob", "spoob@pyload.org"), - ("mkaay", "mkaay@mkaay.de"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org"), + ("mkaay", "mkaay@mkaay.de"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] ERROR_INFO_PATTERN = r'<p class="b">Information:</p>\s*<div>\s*<strong>(.*?)</strong>' def setup(self): - # range request not working? - # api supports resume, only one chunk - # website isn't supporting resuming in first place self.file_id = re.match(self.__pattern__, self.pyfile.url).group("ID") self.pyfile.url = "http://www.share-online.biz/dl/" + self.file_id self.resumeDownload = self.premium self.multiDL = False - #self.chunkLimit = 1 self.check_data = None + def process(self, pyfile): if self.premium: self.handlePremium() - #web-download fallback removed - didn't work anyway else: self.handleFree() - # check = self.checkDownload({"failure": re.compile(self.ERROR_INFO_PATTERN)}) - # if check == "failure": - # try: - # self.retry(reason=self.lastCheck.group(1).decode("utf8")) - # except: - # self.retry(reason="Unknown error") - if self.api_data: self.check_data = {"size": int(self.api_data['size']), "md5": self.api_data['md5']} + def loadAPIData(self): api_url_base = "http://api.share-online.biz/linkcheck.php?md5=1" - api_param_file = {"links": self.file_id} # api only supports old style links - src = self.load(api_url_base, cookies=False, post=api_param_file, decode=True) + api_param_file = {"links": self.file_id} #: api only supports old style links + html = self.load(api_url_base, cookies=False, post=api_param_file, decode=True) - fields = src.split(";") + fields = html.split(";") self.api_data = {"fileid": fields[0], "status": fields[1]} if not self.api_data['status'] == "OK": self.offline() else: self.api_data['filename'] = fields[2] - self.api_data['size'] = fields[3] # in bytes - self.api_data['md5'] = fields[4].strip().lower().replace("\n\n", "") # md5 + self.api_data['size'] = fields[3] #: in bytes + self.api_data['md5'] = fields[4].strip().lower().replace("\n\n", "") #: md5 + def handleFree(self): self.loadAPIData() self.pyfile.name = self.api_data['filename'] self.pyfile.size = int(self.api_data['size']) - self.html = self.load(self.pyfile.url, cookies=True) # refer, stuff + self.html = self.load(self.pyfile.url, cookies=True) #: refer, stuff self.setWait(3) self.wait() @@ -113,27 +105,26 @@ class ShareonlineBiz(Hoster): m = re.search(r'var wait=(\d+);', self.html) recaptcha = ReCaptcha(self) - for _ in xrange(5): + for _i in xrange(5): challenge, response = recaptcha.challenge("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX") self.setWait(int(m.group(1)) if m else 30) - response = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), post={ - 'dl_free': '1', - 'recaptcha_challenge_field': challenge, - 'recaptcha_response_field': response}) + res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), + post={'dl_free': '1', + 'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': response}) - if not response == '0': + if not res == '0': self.correctCaptcha() break else: self.invalidCaptcha() else: self.invalidCaptcha() - self.fail("No valid captcha solution received") + self.fail(_("No valid captcha solution received")) - download_url = response.decode("base64") - self.logDebug(download_url) + download_url = res.decode("base64") if not download_url.startswith("http://"): - self.parseError("download url") + self.error(_("Wrong download url")) self.wait() self.download(download_url) @@ -151,14 +142,15 @@ class ShareonlineBiz(Hoster): else: self.correctCaptcha() + def handlePremium(self): #: should be working better loading (account) api internally self.account.getAccountInfo(self.user, True) - src = self.load("http://api.share-online.biz/account.php", + html = self.load("http://api.share-online.biz/account.php", {"username": self.user, "password": self.account.accounts[self.user]['password'], "act": "download", "lid": self.file_id}) self.api_data = dlinfo = {} - for line in src.splitlines(): + for line in html.splitlines(): key, value = line.split(": ") dlinfo[key.lower()] = value @@ -176,20 +168,22 @@ class ShareonlineBiz(Hoster): self.multiDL = True self.download(dlLink) + def checkErrors(self): m = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL) if m is None: return err = m.group(1) - m = re.search(self.ERROR_INFO_PATTERN, self.html) - msg = m.group(1) if m else "" - self.logError(err, msg or "Unknown error occurred") + try: + self.logError(err, re.search(self.ERROR_INFO_PATTERN, self.html).group(1)) + except: + self.logError(err, "Unknown error occurred") if err == "invalid": - self.fail(msg or "File not available") + self.fail(_("File not available")) elif err in ("freelimit", "size", "proxy"): - self.fail(msg or "Premium account needed") + self.fail(_("Premium account needed")) else: if err in 'server': self.setWait(600, False) @@ -199,4 +193,4 @@ class ShareonlineBiz(Hoster): self.setWait(300, True) self.wait() - self.retry(max_tries=25, reason=msg) + self.retry(max_tries=25, reason=err) diff --git a/pyload/plugins/hoster/ShareplaceCom.py b/pyload/plugins/hoster/ShareplaceCom.py index f4ade5760..ec59d061c 100644 --- a/pyload/plugins/hoster/ShareplaceCom.py +++ b/pyload/plugins/hoster/ShareplaceCom.py @@ -8,14 +8,15 @@ from pyload.plugins.base.Hoster import Hoster class ShareplaceCom(Hoster): - __name__ = "ShareplaceCom" - __type__ = "hoster" + __name__ = "ShareplaceCom" + __type__ = "hoster" __version__ = "0.11" - __pattern__ = r'(http://)?(?:www\.)?shareplace\.(com|org)/\?[a-zA-Z0-9]+' + __pattern__ = r'(http://)?(?:www\.)?shareplace\.(com|org)/\?\w+' __description__ = """Shareplace.com hoster plugin""" - __authors__ = [("ACCakut", None)] + __license__ = "GPLv3" + __authors__ = [("ACCakut", None)] def process(self, pyfile): @@ -23,6 +24,7 @@ class ShareplaceCom(Hoster): self.prepare() self.download(self.get_file_url()) + def prepare(self): if not self.file_exists(): self.offline() @@ -31,9 +33,10 @@ class ShareplaceCom(Hoster): wait_time = self.get_waiting_time() self.setWait(wait_time) - self.logDebug("%s: Waiting %d seconds." % (self.__name__, wait_time)) + self.logDebug("Waiting %d seconds." % wait_time) self.wait() + def get_waiting_time(self): if not self.html: self.download_html() @@ -47,10 +50,12 @@ class ShareplaceCom(Hoster): return sec + def download_html(self): url = re.sub("shareplace.com\/\?", "shareplace.com//index1.php/?a=", self.pyfile.url) self.html = self.load(url, decode=True) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -63,7 +68,8 @@ class ShareplaceCom(Hoster): self.logDebug("URL: %s" % url) return url else: - self.fail("absolute filepath could not be found. offline? ") + self.error(_("Absolute filepath not found")) + def get_file_name(self): if not self.html: @@ -71,6 +77,7 @@ class ShareplaceCom(Hoster): return re.search("<title>\s*(.*?)\s*</title>", self.html).group(1) + def file_exists(self): """ returns True or False """ diff --git a/pyload/plugins/hoster/ShragleCom.py b/pyload/plugins/hoster/ShragleCom.py index 519434a4b..792457bbc 100644 --- a/pyload/plugins/hoster/ShragleCom.py +++ b/pyload/plugins/hoster/ShragleCom.py @@ -4,15 +4,16 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class ShragleCom(DeadHoster): - __name__ = "ShragleCom" - __type__ = "hoster" + __name__ = "ShragleCom" + __type__ = "hoster" __version__ = "0.22" - __pattern__ = r'http://(?:www\.)?(cloudnator|shragle).com/files/(?P<ID>.*?)/' + __pattern__ = r'http://(?:www\.)?(cloudnator|shragle)\.com/files/(?P<ID>.*?)/' __description__ = """Cloudnator.com (Shragle.com) hoster plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz")] getInfo = create_getInfo(ShragleCom) diff --git a/pyload/plugins/hoster/SimplyPremiumCom.py b/pyload/plugins/hoster/SimplyPremiumCom.py index be863e8aa..0840bc8a2 100644 --- a/pyload/plugins/hoster/SimplyPremiumCom.py +++ b/pyload/plugins/hoster/SimplyPremiumCom.py @@ -9,26 +9,28 @@ from pyload.plugins.hoster.UnrestrictLi import secondsToMidnight class SimplyPremiumCom(Hoster): - __name__ = "SimplyPremiumCom" - __type__ = "hoster" + __name__ = "SimplyPremiumCom" + __type__ = "hoster" __version__ = "0.03" __pattern__ = r'https?://.*(simply-premium)\.com' __description__ = """Simply-Premium.com hoster plugin""" - __authors__ = [("EvolutionClip", "evolutionclip@live.de")] + __license__ = "GPLv3" + __authors__ = [("EvolutionClip", "evolutionclip@live.de")] def setup(self): self.chunkLimit = 16 self.resumeDownload = False + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "Simply-Premium.com") - self.fail("No Simply-Premium.com account provided") + self.fail(_("No Simply-Premium.com account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) for i in xrange(5): @@ -37,7 +39,7 @@ class SimplyPremiumCom(Hoster): if page != '': break else: - self.logInfo("Unable to get API data, waiting 1 minute and retry") + self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) self.retry(5, 60, "Unable to get API data") if '<valid>0</valid>' in page or ( @@ -47,13 +49,13 @@ class SimplyPremiumCom(Hoster): elif "NOTFOUND" in page: self.offline() elif "downloadlimit" in page: - self.logWarning("Reached maximum connctions") + self.logWarning(_("Reached maximum connctions")) self.retry(5, 60, "Reached maximum connctions") elif "trafficlimit" in page: - self.logWarning("Reached daily limit for this host") - self.retry(1, secondsToMidnight(gmt=2), "Daily limit for this host reached") + self.logWarning(_("Reached daily limit for this host")) + self.retry(wait_time=secondsToMidnight(gmt=2), "Daily limit for this host reached") elif "hostererror" in page: - self.logWarning("Hoster temporarily unavailable, waiting 1 minute and retry") + self.logWarning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) self.retry(5, 60, "Hoster is temporarily unavailable") #page = json_loads(page) #new_url = page.keys()[0] diff --git a/pyload/plugins/hoster/SimplydebridCom.py b/pyload/plugins/hoster/SimplydebridCom.py index 7c6e6bfb3..f34f15ab2 100644 --- a/pyload/plugins/hoster/SimplydebridCom.py +++ b/pyload/plugins/hoster/SimplydebridCom.py @@ -6,24 +6,26 @@ from pyload.plugins.base.Hoster import Hoster class SimplydebridCom(Hoster): - __name__ = "SimplydebridCom" - __type__ = "hoster" + __name__ = "SimplydebridCom" + __type__ = "hoster" __version__ = "0.1" - __pattern__ = r'http://(?:www\.)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd.php/*' + __pattern__ = r'http://(?:www\.)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd\.php/*' __description__ = """Simply-debrid.com hoster plugin""" - __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] + __license__ = "GPLv3" + __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] def setup(self): self.resumeDownload = self.multiDL = True self.chunkLimit = 1 + def process(self, pyfile): if not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "simply-debrid.com") - self.fail("No simply-debrid.com account provided") + self.fail(_("No simply-debrid.com account provided")) self.logDebug("Old URL: %s" % pyfile.url) @@ -46,7 +48,7 @@ class SimplydebridCom(Hoster): if not re.match(self.__pattern__, new_url): page = self.load('http://simply-debrid.com/api.php', get={'dl': new_url}) # +'&u='+self.user+'&p='+self.account.getAccountData(self.user)['password']) if 'tiger Link' in page or 'Invalid Link' in page or ('API' in page and 'ERROR' in page): - self.fail('Unable to unrestrict link') + self.fail(_("Unable to unrestrict link")) new_url = page self.setWait(5) diff --git a/pyload/plugins/hoster/SockshareCom.py b/pyload/plugins/hoster/SockshareCom.py index 766c861a1..aabb8dcd1 100644 --- a/pyload/plugins/hoster/SockshareCom.py +++ b/pyload/plugins/hoster/SockshareCom.py @@ -1,90 +1,20 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -from os import rename -from pyload.plugins.hoster.UnrestrictLi import secondsToMidnight -from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo - - -class SockshareCom(SimpleHoster): - __name__ = "SockshareCom" - __type__ = "hoster" - __version__ = "0.04" +class SockshareCom(DeadHoster): + __name__ = "SockshareCom" + __type__ = "hoster" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?sockshare\.com/(mobile/)?(file|embed)/(?P<ID>\w+)' __description__ = """Sockshare.com hoster plugin""" - __authors__ = [("jeix", "jeix@hasnomail.de"), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] - - - FILE_INFO_PATTERN = r'site-content">\s*<h1>(?P<N>.+)<strong>\( (?P<S>[^)]+) \)</strong></h1>' - OFFLINE_PATTERN = r'>This file doesn\'t exist, or has been removed.<' - TEMP_OFFLINE_PATTERN = r'(>This content server has been temporarily disabled for upgrades|Try again soon\\. You can still download it below\\.<)' - - FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.sockshare.com/file/\g<ID>')] - - - def setup(self): - self.multiDL = self.resumeDownload = True - self.chunkLimit = -1 - - def handleFree(self): - name = self.pyfile.name - link = self._getLink() - self.logDebug("Direct link: " + link) - self.download(link, disposition=True) - self.processName(name) - - def _getLink(self): - hash_data = re.search(r'<input type="hidden" value="([a-z0-9]+)" name="hash">', self.html) - if not hash_data: - self.parseError("Unable to detect hash") - - post_data = {"hash": hash_data.group(1), "confirm": "Continue+as+Free+User"} - self.html = self.load(self.pyfile.url, post=post_data) - if ">You have exceeded the daily stream limit for your country\\. You can wait until tomorrow" in self.html: - self.logWarning("You have exceeded your daily stream limit for today") - self.wait(secondsToMidnight(gmt=2), True) - elif re.search(self.TEMP_OFFLINE_PATTERN, self.html): - self.retry(wait_time=2 * 60 * 60, reason="Server temporarily offline") # 2 hours wait - - patterns = (r'(/get_file\.php\?id=[A-Z0-9]+&key=[a-zA-Z0-9=]+&original=1)', - r'(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+)', - r'(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+&original=1)', - r'<a href="/gopro\.php">Tired of ads and waiting\? Go Pro!</a>[\t\n\rn ]+</div>[\t\n\rn ]+<a href="(/.*?)"') - for pattern in patterns: - link = re.search(pattern, self.html) - if link: - break - else: - link = re.search(r"playlist: '(/get_file\.php\?stream=[a-zA-Z0-9=]+)'", self.html) - if link: - self.html = self.load("http://www.sockshare.com" + link.group(1)) - link = re.search(r'media:content url="(http://.*?)"', self.html) - if link is None: - link = re.search(r'\"(http://media\\-b\\d+\\.sockshare\\.com/download/\\d+/.*?)\"', self.html) - else: - self.parseError('Unable to detect a download link') - - link = link.group(1).replace("&", "&") - if link.startswith("http://"): - return link - else: - return "http://www.sockshare.com" + link - - def processName(self, name_old): - name = self.pyfile.name - if name <= name_old: - return - name_new = re.sub(r'\.[^.]+$', "", name_old) + name[len(name_old):] - filename = self.lastDownload - self.pyfile.name = name_new - rename(filename, filename.rsplit(name)[0] + name_new) - self.logInfo("%(name)s renamed to %(newname)s" % {"name": name, "newname": name_new}) + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] getInfo = create_getInfo(SockshareCom) diff --git a/pyload/plugins/hoster/SoundcloudCom.py b/pyload/plugins/hoster/SoundcloudCom.py index d91ec03e5..601ac774c 100644 --- a/pyload/plugins/hoster/SoundcloudCom.py +++ b/pyload/plugins/hoster/SoundcloudCom.py @@ -7,26 +7,27 @@ from pyload.plugins.base.Hoster import Hoster class SoundcloudCom(Hoster): - __name__ = "SoundcloudCom" - __type__ = "hoster" + __name__ = "SoundcloudCom" + __type__ = "hoster" __version__ = "0.1" __pattern__ = r'https?://(?:www\.)?soundcloud\.com/(?P<UID>.*?)/(?P<SID>.*)' __description__ = """SoundCloud.com hoster plugin""" - __authors__ = [("Peekayy", "peekayy.dev@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Peekayy", "peekayy.dev@gmail.com")] def process(self, pyfile): # default UserAgent of HTTPRequest fails for this hoster so we use this one self.req.http.c.setopt(pycurl.USERAGENT, 'Mozilla/5.0') page = self.load(pyfile.url) - m = re.search(r'<div class="haudio.*?large.*?" data-sc-track="(?P<ID>[0-9]*)"', page) + m = re.search(r'<div class="haudio.*?large.*?" data-sc-track="(?P<ID>\d*)"', page) songId = clientId = "" if m: songId = m.group("ID") if len(songId) <= 0: - self.logError("Could not find song id") + self.logError(_("Could not find song id")) self.offline() else: m = re.search(r'"clientID":"(?P<CID>.*?)"', page) diff --git a/pyload/plugins/hoster/SpeedLoadOrg.py b/pyload/plugins/hoster/SpeedLoadOrg.py index cefde2afe..35bd84803 100644 --- a/pyload/plugins/hoster/SpeedLoadOrg.py +++ b/pyload/plugins/hoster/SpeedLoadOrg.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class SpeedLoadOrg(DeadHoster): - __name__ = "SpeedLoadOrg" - __type__ = "hoster" + __name__ = "SpeedLoadOrg" + __type__ = "hoster" __version__ = "1.02" __pattern__ = r'http://(?:www\.)?speedload\.org/(?P<ID>\w+)' __description__ = """Speedload.org hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] getInfo = create_getInfo(SpeedLoadOrg) diff --git a/pyload/plugins/hoster/SpeedfileCz.py b/pyload/plugins/hoster/SpeedfileCz.py index 5919f44f7..549a146d4 100644 --- a/pyload/plugins/hoster/SpeedfileCz.py +++ b/pyload/plugins/hoster/SpeedfileCz.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class SpeedfileCz(DeadHoster): - __name__ = "SpeedFileCz" - __type__ = "hoster" + __name__ = "SpeedFileCz" + __type__ = "hoster" __version__ = "0.32" - __pattern__ = r'http://(?:www\.)?speedfile.cz/.*' + __pattern__ = r'http://(?:www\.)?speedfile\.cz/.*' __description__ = """Speedfile.cz hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] getInfo = create_getInfo(SpeedfileCz) diff --git a/pyload/plugins/hoster/SpeedyshareCom.py b/pyload/plugins/hoster/SpeedyshareCom.py index edf935d59..5128e42e7 100644 --- a/pyload/plugins/hoster/SpeedyshareCom.py +++ b/pyload/plugins/hoster/SpeedyshareCom.py @@ -11,22 +11,23 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class SpeedyshareCom(SimpleHoster): - __name__ = "SpeedyshareCom" - __type__ = "hoster" - __version__ = "0.02" + __name__ = "SpeedyshareCom" + __type__ = "hoster" + __version__ = "0.03" - __pattern__ = r"https?://(?:www\.)?(speedyshare\.com|speedy\.sh)/\w+" + __pattern__ = r'https?://(?:www\.)?(speedyshare\.com|speedy\.sh)/\w+' __description__ = """Speedyshare.com hoster plugin""" - __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - FILE_NAME_PATTERN = r'class=downloadfilename>(?P<N>.*)</span></td>' - FILE_SIZE_PATTERN = r'class=sizetagtext>(?P<S>.*) (?P<U>[kKmM]?[iI]?[bB]?)</div>' + NAME_PATTERN = r'class=downloadfilename>(?P<N>.*)</span></td>' + SIZE_PATTERN = r'class=sizetagtext>(?P<S>.*) (?P<U>[kKmM]?[iI]?[bB]?)</div>' - FILE_OFFLINE_PATTERN = r'class=downloadfilenamenotfound>.*</span>' + OFFLINE_PATTERN = r'class=downloadfilenamenotfound>.*</span>' - LINK_PATTERN = r'<a href=\'(.*)\'><img src=/gf/slowdownload.png alt=\'Slow Download\' border=0' + LINK_PATTERN = r'<a href=\'(.*)\'><img src=/gf/slowdownload\.png alt=\'Slow Download\' border=0' def setup(self): @@ -37,14 +38,14 @@ class SpeedyshareCom(SimpleHoster): def handleFree(self): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError("Download link not found") + self.error(_("Download link not found")) dl_link = urljoin("http://www.speedyshare.com", m.group(1)) self.download(dl_link, disposition=True) check = self.checkDownload({'html': re.compile("html")}) if check == "html": - self.parseError("Downloaded file is an html file") + self.error(_("Downloaded file is an html page")) getInfo = create_getInfo(SpeedyshareCom) diff --git a/pyload/plugins/hoster/StreamCz.py b/pyload/plugins/hoster/StreamCz.py index 0a70e3c48..1c1b7f204 100644 --- a/pyload/plugins/hoster/StreamCz.py +++ b/pyload/plugins/hoster/StreamCz.py @@ -21,17 +21,18 @@ def getInfo(urls): class StreamCz(Hoster): - __name__ = "StreamCz" - __type__ = "hoster" + __name__ = "StreamCz" + __type__ = "hoster" __version__ = "0.2" __pattern__ = r'https?://(?:www\.)?stream\.cz/[^/]+/\d+.*' __description__ = """Stream.cz hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<link rel="video_src" href="http://www.stream.cz/\w+/(\d+)-([^"]+)" />' + NAME_PATTERN = r'<link rel="video_src" href="http://www\.stream\.cz/\w+/(\d+)-([^"]+)" />' OFFLINE_PATTERN = r'<h1 class="commonTitle">Str.nku nebylo mo.n. nal.zt \(404\)</h1>' CDN_PATTERN = r'<param name="flashvars" value="[^"]*&id=(?P<ID>\d+)(?:&cdnLQ=(?P<cdnLQ>\d*))?(?:&cdnHQ=(?P<cdnHQ>\d*))?(?:&cdnHD=(?P<cdnHD>\d*))?&' @@ -41,8 +42,8 @@ class StreamCz(Hoster): self.multiDL = True self.resumeDownload = True - def process(self, pyfile): + def process(self, pyfile): self.html = self.load(pyfile.url, decode=True) if re.search(self.OFFLINE_PATTERN, self.html): @@ -50,7 +51,7 @@ class StreamCz(Hoster): m = re.search(self.CDN_PATTERN, self.html) if m is None: - self.fail("Parse error (CDN)") + self.error(_("CDN_PATTERN not found")) cdn = m.groupdict() self.logDebug(cdn) for cdnkey in ("cdnHD", "cdnHQ", "cdnLQ"): @@ -58,13 +59,13 @@ class StreamCz(Hoster): cdnid = cdn[cdnkey] break else: - self.fail("Stream URL not found") + self.fail(_("Stream URL not found")) - m = re.search(self.FILE_NAME_PATTERN, self.html) + m = re.search(self.NAME_PATTERN, self.html) if m is None: - self.fail("Parse error (NAME)") + self.error(_("NAME_PATTERN not found")) pyfile.name = "%s-%s.%s.mp4" % (m.group(2), m.group(1), cdnkey[-2:]) download_url = "http://cdn-dispatcher.stream.cz/?id=" + cdnid - self.logInfo("STREAM (%s): %s" % (cdnkey[-2:], download_url)) + self.logInfo(_("STREAM: %s") % cdnkey[-2:], download_url) self.download(download_url) diff --git a/pyload/plugins/hoster/StreamcloudEu.py b/pyload/plugins/hoster/StreamcloudEu.py index 82ec94fbd..4f854a99d 100644 --- a/pyload/plugins/hoster/StreamcloudEu.py +++ b/pyload/plugins/hoster/StreamcloudEu.py @@ -2,26 +2,24 @@ import re -from time import sleep +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -from pyload.network.HTTPRequest import HTTPRequest -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo - -class StreamcloudEu(XFSPHoster): - __name__ = "StreamcloudEu" - __type__ = "hoster" - __version__ = "0.04" +class StreamcloudEu(XFSHoster): + __name__ = "StreamcloudEu" + __type__ = "hoster" + __version__ = "0.09" __pattern__ = r'http://(?:www\.)?streamcloud\.eu/\w{12}' __description__ = """Streamcloud.eu hoster plugin""" - __authors__ = [("seoester", "seoester@googlemail.com")] + __license__ = "GPLv3" + __authors__ = [("seoester", "seoester@googlemail.com")] - HOSTER_NAME = "streamcloud.eu" + HOSTER_DOMAIN = "streamcloud.eu" - LINK_PATTERN = r'file: "(http://(stor|cdn)\d+\.streamcloud.eu:?\d*/.*/video\.(mp4|flv))",' + LINK_PATTERN = r'file: "(http://(stor|cdn)\d+\.streamcloud\.eu:?\d*/.*/video\.(mp4|flv))",' def setup(self): @@ -30,98 +28,4 @@ class StreamcloudEu(XFSPHoster): self.resumeDownload = self.premium - def getDownloadLink(self): - m = re.search(self.LINK_PATTERN, self.html, re.S) - if m: - return m.group(1) - - for i in xrange(5): - self.logDebug("Getting download link: #%d" % i) - data = self.getPostParameters() - httpRequest = HTTPRequest(options=self.req.options) - httpRequest.cj = self.req.cj - sleep(10) - self.html = httpRequest.load(self.pyfile.url, post=data, referer=False, cookies=True, decode=True) - self.header = httpRequest.header - - m = re.search("Location\s*:\s*(.*)", self.header, re.I) - if m: - break - - m = re.search(self.LINK_PATTERN, self.html, re.S) - if m: - break - - else: - if self.errmsg and 'captcha' in self.errmsg: - self.fail("No valid captcha code entered") - else: - self.fail("Download link not found") - - return m.group(1) - - - def getPostParameters(self): - for i in xrange(3): - if not self.errmsg: - self.checkErrors() - - if hasattr(self, "FORM_PATTERN"): - action, inputs = self.parseHtmlForm(self.FORM_PATTERN) - else: - action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) - - if not inputs: - action, inputs = self.parseHtmlForm('F1') - if not inputs: - if self.errmsg: - self.retry() - else: - self.parseError("Form not found") - - self.logDebug(self.HOSTER_NAME, inputs) - - if 'op' in inputs and inputs['op'] in ("download1", "download2", "download3"): - if "password" in inputs: - if self.passwords: - inputs['password'] = self.passwords.pop(0) - else: - self.fail("No or invalid passport") - - if not self.premium: - m = re.search(self.WAIT_PATTERN, self.html) - if m: - wait_time = int(m.group(1)) + 1 - self.setWait(wait_time, False) - else: - wait_time = 0 - - self.captcha = self.handleCaptcha(inputs) - - if wait_time: - self.wait() - - self.errmsg = None - self.logDebug("getPostParameters {0}".format(i)) - return inputs - - else: - inputs['referer'] = self.pyfile.url - - if self.premium: - inputs['method_premium'] = "Premium Download" - if 'method_free' in inputs: - del inputs['method_free'] - else: - inputs['method_free'] = "Free Download" - if 'method_premium' in inputs: - del inputs['method_premium'] - - self.html = self.load(self.pyfile.url, post=inputs, ref=False) - self.errmsg = None - - else: - self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN')) - - getInfo = create_getInfo(StreamcloudEu) diff --git a/pyload/plugins/hoster/TurbobitNet.py b/pyload/plugins/hoster/TurbobitNet.py index 00d95366c..087052ebd 100644 --- a/pyload/plugins/hoster/TurbobitNet.py +++ b/pyload/plugins/hoster/TurbobitNet.py @@ -15,33 +15,34 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, t class TurbobitNet(SimpleHoster): - __name__ = "TurbobitNet" - __type__ = "hoster" - __version__ = "0.12" + __name__ = "TurbobitNet" + __type__ = "hoster" + __version__ = "0.14" __pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)' __description__ = """Turbobit.net hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("prOq", None)] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("prOq", None)] - FILE_NAME_PATTERN = r'id="file-title">(?P<N>.+?)<' - FILE_SIZE_PATTERN = r'class="file-size">(?P<S>[\d,.]+) (?P<U>\w+)' + NAME_PATTERN = r'id="file-title">(?P<N>.+?)<' + SIZE_PATTERN = r'class="file-size">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'<h2>File Not Found</h2>|html\(\'File (?:was )?not found' - FILE_URL_REPLACEMENTS = [(__pattern__, "http://turbobit.net/\g<ID>.html")] + URL_REPLACEMENTS = [(__pattern__, "http://turbobit.net/\g<ID>.html")] COOKIES = [(".turbobit.net", "user_lang", "en")] LINK_PATTERN = r'(?P<url>/download/redirect/[^"\']+)' - LIMIT_WAIT_PATTERN = r"<div id='timeout'>(\d+)<" + LIMIT_WAIT_PATTERN = r'<div id=\'timeout\'>(\d+)<' - CAPTCHA_URL_PATTERN = r'<img alt="Captcha" src="(.+?)"' + CAPTCHA_PATTERN = r'<img alt="Captcha" src="(.+?)"' def handleFree(self): - self.url = "http://turbobit.net/download/free/%s" % self.file_info['ID'] + self.url = "http://turbobit.net/download/free/%s" % self.info['ID'] self.html = self.load(self.url, ref=True, decode=True) rtUpdate = self.getRtUpdate() @@ -57,7 +58,7 @@ class TurbobitNet(SimpleHoster): def solveCaptcha(self): - for _ in xrange(5): + for _i in xrange(5): m = re.search(self.LIMIT_WAIT_PATTERN, self.html) if m: wait_time = int(m.group(1)) @@ -66,20 +67,16 @@ class TurbobitNet(SimpleHoster): action, inputs = self.parseHtmlForm("action='#'") if not inputs: - self.parseError("captcha form") + self.error(_("Captcha form not found")) self.logDebug(inputs) if inputs['captcha_type'] == 'recaptcha': recaptcha = ReCaptcha(self) - captcha_key = recaptcha.detect_key() - if captcha_key is None: - self.parseError("ReCaptcha captcha key not found") - - inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key) + inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge() else: - m = re.search(self.CAPTCHA_URL_PATTERN, self.html) + m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: - self.parseError('captcha') + self.error(_("captcha")) captcha_url = m.group(1) inputs['captcha_response'] = self.decryptCaptcha(captcha_url) @@ -87,13 +84,12 @@ class TurbobitNet(SimpleHoster): self.html = self.load(self.url, post=inputs) if '<div class="captcha-error">Incorrect, try again!<' in self.html: - self.logInfo("Invalid captcha") self.invalidCaptcha() else: self.correctCaptcha() break else: - self.fail("Invalid captcha") + self.fail(_("Invalid captcha")) def getRtUpdate(self): @@ -109,12 +105,11 @@ class TurbobitNet(SimpleHoster): r'zza=\2;for(var zzi=0;zzi<zza.length;zzi++){\1=zza[zzi];', rtUpdate) rtUpdate = re.sub(r"for\((\w+)=", r"for(var \1=", rtUpdate) - self.logDebug("rtUpdate") self.setStorage("rtUpdate", rtUpdate) self.setStorage("timestamp", timestamp()) self.setStorage("version", self.__version__) else: - self.logError("Unable to download, wait for update...") + self.logError(_("Unable to download, wait for update...")) self.tempOffline() return rtUpdate @@ -127,7 +122,7 @@ class TurbobitNet(SimpleHoster): if m: url = "http://turbobit.net%s%s" % m.groups() else: - url = "http://turbobit.net/files/timeout.js?ver=%s" % "".join(random.choice('0123456789ABCDEF') for _ in xrange(32)) + url = "http://turbobit.net/files/timeout.js?ver=%s" % "".join(random.choice('0123456789ABCDEF') for _i in xrange(32)) fun = self.load(url) @@ -135,7 +130,7 @@ class TurbobitNet(SimpleHoster): for b in [1, 3]: self.jscode = "var id = \'%s\';var b = %d;var inn = \'%s\';%sout" % ( - self.file_info['ID'], b, quote(fun), rtUpdate) + self.info['ID'], b, quote(fun), rtUpdate) try: out = self.js.eval(self.jscode) @@ -164,14 +159,13 @@ class TurbobitNet(SimpleHoster): def handlePremium(self): self.logDebug("Premium download as user %s" % self.user) - self.html = self.load(self.pyfile.url) # Useless in 0.5 self.downloadFile() def downloadFile(self): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError("Download link not found") + self.error(_("Download link not found")) self.url = "http://turbobit.net" + m.group('url') self.download(self.url) diff --git a/pyload/plugins/hoster/TurbouploadCom.py b/pyload/plugins/hoster/TurbouploadCom.py index ce16ebed8..80ad6ef1f 100644 --- a/pyload/plugins/hoster/TurbouploadCom.py +++ b/pyload/plugins/hoster/TurbouploadCom.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class TurbouploadCom(DeadHoster): - __name__ = "TurbouploadCom" - __type__ = "hoster" + __name__ = "TurbouploadCom" + __type__ = "hoster" __version__ = "0.03" - __pattern__ = r'http://(?:www\.)?turboupload.com/(\w+).*' + __pattern__ = r'http://(?:www\.)?turboupload\.com/(\w+).*' __description__ = """Turboupload.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] getInfo = create_getInfo(TurbouploadCom) diff --git a/pyload/plugins/hoster/TusfilesNet.py b/pyload/plugins/hoster/TusfilesNet.py index f10501250..8c80455b4 100644 --- a/pyload/plugins/hoster/TusfilesNet.py +++ b/pyload/plugins/hoster/TusfilesNet.py @@ -1,23 +1,24 @@ # -*- coding: utf-8 -*- -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class TusfilesNet(XFSPHoster): - __name__ = "TusfilesNet" - __type__ = "hoster" - __version__ = "0.04" +class TusfilesNet(XFSHoster): + __name__ = "TusfilesNet" + __type__ = "hoster" + __version__ = "0.07" __pattern__ = r'https?://(?:www\.)?tusfiles\.net/\w{12}' __description__ = """Tusfiles.net hoster plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com"), - ("guidobelix", "guidobelix@hotmail.it")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com"), + ("guidobelix", "guidobelix@hotmail.it")] - HOSTER_NAME = "tusfiles.net" + HOSTER_DOMAIN = "tusfiles.net" - FILE_INFO_PATTERN = r'\](?P<N>.+) - (?P<S>[\d.]+) (?P<U>\w+)\[' + INFO_PATTERN = r'\](?P<N>.+) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)\[' OFFLINE_PATTERN = r'>File Not Found|<Title>TusFiles - Fast Sharing Files!' diff --git a/pyload/plugins/hoster/TwoSharedCom.py b/pyload/plugins/hoster/TwoSharedCom.py index 86f02f0b6..24dd92895 100644 --- a/pyload/plugins/hoster/TwoSharedCom.py +++ b/pyload/plugins/hoster/TwoSharedCom.py @@ -6,33 +6,34 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class TwoSharedCom(SimpleHoster): - __name__ = "TwoSharedCom" - __type__ = "hoster" - __version__ = "0.11" + __name__ = "TwoSharedCom" + __type__ = "hoster" + __version__ = "0.12" - __pattern__ = r'http://(?:www\.)?2shared.com/(account/)?(download|get|file|document|photo|video|audio)/.*' + __pattern__ = r'http://(?:www\.)?2shared\.com/(account/)?(download|get|file|document|photo|video|audio)/.*' __description__ = """2Shared.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<h1>(?P<N>.*)</h1>' - FILE_SIZE_PATTERN = r'<span class="dtitle">File size:</span>\s*(?P<S>[0-9,.]+) (?P<U>[kKMG])i?B' + NAME_PATTERN = r'<h1>(?P<N>.*)</h1>' + SIZE_PATTERN = r'<span class="dtitle">File size:</span>\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'The file link that you requested is not valid\.|This file was deleted\.' - LINK_PATTERN = r"window.location ='([^']+)';" + LINK_PATTERN = r'window.location =\'(.+?)\';' def setup(self): self.resumeDownload = self.multiDL = True + def handleFree(self): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError('Download link') - link = m.group(1) - self.logDebug("Download URL %s" % link) + self.error(_("Download link")) + link = m.group(1) self.download(link) diff --git a/pyload/plugins/hoster/UlozTo.py b/pyload/plugins/hoster/UlozTo.py index 3fecbd672..84d5287ac 100644 --- a/pyload/plugins/hoster/UlozTo.py +++ b/pyload/plugins/hoster/UlozTo.py @@ -13,23 +13,24 @@ def convertDecimalPrefix(m): class UlozTo(SimpleHoster): - __name__ = "UlozTo" - __type__ = "hoster" - __version__ = "0.98" + __name__ = "UlozTo" + __type__ = "hoster" + __version__ = "0.99" - __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj.cz|zachowajto.pl)/(?:live/)?(?P<id>\w+/[^/?]*)' + __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<id>\w+/[^/?]*)' __description__ = """Uloz.to hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_INFO_PATTERN = r'<p>File <strong>(?P<N>[^<]+)</strong> is password protected</p>' - FILE_NAME_PATTERN = r'<title>(?P<N>[^<]+) \| Uloz.to</title>' - FILE_SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[0-9.]+\s[kMG]?B)</span>' + INFO_PATTERN = r'<p>File <strong>(?P<N>[^<]+)</strong> is password protected</p>' + NAME_PATTERN = r'<title>(?P<N>[^<]+) \| Uloz\.to</title>' + SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[\d.,]+\s[kMG]?B)</span>' OFFLINE_PATTERN = r'<title>404 - Page not found</title>|<h1 class="h1">File (has been deleted|was banned)</h1>' - FILE_SIZE_REPLACEMENTS = [('([0-9.]+)\s([kMG])B', convertDecimalPrefix)] - FILE_URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "www.ulozto.net")] + SIZE_REPLACEMENTS = [('([\d.]+)\s([kMG])B', convertDecimalPrefix)] + URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "www.ulozto.net")] ADULT_PATTERN = r'<form action="(?P<link>[^\"]*)" method="post" id="frm-askAgeForm">' PASSWD_PATTERN = r'<div class="passwordProtectedFile">' @@ -43,16 +44,17 @@ class UlozTo(SimpleHoster): self.multiDL = self.premium self.resumeDownload = True + def process(self, pyfile): pyfile.url = re.sub(r"(?<=http://)([^/]+)", "www.ulozto.net", pyfile.url) self.html = self.load(pyfile.url, decode=True, cookies=True) if re.search(self.ADULT_PATTERN, self.html): - self.logInfo("Adult content confirmation needed. Proceeding..") + self.logInfo(_("Adult content confirmation needed")) m = re.search(self.TOKEN_PATTERN, self.html) if m is None: - self.parseError('TOKEN') + self.error(_("TOKEN_PATTERN not found")) token = m.group(1) self.html = self.load(pyfile.url, get={"do": "askAgeForm-submit"}, @@ -62,16 +64,16 @@ class UlozTo(SimpleHoster): while self.PASSWD_PATTERN in self.html: if passwords: password = passwords.pop(0) - self.logInfo("Password protected link, trying " + password) + self.logInfo(_("Password protected link, trying ") + password) self.html = self.load(pyfile.url, get={"do": "passwordProtectedForm-submit"}, post={"password": password, "password_send": 'Send'}, cookies=True) else: - self.fail("No or incorrect password") + self.fail(_("No or incorrect password")) if re.search(self.VIPLINK_PATTERN, self.html): self.html = self.load(pyfile.url, get={"disclaimer": "1"}) - self.file_info = self.getFileInfo() + self.getFileInfo() if self.premium and self.checkTrafficLeft(): self.handlePremium() @@ -80,10 +82,11 @@ class UlozTo(SimpleHoster): self.doCheckDownload() + def handleFree(self): action, inputs = self.parseHtmlForm('id="frm-downloadDialog-freeDownloadForm"') if not action or not inputs: - self.parseError("free download form") + self.error(_("Free download form not found")) self.logDebug("inputs.keys = " + str(inputs.keys())) # get and decrypt captcha @@ -109,25 +112,28 @@ class UlozTo(SimpleHoster): inputs.update({'timestamp': data['timestamp'], 'salt': data['salt'], 'hash': data['hash'], 'captcha_value': captcha_value}) else: - self.parseError("CAPTCHA form changed") + self.error(_("CAPTCHA form changed")) self.multiDL = True self.download("http://www.ulozto.net" + action, post=inputs, cookies=True, disposition=True) + def handlePremium(self): self.download(self.pyfile.url + "?do=directDownload", disposition=True) #parsed_url = self.findDownloadURL(premium=True) #self.download(parsed_url, post={"download": "Download"}) + def findDownloadURL(self, premium=False): - msg = "%s link" % ("Premium" if premium else "Free") + msg = _("%s link" % ("Premium" if premium else "Free")) m = re.search(self.PREMIUM_URL_PATTERN if premium else self.FREE_URL_PATTERN, self.html) if m is None: - self.parseError(msg) + self.error(msg) parsed_url = "http://www.ulozto.net" + m.group(1) self.logDebug("%s: %s" % (msg, parsed_url)) return parsed_url + def doCheckDownload(self): check = self.checkDownload({ "wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'), @@ -141,18 +147,18 @@ class UlozTo(SimpleHoster): #self.delStorage("captcha_id") #self.delStorage("captcha_text") self.invalidCaptcha() - self.retry(reason="Wrong captcha code") + self.retry(reason=_("Wrong captcha code")) elif check == "offline": self.offline() elif check == "passwd": - self.fail("Wrong password") + self.fail(_("Wrong password")) elif check == "server_error": - self.logError("Server error, try downloading later") + self.logError(_("Server error, try downloading later")) self.multiDL = False self.wait(1 * 60 * 60, True) self.retry() elif check == "not_found": - self.fail("Server error - file not downloadable") + self.fail(_("Server error - file not downloadable")) getInfo = create_getInfo(UlozTo) diff --git a/pyload/plugins/hoster/UloziskoSk.py b/pyload/plugins/hoster/UloziskoSk.py index e68e2686e..e34f74a3f 100644 --- a/pyload/plugins/hoster/UloziskoSk.py +++ b/pyload/plugins/hoster/UloziskoSk.py @@ -6,23 +6,24 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UloziskoSk(SimpleHoster): - __name__ = "UloziskoSk" - __type__ = "hoster" - __version__ = "0.23" + __name__ = "UloziskoSk" + __type__ = "hoster" + __version__ = "0.24" - __pattern__ = r'http://(?:www\.)?ulozisko.sk/.*' + __pattern__ = r'http://(?:www\.)?ulozisko\.sk/.*' __description__ = """Ulozisko.sk hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<div class="down1">(?P<N>[^<]+)</div>' - FILE_SIZE_PATTERN = ur'VeÄŸkosÅ¥ súboru: <strong>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</strong><br />' + NAME_PATTERN = r'<div class="down1">(?P<N>[^<]+)</div>' + SIZE_PATTERN = ur'VeÄŸkosÅ¥ súboru: <strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong><br />' OFFLINE_PATTERN = ur'<span class = "red">ZadanÃœ súbor neexistuje z jedného z nasledujúcich dÃŽvodov:</span>' LINK_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">' ID_PATTERN = r'<input type = "hidden" name = "id" value = "([^"]+)" />' - CAPTCHA_PATTERN = r'<img src="(/obrazky/obrazky.php\?fid=[^"]+)" alt="" />' + CAPTCHA_PATTERN = r'<img src="(/obrazky/obrazky\.php\?fid=[^"]+)" alt="" />' IMG_PATTERN = ur'<strong>PRE ZVÃÄÅ ENIE KLIKNITE NA OBRÃZOK</strong><br /><a href = "([^"]+)">' @@ -37,22 +38,23 @@ class UloziskoSk(SimpleHoster): else: self.handleFree() + def handleFree(self): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError('URL') + self.error(_("LINK_PATTERN not found")) parsed_url = 'http://www.ulozisko.sk' + m.group(1) m = re.search(self.ID_PATTERN, self.html) if m is None: - self.parseError('ID') + self.error(_("ID_PATTERN not found")) id = m.group(1) self.logDebug("URL:" + parsed_url + ' ID:' + id) m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: - self.parseError('CAPTCHA') + self.error(_("CAPTCHA_PATTERN not found")) captcha_url = 'http://www.ulozisko.sk' + m.group(1) captcha = self.decryptCaptcha(captcha_url, cookies=True) diff --git a/pyload/plugins/hoster/UnibytesCom.py b/pyload/plugins/hoster/UnibytesCom.py index 326310104..6ed3805b1 100644 --- a/pyload/plugins/hoster/UnibytesCom.py +++ b/pyload/plugins/hoster/UnibytesCom.py @@ -2,37 +2,41 @@ import re +from urlparse import urljoin + from pycurl import FOLLOWLOCATION from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UnibytesCom(SimpleHoster): - __name__ = "UnibytesCom" - __type__ = "hoster" - __version__ = "0.1" + __name__ = "UnibytesCom" + __type__ = "hoster" + __version__ = "0.11" - __pattern__ = r'http://(?:www\.)?unibytes\.com/[a-zA-Z0-9-._ ]{11}B' + __pattern__ = r'https?://(?:www\.)?unibytes\.com/[\w .-]{11}B' __description__ = """UniBytes.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + HOSTER_DOMAIN = "unibytes.com" - FILE_INFO_PATTERN = r'<span[^>]*?id="fileName"[^>]*>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)' + INFO_PATTERN = r'<span[^>]*?id="fileName"[^>]*>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)' - HOSTER_NAME = "unibytes.com" WAIT_PATTERN = r'Wait for <span id="slowRest">(\d+)</span> sec' LINK_PATTERN = r'<a href="([^"]+)">Download</a>' def handleFree(self): - domain = "http://www." + self.HOSTER_NAME + domain = "http://www.%s/" % self.HOSTER_DOMAIN action, post_data = self.parseHtmlForm('id="startForm"') self.req.http.c.setopt(FOLLOWLOCATION, 0) - for _ in xrange(8): + for _i in xrange(8): self.logDebug(action, post_data) - self.html = self.load(domain + action, post=post_data) + self.html = self.load(urljoin(domain, action), post=post_data) m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) if m: @@ -59,11 +63,10 @@ class UnibytesCom(SimpleHoster): m = re.search(self.WAIT_PATTERN, self.html) self.wait(int(m.group(1)) if m else 60, False) elif last_step in ("captcha", "last"): - post_data['captcha'] = self.decryptCaptcha(domain + '/captcha.jpg') + post_data['captcha'] = self.decryptCaptcha(urljoin(domain, "/captcha.jpg")) else: - self.fail("No valid captcha code entered") + self.fail(_("No valid captcha code entered")) - self.logDebug("Download link: " + url) self.req.http.c.setopt(FOLLOWLOCATION, 1) self.download(url) diff --git a/pyload/plugins/hoster/UnrestrictLi.py b/pyload/plugins/hoster/UnrestrictLi.py index 18d363788..e807cda98 100644 --- a/pyload/plugins/hoster/UnrestrictLi.py +++ b/pyload/plugins/hoster/UnrestrictLi.py @@ -19,36 +19,38 @@ def secondsToMidnight(gmt=0): class UnrestrictLi(Hoster): - __name__ = "UnrestrictLi" - __type__ = "hoster" + __name__ = "UnrestrictLi" + __type__ = "hoster" __version__ = "0.12" __pattern__ = r'https?://(?:[^/]*\.)?(unrestrict|unr)\.li' __description__ = """Unrestrict.li hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def setup(self): self.chunkLimit = 16 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "Unrestrict.li") - self.fail("No Unrestrict.li account provided") + self.fail(_("No Unrestrict.li account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) - for _ in xrange(5): - page = self.req.load('https://unrestrict.li/unrestrict.php', - post={'link': pyfile.url, 'domain': 'long'}) + for _i in xrange(5): + page = self.load('https://unrestrict.li/unrestrict.php', + post={'link': pyfile.url, 'domain': 'long'}) self.logDebug("JSON data: " + page) if page != '': break else: - self.logInfo("Unable to get API data, waiting 1 minute and retry") + self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) self.retry(5, 60, "Unable to get API data") if 'Expired session' in page or ("You are not allowed to " @@ -58,12 +60,12 @@ class UnrestrictLi(Hoster): elif "File offline" in page: self.offline() elif "You are not allowed to download from this host" in page: - self.fail("You are not allowed to download from this host") + self.fail(_("You are not allowed to download from this host")) elif "You have reached your daily limit for this host" in page: - self.logWarning("Reached daily limit for this host") + self.logWarning(_("Reached daily limit for this host")) self.retry(5, secondsToMidnight(gmt=2), "Daily limit for this host reached") elif "ERROR_HOSTER_TEMPORARILY_UNAVAILABLE" in page: - self.logInfo("Hoster temporarily unavailable, waiting 1 minute and retry") + self.logInfo(_("Hoster temporarily unavailable, waiting 1 minute and retry")) self.retry(5, 60, "Hoster is temporarily unavailable") page = json_loads(page) new_url = page.keys()[0] @@ -79,7 +81,8 @@ class UnrestrictLi(Hoster): if self.getConfig("history"): self.load("https://unrestrict.li/history/&delete=all") - self.logInfo("Download history deleted") + self.logInfo(_("Download history deleted")) + def setNameSize(self): if 'name' in self.api_data: diff --git a/pyload/plugins/hoster/UploadStationCom.py b/pyload/plugins/hoster/UploadStationCom.py index eaeba3937..ad6779364 100644 --- a/pyload/plugins/hoster/UploadStationCom.py +++ b/pyload/plugins/hoster/UploadStationCom.py @@ -4,15 +4,16 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class UploadStationCom(DeadHoster): - __name__ = "UploadStationCom" - __type__ = "hoster" + __name__ = "UploadStationCom" + __type__ = "hoster" __version__ = "0.52" - __pattern__ = r'http://(?:www\.)?uploadstation\.com/file/(?P<id>[A-Za-z0-9]+)' + __pattern__ = r'http://(?:www\.)?uploadstation\.com/file/(?P<id>\w+)' __description__ = """UploadStation.com hoster plugin""" - __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es"), + ("zoidberg", "zoidberg@mujmail.cz")] getInfo = create_getInfo(UploadStationCom) diff --git a/pyload/plugins/hoster/UploadedTo.py b/pyload/plugins/hoster/UploadedTo.py index f02b9951d..17e3a4a0f 100644 --- a/pyload/plugins/hoster/UploadedTo.py +++ b/pyload/plugins/hoster/UploadedTo.py @@ -34,7 +34,7 @@ def getAPIData(urls): post['id_%s' % i] = id idMap[id] = url - for _ in xrange(5): + for _i in xrange(5): api = unicode(getURL("http://uploaded.net/api/filemultiple", post=post, decode=False), 'iso-8859-1') if api != "can't find request": break @@ -64,7 +64,7 @@ def parseFileInfo(self, url='', html=''): # File offline status = 1 else: - m = re.search(self.FILE_INFO_PATTERN, html) + m = re.search(self.INFO_PATTERN, html) if m: name, fileid = html_unescape(m.group('N')), m.group('ID') size = parseFileSize(m.group('S')) @@ -92,21 +92,22 @@ def getInfo(urls): class UploadedTo(Hoster): - __name__ = "UploadedTo" - __type__ = "hoster" - __version__ = "0.73" + __name__ = "UploadedTo" + __type__ = "hoster" + __version__ = "0.75" __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' __description__ = """Uploaded.net hoster plugin""" - __authors__ = [("spoob", "spoob@pyload.org"), - ("mkaay", "mkaay@mkaay.de"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("netpok", "netpok@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org"), + ("mkaay", "mkaay@mkaay.de"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("netpok", "netpok@gmail.com"), + ("stickell", "l.stickell@yahoo.it")] - FILE_INFO_PATTERN = r'<a href="file/(?P<ID>\w+)" id="filename">(?P<N>[^<]+)</a> \s*<small[^>]*>(?P<S>[^<]+)</small>' + INFO_PATTERN = r'<a href="file/(?P<ID>\w+)" id="filename">(?P<N>[^<]+)</a> \s*<small[^>]*>(?P<S>[^<]+)</small>' OFFLINE_PATTERN = r'<small class="cL">Error: 404</small>' DL_LIMIT_PATTERN = r'You have reached the max. number of possible free downloads for this hour' @@ -118,6 +119,7 @@ class UploadedTo(Hoster): self.fileID = getID(self.pyfile.url) self.pyfile.url = "http://uploaded.net/file/%s" % self.fileID + def process(self, pyfile): self.load("http://uploaded.net/language/en", just_header=True) @@ -126,7 +128,7 @@ class UploadedTo(Hoster): # TODO: fallback to parse from site, because api sometimes delivers wrong status codes if not api: - self.logWarning("No response for API call") + self.logWarning(_("No response for API call")) self.html = unicode(self.load(pyfile.url, decode=False), 'iso-8859-1') name, size, status, self.fileID = parseFileInfo(self) @@ -136,7 +138,8 @@ class UploadedTo(Hoster): elif status == 2: pyfile.name, pyfile.size = name, size else: - self.fail('Parse error - file info') + self.error(_("file info")) + elif api == 'Access denied': self.fail(_("API key invalid")) @@ -157,53 +160,53 @@ class UploadedTo(Hoster): else: self.handleFree() + def handlePremium(self): info = self.account.getAccountInfo(self.user, True) self.logDebug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name": self.__name__, "left": info['trafficleft'] / 1024 / 1024}) if int(self.data[1]) / 1024 > info['trafficleft']: - self.logInfo(_("%s: Not enough traffic left" % self.__name__)) + self.logInfo(_("Not enough traffic left")) self.account.empty(self.user) self.resetAccount() self.fail(_("Traffic exceeded")) header = self.load("http://uploaded.net/file/%s" % self.fileID, just_header=True) - if "location" in header: + if 'location' in header: #Direct download - print "Direct Download: " + header['location'] + self.logDebug("Direct download link detected") self.download(header['location']) else: #Indirect download self.html = self.load("http://uploaded.net/file/%s" % self.fileID) m = re.search(r'<div class="tfree".*\s*<form method="post" action="(.*?)"', self.html) if m is None: - self.fail("Download URL not m. Try to enable direct downloads.") + self.fail(_("Download URL not m. Try to enable direct downloads")) url = m.group(1) - print "Premium URL: " + url self.download(url, post={}) + def handleFree(self): self.html = self.load(self.pyfile.url, decode=True) if 'var free_enabled = false;' in self.html: - self.logError("Free-download capacities exhausted.") - self.retry(max_tries=24, wait_time=5 * 60) + self.logError(_("Free-download capacities exhausted")) + self.retry(24, 5 * 60) m = re.search(r"Current waiting period: <span>(\d+)</span> seconds", self.html) if m is None: - self.fail("File not downloadable for free users") + self.fail(_("File not downloadable for free users")) self.setWait(int(m.group(1))) - js = self.load("http://uploaded.net/js/download.js", decode=True) - - challengeId = re.search(r'Recaptcha\.create\("([^"]+)', js) + self.html = self.load("http://uploaded.net/js/download.js", decode=True) url = "http://uploaded.net/io/ticket/captcha/%s" % self.fileID downloadURL = "" - for _ in xrange(5): - re_captcha = ReCaptcha(self) - challenge, result = re_captcha.challenge(challengeId.group(1)) + recaptcha = ReCaptcha(self) + + for _i in xrange(5): + challenge, result = recaptcha.challenge() options = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": result} self.wait() @@ -211,29 +214,28 @@ class UploadedTo(Hoster): self.logDebug("Result: %s" % result) if "limit-size" in result: - self.fail("File too big for free download") + self.fail(_("File too big for free download")) elif "limit-slot" in result: # Temporary restriction so just wait a bit self.setWait(30 * 60, True) self.wait() self.retry() elif "limit-parallel" in result: - self.fail("Cannot download in parallel") - elif self.DL_LIMIT_PATTERN in result: # limit-dl + self.fail(_("Cannot download in parallel")) + elif "limit-dl" in result or self.DL_LIMIT_PATTERN in result: # limit-dl self.setWait(3 * 60 * 60, True) self.wait() self.retry() elif '"err":"captcha"' in result: - self.logError("captcha is disabled") self.invalidCaptcha() elif "type:'download'" in result: self.correctCaptcha() downloadURL = re.search("url:'([^']+)", result).group(1) break else: - self.fail("Unknown error '%s'" % result) + self.error(_("Unknown error: %s") % result) if not downloadURL: - self.fail("No Download url retrieved/all captcha attempts failed") + self.fail(_("No Download url retrieved/all captcha attempts failed")) self.download(downloadURL, disposition=True) check = self.checkDownload({"limit-dl": self.DL_LIMIT_PATTERN}) diff --git a/pyload/plugins/hoster/UploadheroCom.py b/pyload/plugins/hoster/UploadheroCom.py index 1220fd919..2aab44c9f 100644 --- a/pyload/plugins/hoster/UploadheroCom.py +++ b/pyload/plugins/hoster/UploadheroCom.py @@ -9,28 +9,29 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadheroCom(SimpleHoster): - __name__ = "UploadheroCom" - __type__ = "hoster" - __version__ = "0.15" + __name__ = "UploadheroCom" + __type__ = "hoster" + __version__ = "0.16" __pattern__ = r'http://(?:www\.)?uploadhero\.com?/dl/\w+' __description__ = """UploadHero.co plugin""" - __authors__ = [("mcmyst", "mcmyst@hotmail.fr"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("mcmyst", "mcmyst@hotmail.fr"), + ("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'<div class="nom_de_fichier">(?P<N>.*?)</div>' - FILE_SIZE_PATTERN = r'Taille du fichier : </span><strong>(?P<S>.*?)</strong>' + NAME_PATTERN = r'<div class="nom_de_fichier">(?P<N>.*?)</div>' + SIZE_PATTERN = r'Taille du fichier : </span><strong>(?P<S>.*?)</strong>' OFFLINE_PATTERN = r'<p class="titre_dl_2">|<div class="raison"><strong>Le lien du fichier ci-dessus n\'existe plus.' COOKIES = [(".uploadhero.co", "lang", "en")] - IP_BLOCKED_PATTERN = r'href="(/lightbox_block_download.php\?min=.*?)"' + IP_BLOCKED_PATTERN = r'href="(/lightbox_block_download\.php\?min=.*?)"' IP_WAIT_PATTERN = r'<span id="minutes">(\d+)</span>.*\s*<span id="seconds">(\d+)</span>' - CAPTCHA_PATTERN = r'"(/captchadl\.php\?[a-z0-9]+)"' - FREE_URL_PATTERN = r'var magicomfg = \'<a href="(http://[^<>"]*?)"|"(http://storage\d+\.uploadhero\.co/\?d=[A-Za-z0-9]+/[^<>"/]+)"' + CAPTCHA_PATTERN = r'"(/captchadl\.php\?\w+)"' + FREE_URL_PATTERN = r'var magicomfg = \'<a href="(http://[^<>"]*?)"|"(http://storage\d+\.uploadhero\.co/\?d=\w+/[^<>"/]+)"' PREMIUM_URL_PATTERN = r'<a href="([^"]+)" id="downloadnow"' @@ -39,10 +40,10 @@ class UploadheroCom(SimpleHoster): m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: - self.parseError("Captcha URL") + self.error(_("CAPTCHA_PATTERN not found")) captcha_url = "http://uploadhero.co" + m.group(1) - for _ in xrange(5): + for _i in xrange(5): captcha = self.decryptCaptcha(captcha_url) self.html = self.load(self.pyfile.url, get={"code": captcha}) m = re.search(self.FREE_URL_PATTERN, self.html) @@ -53,17 +54,17 @@ class UploadheroCom(SimpleHoster): else: self.invalidCaptcha() else: - self.fail("No valid captcha code entered") + self.fail(_("No valid captcha code entered")) self.download(download_url) + def handlePremium(self): self.logDebug("%s: Use Premium Account" % self.__name__) - self.html = self.load(self.pyfile.url) link = re.search(self.PREMIUM_URL_PATTERN, self.html).group(1) - self.logDebug("Downloading link : '%s'" % link) self.download(link) + def checkErrors(self): m = re.search(self.IP_BLOCKED_PATTERN, self.html) if m: diff --git a/pyload/plugins/hoster/UploadingCom.py b/pyload/plugins/hoster/UploadingCom.py index 9938d4829..ffb275d94 100644 --- a/pyload/plugins/hoster/UploadingCom.py +++ b/pyload/plugins/hoster/UploadingCom.py @@ -9,20 +9,21 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, t class UploadingCom(SimpleHoster): - __name__ = "UploadingCom" - __type__ = "hoster" - __version__ = "0.36" + __name__ = "UploadingCom" + __type__ = "hoster" + __version__ = "0.38" - __pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>[\w\d]+)' + __pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>\w+)' __description__ = """Uploading.com hoster plugin""" - __authors__ = [("jeix", "jeix@hasnomail.de"), - ("mkaay", "mkaay@mkaay.de"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de"), + ("mkaay", "mkaay@mkaay.de"), + ("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'id="file_title">(?P<N>.+)</' - FILE_SIZE_PATTERN = r'size tip_container">(?P<S>[\d.]+) (?P<U>\w+)<' + NAME_PATTERN = r'id="file_title">(?P<N>.+)</' + SIZE_PATTERN = r'size tip_container">(?P<S>[\d.,]+) (?P<U>[\w^_]+)<' OFFLINE_PATTERN = r'(Page|file) not found' COOKIES = [(".uploading.com", "lang", "1"), @@ -36,7 +37,7 @@ class UploadingCom(SimpleHoster): pyfile.url = pyfile.url.replace("/files", "/files/get") self.html = self.load(pyfile.url, decode=True) - self.file_info = self.getFileInfo() + self.getFileInfo() if self.premium: self.handlePremium() @@ -46,7 +47,7 @@ class UploadingCom(SimpleHoster): def handlePremium(self): postData = {'action': 'get_link', - 'code': self.file_info['ID'], + 'code': self.info['ID'], 'pass': 'undefined'} self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData) @@ -55,7 +56,7 @@ class UploadingCom(SimpleHoster): url = url.group(1).replace("\\/", "/") self.download(url) - raise Exception("Plugin defect.") + raise Exception("Plugin defect") def handleFree(self): @@ -63,39 +64,40 @@ class UploadingCom(SimpleHoster): if m: self.pyfile.error = m.group(1) self.logWarning(self.pyfile.error) - self.retry(max_tries=6, wait_time=6 * 60 * 60 if m.group(2) else 15 * 60, reason=self.pyfile.error) + self.retry(6, (6 * 60 if m.group(2) else 15) * 60, self.pyfile.error) ajax_url = "http://uploading.com/files/get/?ajax" self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) self.req.http.lastURL = self.pyfile.url - response = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.file_info['ID']})) - if 'answer' in response and 'wait_time' in response['answer']: - wait_time = int(response['answer']['wait_time']) - self.logInfo("%s: Waiting %d seconds." % (self.__name__, wait_time)) + res = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['ID']})) + + if 'answer' in res and 'wait_time' in res['answer']: + wait_time = int(res['answer']['wait_time']) + self.logInfo(_("Waiting %d seconds") % wait_time) self.wait(wait_time) else: - self.parseError("AJAX/WAIT") + self.error(_("No AJAX/WAIT")) + + res = json_loads(self.load(ajax_url, post={'action': 'get_link', 'code': self.info['ID'], 'pass': 'false'})) - response = json_loads( - self.load(ajax_url, post={'action': 'get_link', 'code': self.file_info['ID'], 'pass': 'false'})) - if 'answer' in response and 'link' in response['answer']: - url = response['answer']['link'] + if 'answer' in res and 'link' in res['answer']: + url = res['answer']['link'] else: - self.parseError("AJAX/URL") + self.error(_("No AJAX/URL")) self.html = self.load(url) m = re.search(r'<form id="file_form" action="(.*?)"', self.html) if m: url = m.group(1) else: - self.parseError("URL") + self.error(_("No URL")) self.download(url) check = self.checkDownload({"html": re.compile("\A<!DOCTYPE html PUBLIC")}) if check == "html": - self.logWarning("Redirected to a HTML page, wait 10 minutes and retry") + self.logWarning(_("Redirected to a HTML page, wait 10 minutes and retry")) self.wait(10 * 60, True) diff --git a/pyload/plugins/hoster/UpstoreNet.py b/pyload/plugins/hoster/UpstoreNet.py index 2f05d6ffa..255526aa2 100644 --- a/pyload/plugins/hoster/UpstoreNet.py +++ b/pyload/plugins/hoster/UpstoreNet.py @@ -7,17 +7,18 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UpstoreNet(SimpleHoster): - __name__ = "UpstoreNet" - __type__ = "hoster" - __version__ = "0.02" + __name__ = "UpstoreNet" + __type__ = "hoster" + __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?upstore\.net/' __description__ = """Upstore.Net File Download Hoster""" - __authors__ = [("igel", "igelkun@myopera.com")] + __license__ = "GPLv3" + __authors__ = [("igel", "igelkun@myopera.com")] - FILE_INFO_PATTERN = r'<div class="comment">.*?</div>\s*\n<h2 style="margin:0">(?P<N>.*?)</h2>\s*\n<div class="comment">\s*\n\s*(?P<S>[\d.]+) (?P<U>\w+)' + INFO_PATTERN = r'<div class="comment">.*?</div>\s*\n<h2 style="margin:0">(?P<N>.*?)</h2>\s*\n<div class="comment">\s*\n\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'<span class="error">File not found</span>' WAIT_PATTERN = r'var sec = (\d+)' @@ -29,7 +30,7 @@ class UpstoreNet(SimpleHoster): # STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: - self.parseError("could not detect hash") + self.error(_("CHASH_PATTERN not found")) chash = m.group(1) self.logDebug("Read hash " + chash) # continue to stage2 @@ -39,14 +40,12 @@ class UpstoreNet(SimpleHoster): # STAGE 2: solv captcha and wait # first get the infos we need: recaptcha key and wait time recaptcha = ReCaptcha(self) - if recaptcha.detect_key() is None: - self.parseError("ReCaptcha key not found") - self.logDebug("Using captcha key " + recaptcha.key) + # try the captcha 5 times for i in xrange(5): m = re.search(self.WAIT_PATTERN, self.html) if m is None: - self.parseError("could not find wait pattern") + self.error(_("Wait pattern not found")) wait_time = m.group(1) # then, do the waiting @@ -60,15 +59,14 @@ class UpstoreNet(SimpleHoster): self.html = self.load(self.pyfile.url, post=post_data, decode=True) # STAGE 3: get direct link - m = re.search(self.LINK_PATTERN, self.html, re.DOTALL) + m = re.search(self.LINK_PATTERN, self.html, re.S) if m: break if m is None: - self.parseError("could not detect direct link") + self.error(_("Download link not found")) direct = m.group(1) - self.logDebug("Found direct link: " + direct) self.download(direct, disposition=True) diff --git a/pyload/plugins/hoster/UptoboxCom.py b/pyload/plugins/hoster/UptoboxCom.py index 2d6148905..eeddb96b6 100644 --- a/pyload/plugins/hoster/UptoboxCom.py +++ b/pyload/plugins/hoster/UptoboxCom.py @@ -1,27 +1,25 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo - -class UptoboxCom(XFSPHoster): - __name__ = "UptoboxCom" - __type__ = "hoster" - __version__ = "0.10" +class UptoboxCom(XFSHoster): + __name__ = "UptoboxCom" + __type__ = "hoster" + __version__ = "0.15" __pattern__ = r'https?://(?:www\.)?uptobox\.com/\w{12}' __description__ = """Uptobox.com hoster plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_NAME = "uptobox.com" + HOSTER_DOMAIN = "uptobox.com" - FILE_INFO_PATTERN = r'"para_title">(?P<N>.+) \((?P<S>[\d.]+) (?P<U>\w+)\)' + INFO_PATTERN = r'"para_title">(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)' OFFLINE_PATTERN = r'>(File not found|Access Denied|404 Not Found)' - WAIT_PATTERN = r'>(\d+)</span> seconds<' LINK_PATTERN = r'"(https?://\w+\.uptobox\.com/d/.*?)"' diff --git a/pyload/plugins/hoster/VeehdCom.py b/pyload/plugins/hoster/VeehdCom.py index 396588dfd..440993a67 100644 --- a/pyload/plugins/hoster/VeehdCom.py +++ b/pyload/plugins/hoster/VeehdCom.py @@ -6,8 +6,8 @@ from pyload.plugins.base.Hoster import Hoster class VeehdCom(Hoster): - __name__ = "VeehdCom" - __type__ = "hoster" + __name__ = "VeehdCom" + __type__ = "hoster" __version__ = "0.23" __pattern__ = r'http://veehd\.com/video/\d+_\S+' @@ -15,16 +15,15 @@ class VeehdCom(Hoster): ("replacement_char", "str", "Filename replacement character", "_")] __description__ = """Veehd.com hoster plugin""" - __authors__ = [("cat", "cat@pyload")] + __license__ = "GPLv3" + __authors__ = [("cat", "cat@pyload")] - def _debug(self, msg): - self.logDebug("[%s] %s" % (self.__name__, msg)) - def setup(self): self.multiDL = True self.req.canContinue = True + def process(self, pyfile): self.download_html() if not self.file_exists(): @@ -33,11 +32,13 @@ class VeehdCom(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) + def download_html(self): url = self.pyfile.url - self._debug("Requesting page: %s" % (repr(url),)) + self.logDebug("Requesting page: %s" % url) self.html = self.load(url) + def file_exists(self): if not self.html: self.download_html() @@ -46,24 +47,26 @@ class VeehdCom(Hoster): return False return True + def get_file_name(self): if not self.html: self.download_html() m = re.search(r'<title[^>]*>([^<]+) on Veehd</title>', self.html) if m is None: - self.fail("video title not found") + self.error(_("Video title not found")) name = m.group(1) # replace unwanted characters in filename if self.getConfig('filename_spaces'): - pattern = '[^0-9A-Za-z\.\ ]+' + pattern = '[^\w ]+' else: - pattern = '[^0-9A-Za-z\.]+' + pattern = '[^\w.]+' return re.sub(pattern, self.getConfig('replacement_char'), name) + '.avi' + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -73,6 +76,6 @@ class VeehdCom(Hoster): m = re.search(r'<embed type="video/divx" src="(http://([^/]*\.)?veehd\.com/dl/[^"]+)"', self.html) if m is None: - self.fail("embedded video url not found") + self.error(_("Embedded video url not found")) return m.group(1) diff --git a/pyload/plugins/hoster/VeohCom.py b/pyload/plugins/hoster/VeohCom.py index 90e3713f2..ff4cde0ce 100644 --- a/pyload/plugins/hoster/VeohCom.py +++ b/pyload/plugins/hoster/VeohCom.py @@ -6,21 +6,22 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class VeohCom(SimpleHoster): - __name__ = "VeohCom" - __type__ = "hoster" + __name__ = "VeohCom" + __type__ = "hoster" __version__ = "0.2" __pattern__ = r'http://(?:www\.)?veoh\.com/(tv/)?(watch|videos)/(?P<ID>v\w+)' __config__ = [("quality", "Low;High;Auto", "Quality", "Auto")] __description__ = """Veoh.com hoster plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - FILE_NAME_PATTERN = r'<meta name="title" content="(?P<N>.*?)"' + NAME_PATTERN = r'<meta name="title" content="(?P<N>.*?)"' OFFLINE_PATTERN = r'>Sorry, we couldn\'t find the video you were looking for' - FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.veoh.com/watch/\g<ID>')] + URL_REPLACEMENTS = [(__pattern__, r'http://www.veoh.com/watch/\g<ID>')] COOKIES = [(".veoh.com", "lassieLocale", "en")] @@ -29,6 +30,7 @@ class VeohCom(SimpleHoster): self.resumeDownload = self.multiDL = True self.chunkLimit = -1 + def handleFree(self): quality = self.getConfig("quality") if quality == "Auto": @@ -39,13 +41,12 @@ class VeohCom(SimpleHoster): if m: self.pyfile.name += ".mp4" link = m.group(1).replace("\\", "") - self.logDebug("Download link: " + link) self.download(link) return else: - self.logInfo("No %s quality video found" % q.upper()) + self.logInfo(_("No %s quality video found") % q.upper()) else: - self.fail("No video found!") + self.fail(_("No video found!")) getInfo = create_getInfo(VeohCom) diff --git a/pyload/plugins/hoster/VidPlayNet.py b/pyload/plugins/hoster/VidPlayNet.py index 8c78b8bc1..76af05edd 100644 --- a/pyload/plugins/hoster/VidPlayNet.py +++ b/pyload/plugins/hoster/VidPlayNet.py @@ -3,24 +3,24 @@ # Test links: # BigBuckBunny_320x180.mp4 - 61.7 Mb - http://vidplay.net/38lkev0h3jv0 -from pyload.plugins.internal.XFSPHoster import XFSPHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class VidPlayNet(XFSPHoster): - __name__ = "VidPlayNet" - __type__ = "hoster" - __version__ = "0.01" +class VidPlayNet(XFSHoster): + __name__ = "VidPlayNet" + __type__ = "hoster" + __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?vidplay\.net/\w{12}' __description__ = """VidPlay.net hoster plugin""" - __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] + __license__ = "GPLv3" + __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] - HOSTER_NAME = "vidplay.net" + HOSTER_DOMAIN = "vidplay.net" - FILE_NAME_PATTERN = r'<b>Password:</b></div>\s*<h[1-6]>(?P<N>[^<]+)</h[1-6]>' - LINK_PATTERN = r'(http://([^/]*?%s|\d+\.\d+\.\d+\.\d+)(:\d+)?(/d/|(?:/files)?/\d+/\w+/)[^"\'<&]+)' % HOSTER_NAME + NAME_PATTERN = r'<b>Password:</b></div>\s*<h[1-6]>(?P<N>[^<]+)</h[1-6]>' getInfo = create_getInfo(VidPlayNet) diff --git a/pyload/plugins/hoster/VimeoCom.py b/pyload/plugins/hoster/VimeoCom.py index a8abf195a..a23888160 100644 --- a/pyload/plugins/hoster/VimeoCom.py +++ b/pyload/plugins/hoster/VimeoCom.py @@ -6,8 +6,8 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class VimeoCom(SimpleHoster): - __name__ = "VimeoCom" - __type__ = "hoster" + __name__ = "VimeoCom" + __type__ = "hoster" __version__ = "0.02" __pattern__ = r'https?://(?:www\.)?(player\.)?vimeo\.com/(video/)?(?P<ID>\d+)' @@ -15,14 +15,15 @@ class VimeoCom(SimpleHoster): ("original", "bool", "Try to download the original file first", True)] __description__ = """Vimeo.com hoster plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - FILE_NAME_PATTERN = r'<title>(?P<N>.+) on Vimeo<' + NAME_PATTERN = r'<title>(?P<N>.+) on Vimeo<' OFFLINE_PATTERN = r'class="exception_header"' TEMP_OFFLINE_PATTERN = r'Please try again in a few minutes.<' - FILE_URL_REPLACEMENTS = [(__pattern__, r'https://www.vimeo.com/\g<ID>')] + URL_REPLACEMENTS = [(__pattern__, r'https://www.vimeo.com/\g<ID>')] COOKIES = [(".vimeo.com", "language", "en")] @@ -31,6 +32,7 @@ class VimeoCom(SimpleHoster): self.resumeDownload = self.multiDL = True self.chunkLimit = -1 + def handleFree(self): password = self.getPassword() @@ -49,7 +51,7 @@ class VimeoCom(SimpleHoster): self.download(link[q]) return else: - self.logInfo("Original file not downloadable") + self.logInfo(_("Original file not downloadable")) quality = self.getConfig("quality") if quality == "Highest": @@ -64,9 +66,9 @@ class VimeoCom(SimpleHoster): self.download(link[q]) return else: - self.logInfo("No %s quality video found" % q.upper()) + self.logInfo(_("No %s quality video found") % q.upper()) else: - self.fail("No video found!") + self.fail(_("No video found!")) getInfo = create_getInfo(VimeoCom) diff --git a/pyload/plugins/hoster/Vipleech4uCom.py b/pyload/plugins/hoster/Vipleech4uCom.py index 03215fffe..c5a444433 100644 --- a/pyload/plugins/hoster/Vipleech4uCom.py +++ b/pyload/plugins/hoster/Vipleech4uCom.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class Vipleech4uCom(DeadHoster): - __name__ = "Vipleech4uCom" - __type__ = "hoster" + __name__ = "Vipleech4uCom" + __type__ = "hoster" __version__ = "0.2" __pattern__ = r'http://(?:www\.)?vipleech4u\.com/manager\.php' __description__ = """Vipleech4u.com hoster plugin""" - __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] + __license__ = "GPLv3" + __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] getInfo = create_getInfo(Vipleech4uCom) diff --git a/pyload/plugins/hoster/WarserverCz.py b/pyload/plugins/hoster/WarserverCz.py index 9b7f561b5..cb6efeba6 100644 --- a/pyload/plugins/hoster/WarserverCz.py +++ b/pyload/plugins/hoster/WarserverCz.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class WarserverCz(DeadHoster): - __name__ = "WarserverCz" - __type__ = "hoster" + __name__ = "WarserverCz" + __type__ = "hoster" __version__ = "0.13" __pattern__ = r'http://(?:www\.)?warserver\.cz/stahnout/\d+' __description__ = """Warserver.cz hoster plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] getInfo = create_getInfo(WarserverCz) diff --git a/pyload/plugins/hoster/WebshareCz.py b/pyload/plugins/hoster/WebshareCz.py index face27e0a..fcdfd55bf 100644 --- a/pyload/plugins/hoster/WebshareCz.py +++ b/pyload/plugins/hoster/WebshareCz.py @@ -2,34 +2,35 @@ import re -from pyload.network.RequestFactory import getRequest +from module.network.RequestFactory import getURL from pyload.plugins.internal.SimpleHoster import SimpleHoster def getInfo(urls): - h = getRequest() for url in urls: - h.load(url) fid = re.search(WebshareCz.__pattern__, url).group('ID') - api_data = h.load('https://webshare.cz/api/file_info/', post={'ident': fid}) + api_data = getURL("https://webshare.cz/api/file_info/", post={'ident': fid}) + if 'File not found' in api_data: file_info = (url, 0, 1, url) else: name = re.search('<name>(.+)</name>', api_data).group(1) size = re.search('<size>(.+)</size>', api_data).group(1) file_info = (name, size, 2, url) + yield file_info class WebshareCz(SimpleHoster): - __name__ = "WebshareCz" - __type__ = "hoster" - __version__ = "0.13" + __name__ = "WebshareCz" + __type__ = "hoster" + __version__ = "0.14" - __pattern__ = r'https?://(?:www\.)?webshare.cz/(?:#/)?file/(?P<ID>\w+)' + __pattern__ = r'https?://(?:www\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)' __description__ = """WebShare.cz hoster plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def handleFree(self): @@ -37,11 +38,12 @@ class WebshareCz(SimpleHoster): self.logDebug("API data: " + api_data) m = re.search('<link>(.+)</link>', api_data) if m is None: - self.parseError('Unable to detect direct link') + self.error(_("Unable to detect direct link")) direct = m.group(1) self.logDebug("Direct link: " + direct) self.download(direct, disposition=True) + def getFileInfo(self): self.logDebug("URL: %s" % self.pyfile.url) diff --git a/pyload/plugins/hoster/WrzucTo.py b/pyload/plugins/hoster/WrzucTo.py index 34065284b..44255e6b2 100644 --- a/pyload/plugins/hoster/WrzucTo.py +++ b/pyload/plugins/hoster/WrzucTo.py @@ -8,18 +8,19 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class WrzucTo(SimpleHoster): - __name__ = "WrzucTo" - __type__ = "hoster" - __version__ = "0.01" + __name__ = "WrzucTo" + __type__ = "hoster" + __version__ = "0.02" - __pattern__ = r'http://(?:www\.)?wrzuc\.to/([a-zA-Z0-9]+(\.wt|\.html)|(\w+/?linki/[a-zA-Z0-9]+))' + __pattern__ = r'http://(?:www\.)?wrzuc\.to/(\w+(\.wt|\.html)|(\w+/?linki/\w+))' __description__ = """Wrzuc.to hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'id="file_info">\s*<strong>(?P<N>.*?)</strong>' - FILE_SIZE_PATTERN = r'class="info">\s*<tr>\s*<td>(?P<S>.*?)</td>' + NAME_PATTERN = r'id="file_info">\s*<strong>(?P<N>.*?)</strong>' + SIZE_PATTERN = r'class="info">\s*<tr>\s*<td>(?P<S>.*?)</td>' COOKIES = [(".wrzuc.to", "language", "en")] @@ -27,10 +28,11 @@ class WrzucTo(SimpleHoster): def setup(self): self.multiDL = True + def handleFree(self): data = dict(re.findall(r'(md5|file): "(.*?)"', self.html)) if len(data) != 2: - self.parseError('File ID') + self.error(_("No file ID")) self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) self.req.http.lastURL = self.pyfile.url @@ -41,10 +43,9 @@ class WrzucTo(SimpleHoster): data.update(re.findall(r'"(download_link|server_id)":"(.*?)"', self.html)) if len(data) != 4: - self.parseError('Download URL') + self.error(_("No download URL")) download_url = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link']) - self.logDebug("Download URL: %s" % download_url) self.download(download_url) diff --git a/pyload/plugins/hoster/WuploadCom.py b/pyload/plugins/hoster/WuploadCom.py index 7260b5f1f..d2c202849 100644 --- a/pyload/plugins/hoster/WuploadCom.py +++ b/pyload/plugins/hoster/WuploadCom.py @@ -4,15 +4,16 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class WuploadCom(DeadHoster): - __name__ = "WuploadCom" - __type__ = "hoster" + __name__ = "WuploadCom" + __type__ = "hoster" __version__ = "0.23" - __pattern__ = r'http://(?:www\.)?wupload\..*?/file/(([a-z][0-9]+/)?[0-9]+)(/.*)?' + __pattern__ = r'http://(?:www\.)?wupload\..*?/file/((\w+/)?\d+)(/.*)?' __description__ = """Wupload.com hoster plugin""" - __authors__ = [("jeix", "jeix@hasnomail.de"), - ("Paul King", None)] + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de"), + ("Paul King", None)] getInfo = create_getInfo(WuploadCom) diff --git a/pyload/plugins/hoster/X7To.py b/pyload/plugins/hoster/X7To.py index e03502063..72e7d08db 100644 --- a/pyload/plugins/hoster/X7To.py +++ b/pyload/plugins/hoster/X7To.py @@ -4,14 +4,15 @@ from pyload.plugins.internal.DeadHoster import DeadHoster, create_getInfo class X7To(DeadHoster): - __name__ = "X7To" - __type__ = "hoster" + __name__ = "X7To" + __type__ = "hoster" __version__ = "0.41" - __pattern__ = r'http://(?:www\.)?x7.to/' + __pattern__ = r'http://(?:www\.)?x7\.to/' __description__ = """X7.to hoster plugin""" - __authors__ = [("ernieb", "ernieb")] + __license__ = "GPLv3" + __authors__ = [("ernieb", "ernieb")] getInfo = create_getInfo(X7To) diff --git a/pyload/plugins/hoster/XHamsterCom.py b/pyload/plugins/hoster/XHamsterCom.py index 6d0dbd4d0..acbcc2192 100644 --- a/pyload/plugins/hoster/XHamsterCom.py +++ b/pyload/plugins/hoster/XHamsterCom.py @@ -17,15 +17,16 @@ def clean_json(json_expr): class XHamsterCom(Hoster): - __name__ = "XHamsterCom" - __type__ = "hoster" + __name__ = "XHamsterCom" + __type__ = "hoster" __version__ = "0.12" __pattern__ = r'http://(?:www\.)?xhamster\.com/movies/.+' __config__ = [("type", ".mp4;.flv", "Preferred type", ".mp4")] __description__ = """XHamster.com hoster plugin""" - __authors__ = [] + __license__ = "GPLv3" + __authors__ = [] def process(self, pyfile): @@ -40,21 +41,23 @@ class XHamsterCom(Hoster): pyfile.name = self.get_file_name() + self.desired_fmt self.download(self.get_file_url()) + def download_html(self): url = self.pyfile.url self.html = self.load(url) + def get_file_url(self): """ returns the absolute downloadable filepath """ if not self.html: self.download_html() - flashvar_pattern = re.compile('flashvars = ({.*?});', re.DOTALL) + flashvar_pattern = re.compile('flashvars = ({.*?});', re.S) json_flashvar = flashvar_pattern.search(self.html) if not json_flashvar: - self.fail("Parse error (flashvars)") + self.error(_("flashvar not found")) j = clean_json(json_flashvar.group(1)) flashvars = json_loads(j) @@ -62,57 +65,59 @@ class XHamsterCom(Hoster): if flashvars['srv']: srv_url = flashvars['srv'] + '/' else: - self.fail("Parse error (srv_url)") + self.error(_("srv_url not found")) if flashvars['url_mode']: url_mode = flashvars['url_mode'] else: - self.fail("Parse error (url_mode)") + self.error(_("url_mode not found")) if self.desired_fmt == ".mp4": file_url = re.search(r"<a href=\"" + srv_url + "(.+?)\"", self.html) if file_url is None: - self.fail("Parse error (file_url)") + self.error(_("file_url not found")) file_url = file_url.group(1) long_url = srv_url + file_url - self.logDebug("long_url: %s" % long_url) + self.logDebug("long_url = " + long_url) else: if flashvars['file']: file_url = unquote(flashvars['file']) else: - self.fail("Parse error (file_url)") + self.error(_("file_url not found")) if url_mode == '3': long_url = file_url - self.logDebug("long_url: %s" % long_url) + self.logDebug("long_url = " + long_url) else: long_url = srv_url + "key=" + file_url - self.logDebug("long_url: %s" % long_url) + self.logDebug("long_url = " + long_url) return long_url + def get_file_name(self): if not self.html: self.download_html() - pattern = r"<title>(.*?) - xHamster\.com</title>" + pattern = r'<title>(.*?) - xHamster\.com</title>' name = re.search(pattern, self.html) if name is None: - pattern = r"<h1 >(.*)</h1>" + pattern = r'<h1 >(.*)</h1>' name = re.search(pattern, self.html) if name is None: - pattern = r"http://[www.]+xhamster\.com/movies/.*/(.*?)\.html?" + pattern = r'http://[www.]+xhamster\.com/movies/.*/(.*?)\.html?' name = re.match(file_name_pattern, self.pyfile.url) if name is None: - pattern = r"<div id=\"element_str_id\" style=\"display:none;\">(.*)</div>" + pattern = r'<div id="element_str_id" style="display:none;">(.*)</div>' name = re.search(pattern, self.html) if name is None: return "Unknown" return name.group(1) + def file_exists(self): """ returns True or False """ diff --git a/pyload/plugins/hoster/XVideosCom.py b/pyload/plugins/hoster/XVideosCom.py index 723b2acac..4fb288e51 100644 --- a/pyload/plugins/hoster/XVideosCom.py +++ b/pyload/plugins/hoster/XVideosCom.py @@ -8,14 +8,15 @@ from pyload.plugins.base.Hoster import Hoster class XVideosCom(Hoster): - __name__ = "XVideos.com" - __type__ = "hoster" + __name__ = "XVideos.com" + __type__ = "hoster" __version__ = "0.1" - __pattern__ = r'http://(?:www\.)?xvideos\.com/video([0-9]+)/.*' + __pattern__ = r'http://(?:www\.)?xvideos\.com/video(\d+)/.*' __description__ = """XVideos.com hoster plugin""" - __authors__ = [] + __license__ = "GPLv3" + __authors__ = [] def process(self, pyfile): diff --git a/pyload/plugins/hoster/Xdcc.py b/pyload/plugins/hoster/Xdcc.py index c992ada2a..dc0cbc27a 100644 --- a/pyload/plugins/hoster/Xdcc.py +++ b/pyload/plugins/hoster/Xdcc.py @@ -15,8 +15,8 @@ from pyload.utils import safe_join class Xdcc(Hoster): - __name__ = "Xdcc" - __type__ = "hoster" + __name__ = "Xdcc" + __type__ = "hoster" __version__ = "0.32" __config__ = [("nick", "str", "Nickname", "pyload"), @@ -24,7 +24,8 @@ class Xdcc(Hoster): ("realname", "str", "Realname", "pyloadreal")] __description__ = """Download from IRC XDCC bot""" - __authors__ = [("jeix", "jeix@hasnomail.com")] + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.com")] def setup(self): @@ -32,15 +33,16 @@ class Xdcc(Hoster): self.timeout = 30 self.multiDL = False + def process(self, pyfile): # change request type self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, type="XDCC") self.pyfile = pyfile - for _ in xrange(0, 3): + for _i in xrange(0, 3): try: nmn = self.doDownload(pyfile.url) - self.logDebug("%s: Download of %s finished." % (self.__name__, nmn)) + self.logDebug("Download of %s finished." % nmn) return except socket.error, e: if hasattr(e, "errno"): @@ -49,14 +51,15 @@ class Xdcc(Hoster): errno = e.args[0] if errno == 10054: - self.logDebug("XDCC: Server blocked our ip, retry in 5 min") + self.logDebug("Server blocked our ip, retry in 5 min") self.setWait(300) self.wait() continue - self.fail("Failed due to socket errors. Code: %d" % errno) + self.fail(_("Failed due to socket errors. Code: %d") % errno) + + self.fail(_("Server blocked our ip, retry again later manually")) - self.fail("Server blocked our ip, retry again later manually") def doDownload(self, url): self.pyfile.setStatus("waiting") # real link @@ -77,7 +80,7 @@ class Xdcc(Hoster): elif ln == 1: host, port = temp[0], 6667 else: - self.fail("Invalid hostname for IRC Server (%s)" % server) + self.fail(_("Invalid hostname for IRC Server: %s") % server) ####################### # CONNECT TO IRC AND IDLE FOR REAL LINK @@ -114,7 +117,7 @@ class Xdcc(Hoster): if (dl_time + self.timeout) < time.time(): # todo: add in config sock.send("QUIT :byebye\r\n") sock.close() - self.fail("XDCC Bot did not answer") + self.fail(_("XDCC Bot did not answer")) fdset = select([sock], [], [], 0) if sock not in fdset[0]: @@ -134,7 +137,7 @@ class Xdcc(Hoster): sock.send("PONG %s\r\n" % first[1]) if first[0] == "ERROR": - self.fail("IRC-Error: %s" % line) + self.fail(_("IRC-Error: %s") % line) msg = line.split(None, 3) if len(msg) != 4: @@ -149,10 +152,10 @@ class Xdcc(Hoster): if nick == msg['target'][0:len(nick)] and "PRIVMSG" == msg['action']: if msg['text'] == "\x01VERSION\x01": - self.logDebug("XDCC: Sending CTCP VERSION.") + self.logDebug("Sending CTCP VERSION") sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) elif msg['text'] == "\x01TIME\x01": - self.logDebug("Sending CTCP TIME.") + self.logDebug("Sending CTCP TIME") sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) elif msg['text'] == "\x01LAG\x01": pass # don't know how to answer @@ -169,7 +172,7 @@ class Xdcc(Hoster): retry = time.time() + 300 if "you must be on a known channel to request a pack" in msg['text']: - self.fail("Wrong channel") + self.fail(_("Wrong channel")) m = re.match('\x01DCC SEND (.*?) (\d+) (\d+)(?: (\d+))?\x01', msg['text']) if m: @@ -188,12 +191,12 @@ class Xdcc(Hoster): download_folder = self.config['general']['download_folder'] filename = safe_join(download_folder, packname) - self.logInfo("XDCC: Downloading %s from %s:%d" % (packname, ip, port)) + self.logInfo(_("Downloading %s from %s:%d") % (packname, ip, port)) self.pyfile.setStatus("downloading") newname = self.req.download(ip, port, filename, sock, self.pyfile.setProgress) if newname and newname != filename: - self.logInfo("%(name)s saved as %(newname)s" % {"name": self.pyfile.name, "newname": newname}) + self.logInfo(_("%(name)s saved as %(newname)s") % {"name": self.pyfile.name, "newname": newname}) filename = newname # kill IRC socket diff --git a/pyload/plugins/hoster/YibaishiwuCom.py b/pyload/plugins/hoster/YibaishiwuCom.py index 9b0244aa2..883dfa947 100644 --- a/pyload/plugins/hoster/YibaishiwuCom.py +++ b/pyload/plugins/hoster/YibaishiwuCom.py @@ -7,18 +7,19 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class YibaishiwuCom(SimpleHoster): - __name__ = "YibaishiwuCom" - __type__ = "hoster" - __version__ = "0.12" + __name__ = "YibaishiwuCom" + __type__ = "hoster" + __version__ = "0.13" - __pattern__ = r'http://(?:www\.)?(?:u\.)?115.com/file/(?P<ID>\w+)' + __pattern__ = r'http://(?:www\.)?(?:u\.)?115\.com/file/(?P<ID>\w+)' __description__ = """115.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r"file_name: '(?P<N>[^']+)'" - FILE_SIZE_PATTERN = r"file_size: '(?P<S>[^']+)'" + NAME_PATTERN = r'file_name: \'(?P<N>.+?)\'' + SIZE_PATTERN = r'file_size: \'(?P<S>.+?)\'' OFFLINE_PATTERN = ur'<h3><i style="color:red;">ååïŒæåç äžååšïŒäžåŠšææçå§ïŒ</i></h3>' LINK_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)' @@ -27,15 +28,15 @@ class YibaishiwuCom(SimpleHoster): def handleFree(self): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError("AJAX URL") + self.error(_("LINK_PATTERN not found")) url = m.group(1) self.logDebug(('FREEUSER' if m.group(2) == 'download' else 'GUEST') + ' URL', url) - response = json_loads(self.load("http://115.com" + url, decode=False)) - if "urls" in response: - mirrors = response['urls'] - elif "data" in response: - mirrors = response['data'] + res = json_loads(self.load("http://115.com" + url, decode=False)) + if "urls" in res: + mirrors = res['urls'] + elif "data" in res: + mirrors = res['data'] else: mirrors = None @@ -48,7 +49,7 @@ class YibaishiwuCom(SimpleHoster): except: continue else: - self.fail('No working link found') + self.fail(_("No working link found")) getInfo = create_getInfo(YibaishiwuCom) diff --git a/pyload/plugins/hoster/YoupornCom.py b/pyload/plugins/hoster/YoupornCom.py index a5b9f65ae..46c7ebfcb 100644 --- a/pyload/plugins/hoster/YoupornCom.py +++ b/pyload/plugins/hoster/YoupornCom.py @@ -6,14 +6,15 @@ from pyload.plugins.base.Hoster import Hoster class YoupornCom(Hoster): - __name__ = "YoupornCom" - __type__ = "hoster" + __name__ = "YoupornCom" + __type__ = "hoster" __version__ = "0.2" __pattern__ = r'http://(?:www\.)?youporn\.com/watch/.+' __description__ = """Youporn.com hoster plugin""" - __authors__ = [("willnix", "willnix@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("willnix", "willnix@pyload.org")] def process(self, pyfile): @@ -25,10 +26,12 @@ class YoupornCom(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) + def download_html(self): url = self.pyfile.url self.html = self.load(url, post={"user_choice": "Enter"}, cookies=False) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -37,13 +40,15 @@ class YoupornCom(Hoster): return re.search(r'(http://download\.youporn\.com/download/\d+\?save=1)">', self.html).group(1) + def get_file_name(self): if not self.html: self.download_html() - file_name_pattern = r"<title>(.*) - Free Porn Videos - YouPorn</title>" + file_name_pattern = r'<title>(.+) - ' return re.search(file_name_pattern, self.html).group(1).replace("&", "&").replace("/", "") + '.flv' + def file_exists(self): """ returns True or False """ diff --git a/pyload/plugins/hoster/YourfilesTo.py b/pyload/plugins/hoster/YourfilesTo.py index 3bbdf0628..6a3a5c1ec 100644 --- a/pyload/plugins/hoster/YourfilesTo.py +++ b/pyload/plugins/hoster/YourfilesTo.py @@ -8,15 +8,16 @@ from pyload.plugins.base.Hoster import Hoster class YourfilesTo(Hoster): - __name__ = "YourfilesTo" - __type__ = "hoster" + __name__ = "YourfilesTo" + __type__ = "hoster" __version__ = "0.21" - __pattern__ = r'(http://)?(?:www\.)?yourfiles\.(to|biz)/\?d=[a-zA-Z0-9]+' + __pattern__ = r'(http://)?(?:www\.)?yourfiles\.(to|biz)/\?d=\w+' __description__ = """Youfiles.to hoster plugin""" - __authors__ = [("jeix", "jeix@hasnomail.de"), - ("skydancer", "skydancer@hasnomail.de")] + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de"), + ("skydancer", "skydancer@hasnomail.de")] def process(self, pyfile): @@ -24,6 +25,7 @@ class YourfilesTo(Hoster): self.prepare() self.download(self.get_file_url()) + def prepare(self): if not self.file_exists(): self.offline() @@ -32,9 +34,10 @@ class YourfilesTo(Hoster): wait_time = self.get_waiting_time() self.setWait(wait_time) - self.logDebug("%s: Waiting %d seconds." % (self.__name__, wait_time)) + self.logDebug("Waiting %d seconds." % wait_time) self.wait() + def get_waiting_time(self): if not self.html: self.download_html() @@ -48,10 +51,12 @@ class YourfilesTo(Hoster): return sec + def download_html(self): url = self.pyfile.url self.html = self.load(url) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -61,7 +66,8 @@ class YourfilesTo(Hoster): url = unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", "")) return url else: - self.fail("absolute filepath could not be found. offline? ") + self.error(_("Absolute filepath not found")) + def get_file_name(self): if not self.html: @@ -69,6 +75,7 @@ class YourfilesTo(Hoster): return re.search("<title>(.*)</title>", self.html).group(1) + def file_exists(self): """ returns True or False """ diff --git a/pyload/plugins/hoster/YoutubeCom.py b/pyload/plugins/hoster/YoutubeCom.py index 6679974cc..0246d0997 100644 --- a/pyload/plugins/hoster/YoutubeCom.py +++ b/pyload/plugins/hoster/YoutubeCom.py @@ -16,6 +16,7 @@ def which(program): Courtesy of http://stackoverflow.com/a/377028/675646""" + def is_exe(fpath): return os.path.isfile(fpath) and os.access(fpath, os.X_OK) @@ -34,8 +35,8 @@ def which(program): class YoutubeCom(Hoster): - __name__ = "YoutubeCom" - __type__ = "hoster" + __name__ = "YoutubeCom" + __type__ = "hoster" __version__ = "0.40" __pattern__ = r'https?://(?:[^/]*\.)?(?:youtube\.com|youtu\.be)/watch.*?[?&]v=.*' @@ -48,11 +49,12 @@ class YoutubeCom(Hoster): ("3d", "bool", "Prefer 3D", False)] __description__ = """Youtube.com hoster plugin""" - __authors__ = [("spoob", "spoob@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz")] - FILE_URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/')] + URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/')] # Invalid characters that must be removed from the file name invalidChars = u'\u2605:?><"|\\' @@ -84,8 +86,9 @@ class YoutubeCom(Hoster): def setup(self): self.resumeDownload = self.multiDL = True + def process(self, pyfile): - pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS) + pyfile.url = replace_patterns(pyfile.url, self.URL_REPLACEMENTS) html = self.load(pyfile.url, decode=True) if re.search(r'<div id="player-unavailable" class="\s*player-width player-height\s*">', html): @@ -104,7 +107,7 @@ class YoutubeCom(Hoster): "480p": 35, "720p": 22, "1080p": 37, "3072p": 38} desired_fmt = self.getConfig("fmt") if desired_fmt and desired_fmt not in self.formats: - self.logWarning("FMT %d unknown - using default." % desired_fmt) + self.logWarning(_("FMT %d unknown, using default") % desired_fmt) desired_fmt = 0 if not desired_fmt: desired_fmt = quality.get(self.getConfig("quality"), 18) @@ -121,7 +124,7 @@ class YoutubeCom(Hoster): allowed = lambda x: self.getConfig(self.formats[x][0]) streams = [x for x in streams if x[0] in self.formats and allowed(x[0])] if not streams: - self.fail("No available stream meets your preferences") + self.fail(_("No available stream meets your preferences")) fmt_dict = dict([x for x in streams if self.formats[x[0]][4] == use3d] or streams) self.logDebug("DESIRED STREAM: ITAG:%d (%s) %sfound, %sallowed" % diff --git a/pyload/plugins/hoster/ZDF.py b/pyload/plugins/hoster/ZDF.py index 21ee94443..9d2ad446b 100644 --- a/pyload/plugins/hoster/ZDF.py +++ b/pyload/plugins/hoster/ZDF.py @@ -9,14 +9,15 @@ from pyload.plugins.base.Hoster import Hoster # Based on zdfm by Roland Beermann (http://github.com/enkore/zdfm/) class ZDF(Hoster): - __name__ = "ZDF Mediathek" - __type__ = "hoster" + __name__ = "ZDF Mediathek" + __type__ = "hoster" __version__ = "0.8" - __pattern__ = r'http://(?:www\.)?zdf\.de/ZDFmediathek/[^0-9]*([0-9]+)[^0-9]*' + __pattern__ = r'http://(?:www\.)?zdf\.de/ZDFmediathek/\D*(\d+)\D*' __description__ = """ZDF.de hoster plugin""" - __authors__ = [] + __license__ = "GPLv3" + __authors__ = [] XML_API = "http://www.zdf.de/ZDFmediathek/xmlservice/web/beitragsDetails?id=%i" @@ -28,21 +29,24 @@ class ZDF(Hoster): any(f.text == "progressive" for f in video.iter("facet")), ) + @staticmethod def video_valid(video): return video.findtext("url").startswith("http") and video.findtext("url").endswith(".mp4") and \ video.findtext("facets/facet").startswith("progressive") + @staticmethod def get_id(url): - return int(re.search(r"[^0-9]*([0-9]{4,})[^0-9]*", url).group(1)) + return int(re.search(r"\D*(\d{4,})\D*", url).group(1)) + def process(self, pyfile): xml = fromstring(self.load(self.XML_API % self.get_id(pyfile.url))) status = xml.findtext("./status/statuscode") if status != "ok": - self.fail("Error retrieving manifest.") + self.fail(_("Error retrieving manifest")) video = xml.find("video") title = video.findtext("information/title") diff --git a/pyload/plugins/hoster/ZeveraCom.py b/pyload/plugins/hoster/ZeveraCom.py index 6f390f0bb..769602964 100644 --- a/pyload/plugins/hoster/ZeveraCom.py +++ b/pyload/plugins/hoster/ZeveraCom.py @@ -4,36 +4,38 @@ from pyload.plugins.base.Hoster import Hoster class ZeveraCom(Hoster): - __name__ = "ZeveraCom" - __type__ = "hoster" + __name__ = "ZeveraCom" + __type__ = "hoster" __version__ = "0.21" __pattern__ = r'http://(?:www\.)?zevera\.com/.*' __description__ = """Zevera.com hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def setup(self): self.resumeDownload = self.multiDL = True self.chunkLimit = 1 + def process(self, pyfile): if not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "zevera.com") - self.fail("No zevera.com account provided") + self.fail(_("No zevera.com account provided")) self.logDebug("Old URL: %s" % pyfile.url) if self.account.getAPIData(self.req, cmd="checklink", olink=pyfile.url) != "Alive": - self.fail("Offline or not downloadable - contact Zevera support") + self.fail(_("Offline or not downloadable - contact Zevera support")) header = self.account.getAPIData(self.req, just_header=True, cmd="generatedownloaddirect", olink=pyfile.url) if not "location" in header: - self.fail("Unable to initialize download - contact Zevera support") + self.fail(_("Unable to initialize download")) self.download(header['location'], disposition=True) check = self.checkDownload({"error": 'action="ErrorDownload.aspx'}) if check == "error": - self.fail("Error response received - contact Zevera support") + self.fail(_("Error response received - contact Zevera support")) diff --git a/pyload/plugins/hoster/ZippyshareCom.py b/pyload/plugins/hoster/ZippyshareCom.py index f8ef1ce43..67ff1c592 100644 --- a/pyload/plugins/hoster/ZippyshareCom.py +++ b/pyload/plugins/hoster/ZippyshareCom.py @@ -3,24 +3,26 @@ import re from os import path +from urllib import unquote from urlparse import urljoin from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): - __name__ = "ZippyshareCom" - __type__ = "hoster" - __version__ = "0.51" + __name__ = "ZippyshareCom" + __type__ = "hoster" + __version__ = "0.60" __pattern__ = r'(?P<HOST>http://www\d{0,2}\.zippyshare\.com)/v(?:/|iew\.jsp.*key=)(?P<KEY>\d+)' __description__ = """Zippyshare.com hoster plugin""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - FILE_NAME_PATTERN = r'>Name:.+?">(?P<N>.+?)<' - FILE_SIZE_PATTERN = r'>Size:.+?">(?P<S>[\d.]+) (?P<U>\w+)' + NAME_PATTERN = r'("\d{6,}/"[ ]*\+.+?"/|<title>Zippyshare.com - )(?P<N>.+?)("|</title>)' + SIZE_PATTERN = r'>Size:.+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>File does not exist on this server<' @@ -35,36 +37,35 @@ class ZippyshareCom(SimpleHoster): def handleFree(self): url = self.get_link() - self.logDebug("Download URL: %s" % url) self.download(url) - def get_checksum(self): - m = re.search(r'\(a\*b\+19\)', self.html) - if m: - m = re.findall(r'var \w = (\d+)\%(\d+);', self.html) - c = lambda a,b: a * b + 19 - else: - m = re.findall(r'(\d+) \% (\d+)', self.html) - c = lambda a,b: a + b - - if not m: - self.parseError("Unable to calculate checksum") + def getFileInfo(self): + info = super(ZippyshareCom, self).getFileInfo() + self.pyfile.name = info['name'] = unquote(info['name']) + return info - a = map(lambda x: int(x), m[0]) - b = map(lambda x: int(x), m[1]) - # Checksum is calculated as (a*b+19) or (a+b), where a and b are the result of modulo calculations - a = a[0] % a[1] - b = b[0] % b[1] - - return c(a, b) + def get_checksum(self): + try: + m = re.search(r'\+[ ]*\((\d+)[ ]*\%[ ]*(\d+)[ ]*\+[ ]*(\d+)[ ]*\%[ ]*(\d+)\)[ ]*\+', self.html) + if m: + a1, a2, c1, c2 = map(int, m.groups()) + else: + a1, a2 = map(int, re.search(r'\(\'downloadB\'\).omg = (\d+)%(\d+)', self.html).groups()) + c1, c2 = map(int, re.search(r'\(\'downloadB\'\).omg\) \* \((\d+)%(\d+)', self.html).groups()) + + b = (a1 % a2) * (c1 % c2) + except: + self.error(_("Unable to calculate checksum")) + else: + return b + 18 def get_link(self): checksum = self.get_checksum() - p_url = path.join("d", self.file_info['KEY'], str(checksum), self.pyfile.name) - dl_link = urljoin(self.file_info['HOST'], p_url) + p_url = path.join("d", self.info['KEY'], str(checksum), self.pyfile.name) + dl_link = urljoin(self.info['HOST'], p_url) return dl_link diff --git a/pyload/plugins/internal/AbstractExtractor.py b/pyload/plugins/internal/AbstractExtractor.py index 5a372fd71..54ea9b348 100644 --- a/pyload/plugins/internal/AbstractExtractor.py +++ b/pyload/plugins/internal/AbstractExtractor.py @@ -13,11 +13,12 @@ class WrongPassword(Exception): class AbtractExtractor: - __name__ = "AbtractExtractor" + __name__ = "AbtractExtractor" __version__ = "0.1" __description__ = """Abtract extractor plugin""" - __authors__ = [("pyLoad Team", "admin@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] @staticmethod @@ -27,6 +28,7 @@ class AbtractExtractor: """ return True + @staticmethod def getTargets(files_ids): """ Filter suited targets from list of filename id tuple list @@ -35,6 +37,7 @@ class AbtractExtractor: """ raise NotImplementedError + def __init__(self, m, file, out, fullpath, overwrite, excludefiles, renice): """Initialize extractor for specific file @@ -54,10 +57,12 @@ class AbtractExtractor: self.renice = renice self.files = [] #: Store extracted files here + def init(self): """ Initialize additional data structures """ pass + def checkArchive(self): """Check if password if needed. Raise ArchiveError if integrity is questionable. @@ -67,6 +72,7 @@ class AbtractExtractor: """ return False + def checkPassword(self, password): """ Check if the given password is/might be correct. If it can not be decided at this point return true. @@ -76,6 +82,7 @@ class AbtractExtractor: """ return True + def extract(self, progress, password=None): """Extract the archive. Raise specific errors in case of failure. @@ -88,6 +95,7 @@ class AbtractExtractor: """ raise NotImplementedError + def getDeleteFiles(self): """Return list of files to delete, do *not* delete them here. @@ -95,6 +103,7 @@ class AbtractExtractor: """ raise NotImplementedError + def getExtractedFiles(self): """Populate self.files at some point while extracting""" return self.files diff --git a/pyload/plugins/internal/DeadCrypter.py b/pyload/plugins/internal/DeadCrypter.py index 9a59677fd..83aed6d43 100644 --- a/pyload/plugins/internal/DeadCrypter.py +++ b/pyload/plugins/internal/DeadCrypter.py @@ -4,14 +4,15 @@ from pyload.plugins.base.Crypter import Crypter as _Crypter class DeadCrypter(_Crypter): - __name__ = "DeadCrypter" - __type__ = "crypter" + __name__ = "DeadCrypter" + __type__ = "crypter" __version__ = "0.02" - __pattern__ = None + __pattern__ = r'^unmatchable$' __description__ = """Crypter is no longer available""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def setup(self): diff --git a/pyload/plugins/internal/DeadHoster.py b/pyload/plugins/internal/DeadHoster.py index 349296e47..76a7b5d80 100644 --- a/pyload/plugins/internal/DeadHoster.py +++ b/pyload/plugins/internal/DeadHoster.py @@ -12,14 +12,15 @@ def create_getInfo(plugin): class DeadHoster(_Hoster): - __name__ = "DeadHoster" - __type__ = "hoster" + __name__ = "DeadHoster" + __type__ = "hoster" __version__ = "0.12" - __pattern__ = None + __pattern__ = r'^unmatchable$' __description__ = """Hoster is no longer available""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def setup(self): diff --git a/pyload/plugins/internal/MultiHoster.py b/pyload/plugins/internal/MultiHoster.py index 087edb6af..97cbb4591 100644 --- a/pyload/plugins/internal/MultiHoster.py +++ b/pyload/plugins/internal/MultiHoster.py @@ -7,27 +7,30 @@ from pyload.utils import remove_chars class MultiHoster(Addon): - __name__ = "MultiHoster" - __type__ = "addon" + __name__ = "MultiHoster" + __type__ = "addon" __version__ = "0.20" __description__ = """Generic MultiHoster plugin""" - __authors__ = [("pyLoad Team", "admin@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] - replacements = [("2shared.com", "twoshared.com"), ("4shared.com", "fourshared.com"), ("cloudnator.com", "shragle.com"), - ("ifile.it", "filecloud.io"), ("easy-share.com", "crocko.com"), ("freakshare.net", "freakshare.com"), - ("hellshare.com", "hellshare.cz"), ("share-rapid.cz", "sharerapid.com"), ("sharerapid.cz", "sharerapid.com"), - ("ul.to", "uploaded.to"), ("uploaded.net", "uploaded.to"), ("1fichier.com", "onefichier.com")] - ignored = [] interval = 24 * 60 * 60 #: reload hosters daily + HOSTER_REPLACEMENTS = [("2shared.com", "twoshared.com"), ("4shared.com", "fourshared.com"), ("cloudnator.com", "shragle.com"), + ("ifile.it", "filecloud.io"), ("easy-share.com", "crocko.com"), ("freakshare.net", "freakshare.com"), + ("hellshare.com", "hellshare.cz"), ("share-rapid.cz", "sharerapid.com"), ("sharerapid.cz", "sharerapid.com"), + ("ul.to", "uploaded.to"), ("uploaded.net", "uploaded.to"), ("1fichier.com", "onefichier.com")] + HOSTER_EXCLUDED = [] + def setup(self): self.hosters = [] self.supported = [] self.new_supported = [] + def getConfig(self, option, default=''): """getConfig with default value - subclass may not implements all config options""" try: @@ -36,10 +39,11 @@ class MultiHoster(Addon): except KeyError: return default + def getHosterCached(self): if not self.hosters: try: - hosterSet = self.toHosterSet(self.getHoster()) - set(self.ignored) + hosterSet = self.toHosterSet(self.getHoster()) - set(self.HOSTER_EXCLUDED) except Exception, e: self.logError(e) return [] @@ -61,10 +65,11 @@ class MultiHoster(Addon): return self.hosters + def toHosterSet(self, hosters): hosters = set((str(x).strip().lower() for x in hosters)) - for rep in self.replacements: + for rep in self.HOSTER_REPLACEMENTS: if rep[0] in hosters: hosters.remove(rep[0]) hosters.add(rep[1]) @@ -72,6 +77,7 @@ class MultiHoster(Addon): hosters.discard('') return hosters + def getHoster(self): """Load list of supported hoster @@ -79,6 +85,7 @@ class MultiHoster(Addon): """ raise NotImplementedError + def coreReady(self): if self.cb: self.core.scheduler.removeJob(self.cb) @@ -94,9 +101,11 @@ class MultiHoster(Addon): else: self.periodical() + def initPeriodical(self): pass + def periodical(self): """reload hoster list periodically""" self.logInfo(_("Reloading supported hoster list")) @@ -112,12 +121,13 @@ class MultiHoster(Addon): for hoster in old_supported: self.unloadHoster(hoster) + def overridePlugins(self): pluginMap = {} for name in self.core.pluginManager.hosterPlugins.keys(): pluginMap[name.lower()] = name - accountList = [name.lower() for name, data in self.core.accountManager.accounts.items() if data] + accountList = [name.lower() for name, data in self.core.accountManager.accounts.iteritems() if data] excludedList = [] for hoster in self.getHosterCached(): @@ -152,9 +162,9 @@ class MultiHoster(Addon): self.logDebug("New Hosters", ", ".join(sorted(self.new_supported))) # create new regexp - regexp = r".*(%s).*" % "|".join([x.replace(".", "\\.") for x in self.new_supported]) + regexp = r'.*(%s).*' % "|".join([x.replace(".", "\\.") for x in self.new_supported]) if hasattr(klass, "__pattern__") and isinstance(klass.__pattern__, basestring) and '://' in klass.__pattern__: - regexp = r"%s|%s" % (klass.__pattern__, regexp) + regexp = r'%s|%s' % (klass.__pattern__, regexp) self.logDebug("Regexp", regexp) @@ -162,6 +172,7 @@ class MultiHoster(Addon): dict['pattern'] = regexp dict['re'] = re.compile(regexp) + def unloadHoster(self, hoster): dict = self.core.pluginManager.hosterPlugins[hoster] if "module" in dict: @@ -171,6 +182,7 @@ class MultiHoster(Addon): del dict['new_module'] del dict['new_name'] + def unload(self): """Remove override for all hosters. Scheduler job is removed by AddonManager""" for hoster in self.supported: @@ -182,6 +194,7 @@ class MultiHoster(Addon): dict['pattern'] = getattr(klass, "__pattern__", r'^unmatchable$') dict['re'] = re.compile(dict['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("unloadFailing", True): diff --git a/pyload/plugins/internal/SimpleCrypter.py b/pyload/plugins/internal/SimpleCrypter.py index 6c5c9593f..634ec5f12 100644 --- a/pyload/plugins/internal/SimpleCrypter.py +++ b/pyload/plugins/internal/SimpleCrypter.py @@ -2,22 +2,28 @@ import re +from urlparse import urlparse + from pyload.plugins.Crypter import Crypter -from pyload.plugins.internal.SimpleHoster import PluginParseError, replace_patterns, set_cookies +from module.plugins.Plugin import Fail +from module.plugins.internal.SimpleHoster import _error, _wait, parseFileInfo, replace_patterns, set_cookies from pyload.utils import fixup, html_unescape class SimpleCrypter(Crypter): - __name__ = "SimpleCrypter" - __type__ = "crypter" - __version__ = "0.13" + __name__ = "SimpleCrypter" + __type__ = "crypter" + __version__ = "0.28" - __pattern__ = None + __pattern__ = r'^unmatchable$' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package'] + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Simple decrypter plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] """ @@ -26,8 +32,8 @@ class SimpleCrypter(Crypter): LINK_PATTERN: group(1) must be a download link or a regex to catch more links example: LINK_PATTERN = r'<div class="link"><a href="(.+?)"' - TITLE_PATTERN: (optional) group(1) should be the folder name or the webpage title - example: TITLE_PATTERN = r'<title>Files of: ([^<]+) folder</title>' + NAME_PATTERN: (optional) folder name or webpage title + example: NAME_PATTERN = r'<title>Files of: (?P<N>[^<]+) folder</title>' OFFLINE_PATTERN: (optional) Checks if the file is yet available online example: OFFLINE_PATTERN = r'File (deleted|not found)' @@ -46,87 +52,103 @@ class SimpleCrypter(Crypter): and its loadPage method: + def loadPage(self, page_n): return the html of the page number page_n """ - TITLE_REPLACEMENTS = [("&#?\w+;", fixup)] - URL_REPLACEMENTS = [] + LINK_PATTERN = None + + NAME_REPLACEMENTS = [("&#?\w+;", fixup)] + URL_REPLACEMENTS = [] TEXT_ENCODING = False #: Set to True or encoding name if encoding in http header is not correct - COOKIES = True #: or False or list of tuples [(domain, name, value)] + COOKIES = True #: or False or list of tuples [(domain, name, value)] LOGIN_ACCOUNT = False LOGIN_PREMIUM = False + #@TODO: remove in 0.4.10 + def init(self): + self.info = {} + + account_name = (self.__name__ + ".py").replace("Folder.py", "").replace(".py", "") + account = self.core.accountManager.getAccountPlugin(account_name) + + if account and account.canUse(): + self.user, data = account.selectAccount() + self.req = account.getAccountRequest(self.user) + self.premium = account.isPremium(self.user) + + self.account = account + + def prepare(self): if self.LOGIN_ACCOUNT and not self.account: - self.fail('Required account not found!') + self.fail(_("Required account not found")) if self.LOGIN_PREMIUM and not self.premium: - self.fail('Required premium account not found!') + self.fail(_("Required premium account not found")) if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) + self.pyfile.url = replace_patterns(self.pyfile.url, self.URL_REPLACEMENTS) - def decrypt(self, pyfile): - self.prepare() + if self.html is None: + self.html = self.load(self.pyfile.url, decode=not self.TEXT_ENCODING, cookies=bool(self.COOKIES)) - pyfile.url = replace_patterns(pyfile.url, self.URL_REPLACEMENTS) + if isinstance(self.TEXT_ENCODING, basestring): + self.html = unicode(self.html, self.TEXT_ENCODING) - self.html = self.load(pyfile.url, decode=not self.TEXT_ENCODING) - self.checkOnline() + def decrypt(self, pyfile): + self.prepare() - package_name, folder_name = self.getPackageNameAndFolder() + if self.html is None: + self.fail(_("No html retrieved")) - self.package_links = self.getLinks() + if not self.info: + self.getFileInfo() + + self.links = self.getLinks() if hasattr(self, 'PAGES_PATTERN') and hasattr(self, 'loadPage'): self.handleMultiPages() - self.logDebug("Package has %d links" % len(self.package_links)) + self.logDebug("Package has %d links" % len(self.links)) - if self.package_links: - self.packages = [(package_name, self.package_links, folder_name)] - else: - self.fail('Could not extract any links') + if self.links: + self.packages = [(self.info['name'], self.links, self.info['folder'])] - def getLinks(self): - """ - Returns the links extracted from self.html - You should override this only if it's impossible to extract links using only the LINK_PATTERN. - """ - return re.findall(self.LINK_PATTERN, self.html) + def getFileInfo(self): + name, size, status, url = parseFileInfo(self) + if name and name != url: + self.pyfile.name = name + else: + self.pyfile.name = self.info['name'] = urlparse(html_unescape(name)).path.split("/")[-1] - def checkOnline(self): - if hasattr(self, "OFFLINE_PATTERN") and re.search(self.OFFLINE_PATTERN, self.html): + if status is 1: self.offline() - elif hasattr(self, "TEMP_OFFLINE_PATTERN") and re.search(self.TEMP_OFFLINE_PATTERN, self.html): + + elif status is 6: self.tempOffline() + self.info['folder'] = self.pyfile.name - def getPackageNameAndFolder(self): - if hasattr(self, 'TITLE_PATTERN'): - try: - m = re.search(self.TITLE_PATTERN, self.html) - name = replace_patterns(m.group(1).strip(), self.TITLE_REPLACEMENTS) - folder = html_unescape(name) - except: - pass - else: - self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) - return name, folder + self.logDebug("FILE NAME: %s" % self.pyfile.name) + return self.info - name = self.pyfile.package().name - folder = self.pyfile.package().folder - self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) - return name, folder + def getLinks(self): + """ + Returns the links extracted from self.html + You should override this only if it's impossible to extract links using only the LINK_PATTERN. + """ + return re.findall(self.LINK_PATTERN, self.html) def handleMultiPages(self): @@ -138,8 +160,13 @@ class SimpleCrypter(Crypter): for p in xrange(2, pages + 1): self.html = self.loadPage(p) - self.package_links += self.getLinks() + self.links += self.getLinks() + + + #@TODO: Remove in 0.4.10 + def wait(self, seconds=0, reconnect=None): + return _wait(self, seconds, reconnect) - def parseError(self, msg): - raise PluginParseError(msg) + def error(self, reason="", type="parse"): + return _error(self, reason, type) diff --git a/pyload/plugins/internal/SimpleHoster.py b/pyload/plugins/internal/SimpleHoster.py index bc4cc3c88..b192b45b2 100644 --- a/pyload/plugins/internal/SimpleHoster.py +++ b/pyload/plugins/internal/SimpleHoster.py @@ -5,12 +5,34 @@ import re from time import time from urlparse import urlparse +from pycurl import FOLLOWLOCATION + from pyload.network.CookieJar import CookieJar from pyload.network.RequestFactory import getURL from pyload.plugins.base.Hoster import Hoster +from module.plugins.Plugin import Fail from pyload.utils import fixup, html_unescape, parseFileSize +#@TODO: Remove in 0.4.10 and redirect to self.error instead +def _error(self, reason, type): + if not reason and not type: + type = "unknown" + + msg = _("%s error") % type.strip().capitalize() if type else _("Error") + msg += ": " + reason.strip() if reason else "" + msg += _(" | Plugin may be out of date") + + raise Fail(msg) + + +#@TODO: Remove in 0.4.10 +def _wait(self, seconds, reconnect): + if seconds: + self.setWait(seconds, reconnect) + super(SimpleHoster, self).wait() + + def replace_patterns(string, ruleslist): for r in ruleslist: rf, rt = r @@ -46,7 +68,7 @@ def parseHtmlForm(attr_str, html, input_names=None): if isinstance(input_names, dict): # check input attributes - for key, val in input_names.items(): + for key, val in input_names.iteritems(): if key in inputs: if isinstance(val, basestring) and inputs[key] == val: continue @@ -66,28 +88,32 @@ def parseHtmlForm(attr_str, html, input_names=None): return {}, None # no matching form found -def parseFileInfo(self, url='', html=''): - info = {"name": url, "size": 0, "status": 3} - - if hasattr(self, "pyfile"): +def parseFileInfo(self, url="", html=""): + if not url and hasattr(self, "pyfile"): url = self.pyfile.url - if hasattr(self, "req") and self.req.http.code == '404': - info['status'] = 1 - else: - if not html and hasattr(self, "html"): + info = {'name': url, 'size': 0, 'status': 3} + + if not html: + if url: + return create_getInfo(self)([url]).next() + + elif hasattr(self, "req") and self.req.http.code == '404': + info['status'] = 1 + + elif hasattr(self, "html"): html = self.html - if isinstance(self.TEXT_ENCODING, basestring): - html = unicode(html, self.TEXT_ENCODING) - if hasattr(self, "html"): - self.html = html + if html: if hasattr(self, "OFFLINE_PATTERN") and re.search(self.OFFLINE_PATTERN, html): info['status'] = 1 + elif hasattr(self, "FILE_OFFLINE_PATTERN") and re.search(self.FILE_OFFLINE_PATTERN, html): #@TODO: Remove in 0.4.10 info['status'] = 1 + elif hasattr(self, "TEMP_OFFLINE_PATTERN") and re.search(self.TEMP_OFFLINE_PATTERN, html): info['status'] = 6 + else: online = False try: @@ -95,7 +121,8 @@ def parseFileInfo(self, url='', html=''): except: pass - for pattern in ("FILE_INFO_PATTERN", "FILE_NAME_PATTERN", "FILE_SIZE_PATTERN"): + for pattern in ("INFO_PATTERN", "NAME_PATTERN", "SIZE_PATTERN", + "FILE_INFO_PATTERN", "FILE_NAME_PATTERN", "FILE_SIZE_PATTERN"): #@TODO: Remove in 0.4.10 try: info.update(re.search(getattr(self, pattern), html).groupdict()) online = True @@ -105,18 +132,35 @@ def parseFileInfo(self, url='', html=''): if online: # File online, return name and size info['status'] = 2 + if 'N' in info: - info['name'] = replace_patterns(info['N'].strip(), self.FILE_NAME_REPLACEMENTS) + info['name'] = replace_patterns(info['N'].strip(), + self.FILE_NAME_REPLACEMENTS if hasattr(self, "FILE_NAME_REPLACEMENTS") else self.NAME_REPLACEMENTS) #@TODO: Remove FILE_NAME_REPLACEMENTS check in 0.4.10 + if 'S' in info: size = replace_patterns(info['S'] + info['U'] if 'U' in info else info['S'], - self.FILE_SIZE_REPLACEMENTS) + self.FILE_SIZE_REPLACEMENTS if hasattr(self, "FILE_SIZE_REPLACEMENTS") else self.SIZE_REPLACEMENTS) #@TODO: Remove FILE_SIZE_REPLACEMENTS check in 0.4.10 info['size'] = parseFileSize(size) + elif isinstance(info['size'], basestring): unit = info['units'] if 'units' in info else None info['size'] = parseFileSize(info['size'], unit) - if hasattr(self, "file_info"): - self.file_info = info + if hasattr(self, "html") and self.html is None: + self.html = html + + if hasattr(self, "info"): + try: + self.logDebug(_("File info (before update): %s") % self.info) + except: + pass + + self.info.update(info) + + try: + self.logDebug(_("File info (after update): %s") % self.info) + except: + pass return info['name'], info['size'], info['status'], url @@ -125,58 +169,63 @@ def create_getInfo(plugin): def getInfo(urls): for url in urls: - cj = CookieJar(plugin.__name__) - if isinstance(plugin.COOKIES, list): + if hasattr(plugin, "COOKIES") and isinstance(plugin.COOKIES, list): + cj = CookieJar(plugin.__name__) set_cookies(cj, plugin.COOKIES) - file_info = parseFileInfo(plugin, url, getURL(replace_patterns(url, plugin.FILE_URL_REPLACEMENTS), - decode=not plugin.TEXT_ENCODING, cookies=cj)) - yield file_info + else: + cj = None - return getInfo + if hasattr(plugin, "URL_REPLACEMENTS"): + url = replace_patterns(url, plugin.URL_REPLACEMENTS) + elif hasattr(plugin, "FILE_URL_REPLACEMENTS"): #@TODO: Remove in 0.4.10 + url = replace_patterns(url, plugin.FILE_URL_REPLACEMENTS) -def timestamp(): - return int(time() * 1000) + if hasattr(plugin, "TEXT_ENCODING"): + html = getURL(url, cookies=bool(cj), decode=not plugin.TEXT_ENCODING) + if isinstance(plugin.TEXT_ENCODING, basestring): + html = unicode(html, plugin.TEXT_ENCODING) + else: + html = getURL(url, cookies=bool(cj), decode=True) + yield parseFileInfo(plugin, url, html) -class PluginParseError(Exception): + return getInfo - def __init__(self, msg): - Exception.__init__(self) - self.value = 'Parse error (%s) - plugin may be out of date' % msg - def __str__(self): - return repr(self.value) +def timestamp(): + return int(time() * 1000) class SimpleHoster(Hoster): - __name__ = "SimpleHoster" - __type__ = "hoster" - __version__ = "0.38" + __name__ = "SimpleHoster" + __type__ = "hoster" + __version__ = "0.53" - __pattern__ = None + __pattern__ = r'^unmatchable$' __description__ = """Simple hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] """ Following patterns should be defined by each hoster: - FILE_INFO_PATTERN: Name and Size of the file - example: FILE_INFO_PATTERN = r'(?P<N>file_name) (?P<S>file_size) (?P<U>size_unit)' + INFO_PATTERN: (optional) Name and Size of the file + example: INFO_PATTERN = r'(?P<N>file_name) (?P<S>file_size) (?P<U>size_unit)' or - FILE_NAME_PATTERN: Name that will be set for the file - example: FILE_NAME_PATTERN = r'(?P<N>file_name)' - FILE_SIZE_PATTERN: Size that will be checked for the file - example: FILE_SIZE_PATTERN = r'(?P<S>file_size) (?P<U>size_unit)' + NAME_PATTERN: (optional) Name that will be set for the file + example: NAME_PATTERN = r'(?P<N>file_name)' + SIZE_PATTERN: (optional) Size that will be checked for the file + example: SIZE_PATTERN = r'(?P<S>file_size) (?P<U>size_unit)' - OFFLINE_PATTERN: Checks if the file is yet available online + OFFLINE_PATTERN: (optional) Checks if the file is yet available online example: OFFLINE_PATTERN = r'File (deleted|not found)' - TEMP_OFFLINE_PATTERN: Checks if the file is temporarily offline + TEMP_OFFLINE_PATTERN: (optional) Checks if the file is temporarily offline example: TEMP_OFFLINE_PATTERN = r'Server (maintenance|maintainance)' PREMIUM_ONLY_PATTERN: (optional) Checks if the file can be downloaded only with a premium account @@ -192,17 +241,17 @@ class SimpleHoster(Hoster): example: LINK_PREMIUM_PATTERN = r'<div class="link"><a href="(.+?)"' """ - FILE_NAME_REPLACEMENTS = [("&#?\w+;", fixup)] - FILE_SIZE_REPLACEMENTS = [] - FILE_URL_REPLACEMENTS = [] + NAME_REPLACEMENTS = [("&#?\w+;", fixup)] + SIZE_REPLACEMENTS = [] + URL_REPLACEMENTS = [] - TEXT_ENCODING = False #: Set to True or encoding name if encoding in http header is not correct - COOKIES = True #: or False or list of tuples [(domain, name, value)] + TEXT_ENCODING = False #: Set to True or encoding name if encoding in http header is not correct + COOKIES = True #: or False or list of tuples [(domain, name, value)] FORCE_CHECK_TRAFFIC = False #: Set to True to force checking traffic left for premium account def init(self): - self.file_info = {} + self.info = {} def setup(self): @@ -212,107 +261,139 @@ class SimpleHoster(Hoster): def prepare(self): if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) + self.req.setOption("timeout", 120) + self.pyfile.url = replace_patterns(self.pyfile.url, + self.FILE_URL_REPLACEMENTS if hasattr(self, "FILE_URL_REPLACEMENTS") else self.URL_REPLACEMENTS) #@TODO: Remove FILE_URL_REPLACEMENTS check in 0.4.10 + + if self.premium: + self.logDebug(_("Looking for direct download link...")) + direct_link = self.getDirectLink(self.pyfile.url) + if direct_link: + return direct_link + else: + self.logDebug(_("No direct download link found")) + self.html = None + self.info = {} + + if self.html is None: + self.html = self.load(self.pyfile.url, decode=not self.TEXT_ENCODING, cookies=bool(self.COOKIES)) + + if isinstance(self.TEXT_ENCODING, basestring): + self.html = unicode(self.html, self.TEXT_ENCODING) + def process(self, pyfile): - self.prepare() + direct_link = self.prepare() - pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS) + if isinstance(direct_link, basestring): + self.logInfo(_("Direct download link detected")) + self.download(direct_link, ref=True, cookies=True, disposition=True) - # Due to a 0.4.9 core bug self.load would keep previous cookies even if overridden by cookies parameter. - # Workaround using getURL. Can be reverted in 0.4.10 as the cookies bug has been fixed. - self.html = getURL(pyfile.url, decode=not self.TEXT_ENCODING, cookies=self.COOKIES) - premium_only = hasattr(self, 'PREMIUM_ONLY_PATTERN') and re.search(self.PREMIUM_ONLY_PATTERN, self.html) - if not premium_only: # Usually premium only pages doesn't show the file information - self.getFileInfo() + elif self.html is None: + self.fail(_("No html retrieved")) - if self.premium and (not self.FORCE_CHECK_TRAFFIC or self.checkTrafficLeft()): - self.handlePremium() - elif premium_only: - self.fail("This link require a premium account") else: - # This line is required due to the getURL workaround. Can be removed in 0.4.10 - self.html = self.load(pyfile.url, decode=not self.TEXT_ENCODING) - self.handleFree() + premium_only = hasattr(self, 'PREMIUM_ONLY_PATTERN') and re.search(self.PREMIUM_ONLY_PATTERN, self.html) + if not premium_only and not self.info: #: Usually premium only pages doesn't show any file information + self.getFileInfo() + + if self.premium and (not self.FORCE_CHECK_TRAFFIC or self.checkTrafficLeft()): + self.logDebug("Handle as premium download") + self.handlePremium() + elif premium_only: + self.fail(_("Link require a premium account to be handled")) + else: + self.logDebug("Handle as free download") + self.handleFree() + + + def getDirectLink(self, url): + self.req.http.c.setopt(FOLLOWLOCATION, 0) + + html = self.load(url, ref=True, decode=True) + + self.req.http.c.setopt(FOLLOWLOCATION, 1) + + if parseFileInfo(self, url, html)[2] is not 2: + try: + return re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I).group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 + except: + pass def getFileInfo(self): - self.logDebug("URL", self.pyfile.url) + name, size, status, url = parseFileInfo(self) - name, size, status = parseFileInfo(self)[:3] + if name and name != url: + self.pyfile.name = name + else: + self.pyfile.name = self.info['name'] = urlparse(html_unescape(name)).path.split("/")[-1] - if status == 1: + if status is 1: self.offline() - elif status == 6: + + elif status is 6: self.tempOffline() - elif status != 2: - self.logDebug(self.file_info) - self.parseError('File info') - if name: - self.pyfile.name = name - else: - self.pyfile.name = html_unescape(urlparse(self.pyfile.url).path.split("/")[-1]) + elif status is not 2: + self.error(_("File info: %s") % self.info) if size: self.pyfile.size = size else: self.logError(_("File size not parsed")) - self.logDebug("FILE NAME: %s FILE SIZE: %s" % (self.pyfile.name, self.pyfile.size)) - return self.file_info + self.logDebug("FILE NAME: %s" % self.pyfile.name, "FILE SIZE: %d" % self.pyfile.size or _("Unknown")) + return self.info def handleFree(self): if not hasattr(self, 'LINK_FREE_PATTERN'): - self.fail("Free download not implemented") + self.fail(_("Free download not implemented")) try: m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.parseError("Free download link not found") + self.error(_("Free download link not found")) link = m.group(1) except Exception, e: - self.logError(str(e)) + self.fail(str(e)) else: self.download(link, ref=True, cookies=True, disposition=True) def handlePremium(self): if not hasattr(self, 'LINK_PREMIUM_PATTERN'): - self.fail("Premium download not implemented") + self.fail(_("Premium download not implemented")) try: m = re.search(self.LINK_PREMIUM_PATTERN, self.html) if m is None: - self.parseError("Premium download link not found") + self.error(_("Premium download link not found")) link = m.group(1) except Exception, e: - self.logError(str(e)) + self.fail(str(e)) else: self.download(link, ref=True, cookies=True, disposition=True) - def parseError(self, msg): - raise PluginParseError(msg) - - def longWait(self, wait_time=None, max_tries=3): if wait_time and isinstance(wait_time, (int, long, float)): time_str = "%dh %dm" % divmod(wait_time / 60, 60) else: wait_time = 900 - time_str = "(unknown time)" + time_str = _("(unknown time)") max_tries = 100 self.logInfo(_("Download limit reached, reconnect or wait %s") % time_str) self.setWait(wait_time, True) self.wait() - self.retry(max_tries=max_tries, reason="Download limit reached") + self.retry(max_tries=max_tries, reason=_("Download limit reached")) def parseHtmlForm(self, attr_str='', input_names=None): @@ -321,15 +402,21 @@ class SimpleHoster(Hoster): def checkTrafficLeft(self): traffic = self.account.getAccountInfo(self.user, True)['trafficleft'] - if traffic == -1: + + if traffic is None: + return False + elif traffic == -1: return True - size = self.pyfile.size / 1024 - self.logInfo(_("Filesize: %i KiB, Traffic left for user %s: %i KiB") % (size, self.user, traffic)) - return size <= traffic + else: + size = self.pyfile.size / 1024 + self.logInfo(_("Filesize: %i KiB, Traffic left for user %s: %i KiB") % (size, self.user, traffic)) + return size <= traffic #@TODO: Remove in 0.4.10 - def wait(self, seconds=False, reconnect=False): - if seconds: - self.setWait(seconds, reconnect) - super(SimpleHoster, self).wait() + def wait(self, seconds=0, reconnect=None): + return _wait(self, seconds, reconnect) + + + def error(self, reason="", type="parse"): + return _error(self, reason, type) diff --git a/pyload/plugins/internal/UnRar.py b/pyload/plugins/internal/UnRar.py index df7557d0d..31a0d7642 100644 --- a/pyload/plugins/internal/UnRar.py +++ b/pyload/plugins/internal/UnRar.py @@ -21,19 +21,20 @@ def renice(pid, value): class UnRar(AbtractExtractor): - __name__ = "UnRar" + __name__ = "UnRar" __version__ = "0.18" __description__ = """Rar extractor plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] CMD = "unrar" # there are some more uncovered rar formats - re_version = re.compile(r"(UNRAR 5[\.\d]+(.*?)freeware)") + re_version = re.compile(r"(UNRAR 5[\d.]+(.*?)freeware)") re_splitfile = re.compile(r"(.*)\.part(\d+)\.rar$", re.I) - re_partfiles = re.compile(r".*\.(rar|r[0-9]+)", re.I) + re_partfiles = re.compile(r".*\.(rar|r\d+)", re.I) re_filelist = re.compile(r"(.+)\s+(\d+)\s+(\d+)\s+") re_filelist5 = re.compile(r"(.+)\s+(\d+)\s+\d\d-\d\d-\d\d\s+\d\d:\d\d\s+(.+)") re_wrongpwd = re.compile("(Corrupt file or wrong password|password incorrect)", re.I) @@ -167,9 +168,9 @@ class UnRar(AbtractExtractor): def getDeleteFiles(self): if ".part" in basename(self.file): - return glob(re.sub("(?<=\.part)([01]+)", "*", self.file, re.IGNORECASE)) + return glob(re.sub("(?<=\.part)([01]+)", "*", self.file, re.I)) # get files which matches .r* and filter unsuited files out - parts = glob(re.sub(r"(?<=\.r)ar$", "*", self.file, re.IGNORECASE)) + parts = glob(re.sub(r"(?<=\.r)ar$", "*", self.file, re.I)) return filter(lambda x: self.re_partfiles.match(x), parts) diff --git a/pyload/plugins/internal/UnZip.py b/pyload/plugins/internal/UnZip.py index 0fe50198f..413c0699e 100644 --- a/pyload/plugins/internal/UnZip.py +++ b/pyload/plugins/internal/UnZip.py @@ -7,17 +7,19 @@ from pyload.plugins.internal.AbstractExtractor import AbtractExtractor class UnZip(AbtractExtractor): - __name__ = "UnZip" + __name__ = "UnZip" __version__ = "0.1" __description__ = """Zip extractor plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] @staticmethod def checkDeps(): return sys.version_info[:2] >= (2, 6) + @staticmethod def getTargets(files_ids): result = [] @@ -28,10 +30,12 @@ class UnZip(AbtractExtractor): return result + def extract(self, progress, password=None): z = zipfile.ZipFile(self.file) self.files = z.namelist() z.extractall(self.out) + def getDeleteFiles(self): return [self.file] diff --git a/pyload/plugins/internal/UpdateManager.py b/pyload/plugins/internal/UpdateManager.py index f64a1e573..3f5b34c45 100644 --- a/pyload/plugins/internal/UpdateManager.py +++ b/pyload/plugins/internal/UpdateManager.py @@ -12,9 +12,9 @@ from pyload.utils import safe_join class UpdateManager(Addon): - __name__ = "UpdateManager" - __type__ = "addon" - __version__ = "0.36" + __name__ = "UpdateManager" + __type__ = "addon" + __version__ = "0.39" __config__ = [("activated", "bool", "Activated", True), ("mode", "pyLoad + plugins;plugins only", "Check updates for", "pyLoad + plugins"), @@ -23,15 +23,14 @@ class UpdateManager(Addon): ("nodebugupdate", "bool", "Don't check for updates in debug mode", True)] __description__ = """Check for updates""" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - event_list = ["pluginConfigChanged"] + # event_list = ["pluginConfigChanged"] SERVER_URL = "http://updatemanager.pyload.org" - MIRROR_URL = "" #: empty actually - - MIN_INTERVAL = 3 * 60 * 60 #: 3h minimum check interval (value is in seconds) + MIN_INTERVAL = 6 * 60 * 60 #: 6h minimum check interval (value is in seconds) def pluginConfigChanged(self, plugin, name, value): @@ -43,6 +42,7 @@ class UpdateManager(Addon): self.initPeriodical() else: self.logDebug("Invalid interval value, kept current") + elif name == "reloadplugins": if self.cb2: self.core.scheduler.removeJob(self.cb2) @@ -61,16 +61,17 @@ class UpdateManager(Addon): def setup(self): - self.cb2 = None + self.cb2 = None self.interval = self.MIN_INTERVAL self.updating = False - self.info = {'pyload': False, 'version': None, 'plugins': False} - self.mtimes = {} #: store modification time for each plugin + self.info = {'pyload': False, 'version': None, 'plugins': False} + self.mtimes = {} #: store modification time for each plugin def periodical2(self): if not self.updating: self.autoreloadPlugins() + self.cb2 = self.core.scheduler.addJob(4, self.periodical2, threaded=False) @@ -110,21 +111,18 @@ class UpdateManager(Addon): def server_request(self): - request = lambda x: getURL(x, get={'v': self.core.api.getServerVersion()}).splitlines() try: - return request(self.SERVER_URL) + return getURL(self.SERVER_URL, get={'v': self.core.api.getServerVersion()}).splitlines() except: - try: - return request(self.MIRROR_URL) - except: - pass - self.logWarning(_("Unable to contact server to get updates")) + self.logWarning(_("Unable to contact server to get updates")) @threaded def updateThread(self): self.updating = True + status = self.update(onlyplugin=self.getConfig("mode") == "plugins only") + if status == 2: self.core.api.restart() else: @@ -141,14 +139,18 @@ class UpdateManager(Addon): def update(self, onlyplugin=False): """ check for updates """ data = self.server_request() + if not data: exitcode = 0 + elif data[0] == "None": self.logInfo(_("No new pyLoad version available")) updates = data[1:] exitcode = self._updatePlugins(updates) + elif onlyplugin: exitcode = 0 + else: newversion = data[0] self.logInfo(_("*** New pyLoad Version %s available ***") % newversion) @@ -156,6 +158,7 @@ class UpdateManager(Addon): exitcode = 3 self.info['pyload'] = True self.info['version'] = newversion + return exitcode #: 0 = No plugins updated; 1 = Plugins updated; 2 = Plugins updated, but restart required; 3 = No plugins updated, new pyLoad version available @@ -165,11 +168,13 @@ class UpdateManager(Addon): if self.info['plugins']: return False #: plugins were already updated - updated = [] + exitcode = 0 + updated = [] - vre = re.compile(r'__version__.*=.*("|\')([0-9.]+)') + vre = re.compile(r'__version__.*=.*("|\')([\d.]+)') url = updates[0] schema = updates[1].split('|') + if "BLACKLIST" in updates: blacklist = updates[updates.index('BLACKLIST') + 1:] updates = updates[2:updates.index('BLACKLIST')] @@ -177,11 +182,13 @@ class UpdateManager(Addon): blacklist = None updates = updates[2:] - upgradable = sorted(map(lambda x: dict(zip(schema, x.split('|'))), updates), key=itemgetter("type", "name")) + upgradable = sorted(map(lambda x: dict(zip(schema, x.split('|'))), updates), + key=itemgetter("type", "name")) + for plugin in upgradable: filename = plugin['name'] - prefix = plugin['type'] - version = plugin['version'] + prefix = plugin['type'] + version = plugin['version'] if filename.endswith(".pyc"): name = filename[:filename.find("_")] @@ -200,22 +207,20 @@ class UpdateManager(Addon): newver = float(version) if not oldver: - msg = "New [%(type)s] %(name)s (v%(newver)s)" + msg = "New plugin: [%(type)s] %(name)s (v%(newver).2f)" elif newver > oldver: - msg = "New version of [%(type)s] %(name)s (v%(oldver)s -> v%(newver)s)" + msg = "New version of plugin: [%(type)s] %(name)s (v%(oldver).2f -> v%(newver).2f)" else: continue - self.logInfo(_(msg) % { - 'type': type, - 'name': name, - 'oldver': oldver, - 'newver': newver, - }) - + self.logInfo(_(msg) % {'type' : type, + 'name' : name, + 'oldver': oldver, + 'newver': newver}) try: content = getURL(url % plugin) m = vre.search(content) + if m and m.group(2) == version: f = open(safe_join("userplugins", prefix, filename), "wb") f.write(content) @@ -223,8 +228,9 @@ class UpdateManager(Addon): updated.append((prefix, name)) else: raise Exception, _("Version mismatch") + except Exception, e: - self.logError(_("Error updating plugin: %s") % filename, e) + self.logError(_("Error updating plugin %s") % filename, e) if blacklist: blacklisted = map(lambda x: (x.split('|')[0], x.split('|')[1].rsplit('.', 1)[0]), blacklist) @@ -253,7 +259,6 @@ class UpdateManager(Addon): exitcode = 2 else: self.logInfo(_("No plugin updates available")) - exitcode = 0 return exitcode #: 0 = No plugins updated; 1 = Plugins updated; 2 = Plugins updated, but restart required diff --git a/pyload/plugins/internal/XFSPHoster.py b/pyload/plugins/internal/XFSPHoster.py index ae8065732..c3f8b6f41 100644 --- a/pyload/plugins/internal/XFSPHoster.py +++ b/pyload/plugins/internal/XFSPHoster.py @@ -2,360 +2,53 @@ import re -from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME -from random import random -from urllib import unquote -from urlparse import urlparse +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -from pyload.network.RequestFactory import getURL -from pyload.plugins.internal.CaptchaService import ReCaptcha, SolveMedia -from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError, replace_patterns -from pyload.utils import html_unescape - -class XFSPHoster(SimpleHoster): - """ - Common base for XFileSharingPro hosters like EasybytezCom, CramitIn, FiledinoCom... - Some hosters may work straight away when added to __pattern__ - However, most of them will NOT work because they are either down or running a customized version - """ - __name__ = "XFSPHoster" - __type__ = "hoster" - __version__ = "0.37" +class XFileSharingPro(XFSHoster): + __name__ = "XFileSharingPro" + __type__ = "hoster" + __version__ = "0.42" __pattern__ = r'^unmatchable$' - __description__ = """XFileSharingPro base hoster plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] - + __description__ = """XFileSharingPro dummy hoster plugin for hook""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_NAME = None - FILE_URL_REPLACEMENTS = [(r'/embed-(\w{12}).*', r'/\1')] #: support embedded files + def _log(self, type, args): + msg = " | ".join([str(a).strip() for a in args if a]) + logger = getattr(self.log, type) + logger("%s: %s: %s" % (self.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper()))) - COOKIES = [(HOSTER_NAME, "lang", "english")] - FILE_INFO_PATTERN = r'<tr><td align=right><b>Filename:</b></td><td nowrap>(?P<N>[^<]+)</td></tr>\s*.*?<small>\((?P<S>[^<]+)\)</small>' - FILE_NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>[^"]+)"' - FILE_SIZE_PATTERN = r'You have requested .*\((?P<S>[\d\.\,]+) ?(?P<U>\w+)?\)</font>' + def init(self): + super(XFileSharingPro, self).init() - OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)' - TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)' + self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] - WAIT_PATTERN = r'<span id="countdown_str">.*?>(\d+)</span>' + self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group(1).lower() + self.HOSTER_NAME = "".join([str.capitalize() for str in self.HOSTER_DOMAIN.split('.')]) - OVR_LINK_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)' - LINK_PATTERN = None #: final download url pattern + account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) - CAPTCHA_URL_PATTERN = r'(http://[^"\']+?/captchas?/[^"\']+)' - CAPTCHA_DIV_PATTERN = r'>Enter code.*?<div.*?>(.+?)</div>' - RECAPTCHA_PATTERN = None - SOLVEMEDIA_PATTERN = None + if account and account.canUse(): + self.account = account + elif self.account: + self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + else: + return - ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.+?)</' + self.user, data = self.account.selectAccount() + self.req = self.account.getAccountRequest(self.user) + self.premium = self.account.isPremium(self.user) def setup(self): self.chunkLimit = 1 - - if self.__name__ == "XFSPHoster": - self.multiDL = True - self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] - self.HOSTER_NAME = re.match(self.__pattern__, self.pyfile.url).group(1).lower() - self.COOKIES = [(self.HOSTER_NAME, "lang", "english")] - else: - self.resumeDownload = self.multiDL = self.premium - - - def prepare(self): - """ Initialize important variables """ - if not self.HOSTER_NAME: - self.fail("Missing HOSTER_NAME") - - if not self.LINK_PATTERN: - pattr = r'(http://([^/]*?%s|\d+\.\d+\.\d+\.\d+)(:\d+)?(/d/|(?:/files)?/\d+/\w+/)[^"\'<]+)' - self.LINK_PATTERN = pattr % self.HOSTER_NAME - - if isinstance(self.COOKIES, list): - set_cookies(self.req.cj, self.COOKIES) - - self.captcha = None - self.errmsg = None - self.passwords = self.getPassword().splitlines() - - - def process(self, pyfile): - self.prepare() - - pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS) - - if not re.match(self.__pattern__, pyfile.url): - if self.premium: - self.handleOverriden() - else: - self.fail("Only premium users can download from other hosters with %s" % self.HOSTER_NAME) - else: - try: - # Due to a 0.4.9 core bug self.load would use cookies even if - # cookies=False. Workaround using getURL to avoid cookies. - # Can be reverted in 0.4.10 as the cookies bug has been fixed. - self.html = getURL(pyfile.url, decode=True, cookies=self.COOKIES) - self.file_info = self.getFileInfo() - except PluginParseError: - self.file_info = None - - self.location = self.getDirectDownloadLink() - - if not self.file_info: - pyfile.name = html_unescape(unquote(urlparse( - self.location if self.location else pyfile.url).path.split("/")[-1])) - - if self.location: - self.startDownload(self.location) - elif self.premium: - self.handlePremium() - else: - self.handleFree() - - - def getDirectDownloadLink(self): - """ Get download link for premium users with direct download enabled """ - self.req.http.lastURL = self.pyfile.url - - self.req.http.c.setopt(FOLLOWLOCATION, 0) - self.html = self.load(self.pyfile.url, decode=True) - self.header = self.req.http.header - self.req.http.c.setopt(FOLLOWLOCATION, 1) - - location = None - m = re.search(r"Location\s*:\s*(.*)", self.header, re.I) - if m and re.match(self.LINK_PATTERN, m.group(1)): - location = m.group(1).strip() - - return location - - - def handleFree(self): - url = self.getDownloadLink() - self.logDebug("Download URL: %s" % url) - self.startDownload(url) - - - def getDownloadLink(self): - for i in xrange(5): - self.logDebug("Getting download link: #%d" % i) - data = self.getPostParameters() - - self.req.http.c.setopt(FOLLOWLOCATION, 0) - self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True) - self.header = self.req.http.header - self.req.http.c.setopt(FOLLOWLOCATION, 1) - - m = re.search(r"Location\s*:\s*(.*)", self.header, re.I) - if m: - break - - m = re.search(self.LINK_PATTERN, self.html, re.S) - if m: - break - - else: - if self.errmsg and 'captcha' in self.errmsg: - self.fail("No valid captcha code entered") - else: - self.fail("Download link not found") - - return m.group(1) - - - def handlePremium(self): - self.html = self.load(self.pyfile.url, post=self.getPostParameters()) - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.parseError('LINK_PATTERN not found') - self.startDownload(m.group(1)) - - - def handleOverriden(self): - #only tested with easybytez.com - self.html = self.load("http://www.%s/" % self.HOSTER_NAME) - action, inputs = self.parseHtmlForm('') - upload_id = "%012d" % int(random() * 10 ** 12) - action += upload_id + "&js_on=1&utype=prem&upload_type=url" - inputs['tos'] = '1' - inputs['url_mass'] = self.pyfile.url - inputs['up1oad_type'] = 'url' - - self.logDebug(self.HOSTER_NAME, action, inputs) - #wait for file to upload to easybytez.com - self.req.http.c.setopt(LOW_SPEED_TIME, 600) - self.html = self.load(action, post=inputs) - - action, inputs = self.parseHtmlForm('F1') - if not inputs: - self.parseError('TEXTAREA not found') - self.logDebug(self.HOSTER_NAME, inputs) - if inputs['st'] == 'OK': - self.html = self.load(action, post=inputs) - elif inputs['st'] == 'Can not leech file': - self.retry(max_tries=20, wait_time=3 * 60, reason=inputs['st']) - else: - self.fail(inputs['st']) - - #get easybytez.com link for uploaded file - m = re.search(self.OVR_LINK_PATTERN, self.html) - if m is None: - self.parseError('OVR_LINK_PATTERN not found') - self.pyfile.url = m.group(1) - header = self.load(self.pyfile.url, just_header=True) - if 'location' in header: # Direct link - self.startDownload(self.pyfile.url) - else: - self.retry() - - - def startDownload(self, link): - link = link.strip() - if self.captcha: - self.correctCaptcha() - self.logDebug("DIRECT LINK: %s" % link) - self.download(link, disposition=True) - - - def checkErrors(self): - m = re.search(self.ERROR_PATTERN, self.html) - if m: - self.errmsg = m.group(1) - self.logWarning(re.sub(r"<.*?>", " ", self.errmsg)) - - if 'wait' in self.errmsg: - wait_time = sum([int(v) * {"hour": 3600, "minute": 60, "second": 1}[u] for v, u in - re.findall(r'(\d+)\s*(hour|minute|second)', self.errmsg)]) - self.wait(wait_time, True) - elif 'captcha' in self.errmsg: - self.invalidCaptcha() - elif 'premium' in self.errmsg and 'require' in self.errmsg: - self.fail("File can be downloaded by premium users only") - elif 'limit' in self.errmsg: - self.wait(1 * 60 * 60, True) - self.retry(25) - elif 'countdown' in self.errmsg or 'Expired' in self.errmsg: - self.retry() - elif 'maintenance' in self.errmsg or 'maintainance' in self.errmsg: - self.tempOffline() - elif 'download files up to' in self.errmsg: - self.fail("File too large for free download") - else: - self.fail(self.errmsg) - - else: - self.errmsg = None - - return self.errmsg - - - def getPostParameters(self): - for _ in xrange(3): - if not self.errmsg: - self.checkErrors() - - if hasattr(self, "FORM_PATTERN"): - action, inputs = self.parseHtmlForm(self.FORM_PATTERN) - else: - action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) - - if not inputs: - action, inputs = self.parseHtmlForm('F1') - if not inputs: - if self.errmsg: - self.retry() - else: - self.parseError("Form not found") - - self.logDebug(self.HOSTER_NAME, inputs) - - if 'op' in inputs and inputs['op'] in ("download2", "download3"): - if "password" in inputs: - if self.passwords: - inputs['password'] = self.passwords.pop(0) - else: - self.fail("No or invalid passport") - - if not self.premium: - m = re.search(self.WAIT_PATTERN, self.html) - if m: - wait_time = int(m.group(1)) + 1 - self.setWait(wait_time, False) - else: - wait_time = 0 - - self.captcha = self.handleCaptcha(inputs) - - if wait_time: - self.wait() - - self.errmsg = None - return inputs - - else: - inputs['referer'] = self.pyfile.url - - if self.premium: - inputs['method_premium'] = "Premium Download" - if 'method_free' in inputs: - del inputs['method_free'] - else: - inputs['method_free'] = "Free Download" - if 'method_premium' in inputs: - del inputs['method_premium'] - - self.html = self.load(self.pyfile.url, post=inputs, ref=True) - self.errmsg = None - - else: - self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN')) - - - def handleCaptcha(self, inputs): - m = re.search(self.CAPTCHA_URL_PATTERN, self.html) - if m: - captcha_url = m.group(1) - inputs['code'] = self.decryptCaptcha(captcha_url) - return 1 - - m = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.DOTALL) - if m: - captcha_div = m.group(1) - self.logDebug(captcha_div) - numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div)) - inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))]) - self.logDebug("CAPTCHA", inputs['code'], numerals) - return 2 - - recaptcha = ReCaptcha(self) - try: - captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1) - except: - captcha_key = recaptcha.detect_key() - - if captcha_key: - self.logDebug("RECAPTCHA KEY: %s" % captcha_key) - inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key) - return 3 - - solvemedia = SolveMedia(self) - try: - captcha_key = re.search(self.SOLVEMEDIA_PATTERN, self.html).group(1) - except: - captcha_key = solvemedia.detect_key() - - if captcha_key: - inputs['adcopy_challenge'], inputs['adcopy_response'] = solvemedia.challenge(captcha_key) - return 4 - - return 0 + self.resumeDownload = self.premium + self.multiDL = True -getInfo = create_getInfo(XFSPHoster) +getInfo = create_getInfo(XFileSharingPro) diff --git a/pyload/plugins/ocr/GigasizeCom.py b/pyload/plugins/ocr/GigasizeCom.py index 6fe6ffa2d..01b50be54 100644 --- a/pyload/plugins/ocr/GigasizeCom.py +++ b/pyload/plugins/ocr/GigasizeCom.py @@ -4,17 +4,19 @@ from pyload.plugins.base.OCR import OCR class GigasizeCom(OCR): - __name__ = "GigasizeCom" - __type__ = "ocr" + __name__ = "GigasizeCom" + __type__ = "ocr" __version__ = "0.1" __description__ = """Gigasize.com ocr plugin""" - __authors__ = [("pyLoad Team", "admin@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] def __init__(self): OCR.__init__(self) + def get_captcha(self, image): self.load_image(image) self.threshold(2.8) diff --git a/pyload/plugins/ocr/LinksaveIn.py b/pyload/plugins/ocr/LinksaveIn.py index 10f7354d9..1bde857be 100644 --- a/pyload/plugins/ocr/LinksaveIn.py +++ b/pyload/plugins/ocr/LinksaveIn.py @@ -13,18 +13,20 @@ from pyload.plugins.base.OCR import OCR class LinksaveIn(OCR): - __name__ = "LinksaveIn" - __type__ = "ocr" + __name__ = "LinksaveIn" + __type__ = "ocr" __version__ = "0.1" __description__ = """Linksave.in ocr plugin""" - __authors__ = [("pyLoad Team", "admin@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] def __init__(self): OCR.__init__(self) self.data_dir = dirname(abspath(__file__)) + sep + "LinksaveIn" + sep + def load_image(self, image): im = Image.open(image) frame_nr = 0 @@ -52,6 +54,7 @@ class LinksaveIn(OCR): self.pixels = self.image.load() self.result_captcha = '' + def get_bg(self): stat = {} cstat = {} @@ -82,12 +85,13 @@ class LinksaveIn(OCR): stat[bgpath] += 1 max_p = 0 bg = "" - for bgpath, value in stat.items(): + for bgpath, value in stat.iteritems(): if max_p < value: bg = bgpath max_p = value return bg + def substract_bg(self, bgpath): bg = Image.open(bgpath) img = self.image.convert("P") @@ -110,6 +114,7 @@ class LinksaveIn(OCR): if rgb_c == rgb_bg: orgpix[x, y] = (255,255,255) + def eval_black_white(self): new = Image.new("RGB", (140, 75)) pix = new.load() @@ -131,6 +136,7 @@ class LinksaveIn(OCR): self.image = new self.pixels = self.image.load() + def get_captcha(self, image): self.load_image(image) bg = self.get_bg() diff --git a/pyload/plugins/ocr/NetloadIn.py b/pyload/plugins/ocr/NetloadIn.py index 05798c14e..86916dd72 100644 --- a/pyload/plugins/ocr/NetloadIn.py +++ b/pyload/plugins/ocr/NetloadIn.py @@ -4,17 +4,19 @@ from pyload.plugins.base.OCR import OCR class NetloadIn(OCR): - __name__ = "NetloadIn" - __type__ = "ocr" + __name__ = "NetloadIn" + __type__ = "ocr" __version__ = "0.1" __description__ = """Netload.in ocr plugin""" - __authors__ = [("pyLoad Team", "admin@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] def __init__(self): OCR.__init__(self) + def get_captcha(self, image): self.load_image(image) self.to_greyscale() diff --git a/pyload/plugins/ocr/ShareonlineBiz.py b/pyload/plugins/ocr/ShareonlineBiz.py index 4839a3e0c..04ffeaf26 100644 --- a/pyload/plugins/ocr/ShareonlineBiz.py +++ b/pyload/plugins/ocr/ShareonlineBiz.py @@ -4,17 +4,19 @@ from pyload.plugins.base.OCR import OCR class ShareonlineBiz(OCR): - __name__ = "ShareonlineBiz" - __type__ = "ocr" + __name__ = "ShareonlineBiz" + __type__ = "ocr" __version__ = "0.1" __description__ = """Shareonline.biz ocr plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] def __init__(self): OCR.__init__(self) + def get_captcha(self, image): self.load_image(image) self.to_greyscale() |