diff options
Diffstat (limited to 'module/plugins/internal')
-rw-r--r-- | module/plugins/internal/SimpleCrypter.py | 16 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 10 | ||||
-rw-r--r-- | module/plugins/internal/XFSPAccount.py | 21 | ||||
-rw-r--r-- | module/plugins/internal/XFSPCrypter.py | 28 | ||||
-rw-r--r-- | module/plugins/internal/XFSPHoster.py | 3 |
5 files changed, 67 insertions, 11 deletions
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 8139d661d..3c1dc3244 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -10,7 +10,7 @@ from module.utils import fixup, html_unescape class SimpleCrypter(Crypter): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.13" + __version__ = "0.15" __pattern__ = None @@ -51,6 +51,8 @@ class SimpleCrypter(Crypter): return the html of the page number page_n """ + LINK_PATTERN = None + TITLE_REPLACEMENTS = [("&#?\w+;", fixup)] URL_REPLACEMENTS = [] @@ -61,6 +63,18 @@ class SimpleCrypter(Crypter): LOGIN_PREMIUM = False + def init(self): + 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!') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 895584af6..c2bc4909e 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -166,18 +166,18 @@ class SimpleHoster(Hoster): """ Following patterns should be defined by each hoster: - FILE_INFO_PATTERN: Name and Size of the file + FILE_INFO_PATTERN: (optional) Name and Size of the file example: FILE_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 + FILE_NAME_PATTERN: (optional) 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 + FILE_SIZE_PATTERN: (optional) Size that will be checked for the file example: FILE_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 diff --git a/module/plugins/internal/XFSPAccount.py b/module/plugins/internal/XFSPAccount.py index f75422ca1..713bf827d 100644 --- a/module/plugins/internal/XFSPAccount.py +++ b/module/plugins/internal/XFSPAccount.py @@ -13,7 +13,7 @@ from module.utils import parseFileSize class XFSPAccount(Account): __name__ = "XFSPAccount" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __description__ = """XFileSharingPro account plugin""" __license__ = "GPLv3" @@ -21,9 +21,19 @@ class XFSPAccount(Account): ("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_URL = None + """ + Following patterns should be defined by each hoster: - COOKIES = None #: or list of tuples [(domain, name, value)] + HOSTER_URL: (optional) + example: HOSTER_URL = r'linestorage.com' + + PREMIUM_PATTERN: (optional) Checks if the account is premium + example: PREMIUM_PATTERN = r'>Renew premium<' + """ + + HOSTER_NAME = None + + COOKIES = [(HOSTER_NAME, "lang", "english")] #: or list of tuples [(domain, name, value)] VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:.*?<b>(.+?)</b>' @@ -32,7 +42,10 @@ class XFSPAccount(Account): LOGIN_FAIL_PATTERN = r'>(Incorrect Login or Password|Error<)' - # PREMIUM_PATTERN = r'>Renew premium<' + + def init(self): + if not hasattr(self, "HOSTER_URL"): + self.HOSTER_URL = "http://%s/" % self.HOSTER_NAME def loadAccountInfo(self, user, req): diff --git a/module/plugins/internal/XFSPCrypter.py b/module/plugins/internal/XFSPCrypter.py new file mode 100644 index 000000000..372657d2d --- /dev/null +++ b/module/plugins/internal/XFSPCrypter.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleCrypter import SimpleCrypter + + +class XFSPCrypter(SimpleCrypter): + __name__ = "XFSPCrypter" + __type__ = "crypter" + __version__ = "0.02" + + __pattern__ = None + + __description__ = """XFileSharingPro decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_NAME = None + + URL_REPLACEMENTS = [(r'[?/&]+$', r''), (r'(.+/[^?]*)$', r'\1?'), (r'$', r'&per_page=10000')] + + COOKIES = [(HOSTER_NAME, "lang", "english")] + + LINK_PATTERN = r'<(?:td|TD) [^>]*>\s*<a href="(.+?)"[^>]*>.+?(?:</a>)?\s*</(?:td|TD)>' + TITLE_PATTERN = r'<[tT]itle>.*?\: (.+) folder</[tT]itle>' + + OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)' + TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)' diff --git a/module/plugins/internal/XFSPHoster.py b/module/plugins/internal/XFSPHoster.py index f1a250f85..abf71b033 100644 --- a/module/plugins/internal/XFSPHoster.py +++ b/module/plugins/internal/XFSPHoster.py @@ -330,7 +330,7 @@ class XFSPHoster(SimpleHoster): captcha_key = recaptcha.detect_key() if captcha_key: - self.logDebug("RECAPTCHA KEY: %s" % captcha_key) + self.logDebug("ReCaptcha key: %s" % captcha_key) inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key) return 3 @@ -341,6 +341,7 @@ class XFSPHoster(SimpleHoster): captcha_key = solvemedia.detect_key() if captcha_key: + self.logDebug("SolveMedia key: %s" % captcha_key) inputs['adcopy_challenge'], inputs['adcopy_response'] = solvemedia.challenge(captcha_key) return 4 |