From fd98148e8887cd08fd3eeab595efd988e66d04d4 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Wed, 19 Sep 2012 00:30:30 +0200 Subject: update hellshare/hellspy patterns --- module/plugins/hoster/HellshareCz.py | 6 +++--- module/plugins/hoster/HellspyCz.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'module') diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index 0add79ed9..9b50f55dc 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -26,14 +26,14 @@ class HellshareCz(SimpleHoster): __name__ = "HellshareCz" __type__ = "hoster" __pattern__ = r"(http://(?:.*\.)*hellshare\.(?:cz|com|sk|hu)/[^?]*/\d+).*" - __version__ = "0.77" + __version__ = "0.78" __description__ = """Hellshare.cz""" __author_name__ = ("zoidberg") FREE_URL_PATTERN = r']*action="(http://free\d*\.helldata[^"]*)"' PREMIUM_URL_PATTERN = r"launchFullDownload\('([^']*)'\);" - FILE_NAME_PATTERN = r'

(?P[^<]+)

' - FILE_SIZE_PATTERN = r'Size\s*(?P[0-9.]*) (?P[kKMG])i?B' + FILE_NAME_PATTERN = r'

]*>(?P[^<]+)

' + FILE_SIZE_PATTERN = r'(?P[0-9.]*) (?P[kKMG])i?B' FILE_OFFLINE_PATTERN = r'

File not found.

' CAPTCHA_PATTERN = r'' #FILE_CREDITS_PATTERN = r'(\d+) MB' diff --git a/module/plugins/hoster/HellspyCz.py b/module/plugins/hoster/HellspyCz.py index a03e2bf21..22838b481 100644 --- a/module/plugins/hoster/HellspyCz.py +++ b/module/plugins/hoster/HellspyCz.py @@ -23,12 +23,12 @@ class HellspyCz(SimpleHoster): __name__ = "HellspyCz" __type__ = "hoster" __pattern__ = r"http://(?:\w*\.)*hellspy\.(?:cz|com|sk|hu)(/\S+/\d+)/?.*" - __version__ = "0.24" + __version__ = "0.25" __description__ = """HellSpy.cz""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - FILE_INFO_PATTERN = '(?P[0-9.]+) (?P[kKMG])i?B\s*

(?P[^<]+)

' + FILE_INFO_PATTERN = '(?P[0-9.]+) (?P[kKMG])i?B\s*

(404 - Page|File) not found

' FILE_URL_REPLACEMENTS = [(r"http://(?:\w*\.)*hellspy\.(?:cz|com|sk|hu)(/\S+/\d+)/?.*", r"http://www.hellspy.com\1")] -- cgit v1.2.3 From b65c4091d5c5e793d8a9df17a46657d45c3a1292 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Mon, 24 Sep 2012 23:54:50 +0200 Subject: multihosters - closed #618, store http/ftp accounts, add uptobox.com premium --- module/plugins/accounts/Ftp.py | 13 ++++ module/plugins/accounts/Http.py | 13 ++++ module/plugins/accounts/UptoboxCom.py | 12 ++++ module/plugins/hooks/AlldebridCom.py | 17 +---- module/plugins/hooks/Checksum.py | 53 +++++++++++++--- module/plugins/hooks/EasybytezCom.py | 24 +++---- module/plugins/hooks/MultishareCz.py | 16 +---- module/plugins/hooks/Premium4Me.py | 15 +---- module/plugins/hooks/PremiumizeMe.py | 19 +----- module/plugins/hooks/RealdebridCom.py | 17 +---- module/plugins/hooks/RehostTo.py | 2 - module/plugins/hooks/ZeveraCom.py | 22 ++----- module/plugins/hoster/BasePlugin.py | 58 ++++++++++------- module/plugins/hoster/Ftp.py | 73 ++++++++++++++++++---- module/plugins/hoster/UptoboxCom.py | 20 ++++++ module/plugins/internal/MultiHoster.py | 111 +++++++++++++++++++++++---------- module/plugins/internal/XFSPAccount.py | 2 +- 17 files changed, 304 insertions(+), 183 deletions(-) create mode 100644 module/plugins/accounts/Ftp.py create mode 100644 module/plugins/accounts/Http.py create mode 100644 module/plugins/accounts/UptoboxCom.py create mode 100644 module/plugins/hoster/UptoboxCom.py (limited to 'module') diff --git a/module/plugins/accounts/Ftp.py b/module/plugins/accounts/Ftp.py new file mode 100644 index 000000000..9c1081662 --- /dev/null +++ b/module/plugins/accounts/Ftp.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account + +class Ftp(Account): + __name__ = "Ftp" + __version__ = "0.01" + __type__ = "account" + __description__ = """Ftp dummy account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + login_timeout = info_threshold = 1000000 \ No newline at end of file diff --git a/module/plugins/accounts/Http.py b/module/plugins/accounts/Http.py new file mode 100644 index 000000000..805d19900 --- /dev/null +++ b/module/plugins/accounts/Http.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account + +class Http(Account): + __name__ = "Http" + __version__ = "0.01" + __type__ = "account" + __description__ = """Http dummy account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + login_timeout = info_threshold = 1000000 \ No newline at end of file diff --git a/module/plugins/accounts/UptoboxCom.py b/module/plugins/accounts/UptoboxCom.py new file mode 100644 index 000000000..b07991817 --- /dev/null +++ b/module/plugins/accounts/UptoboxCom.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class UptoboxCom(XFSPAccount): + __name__ = "UptoboxCom" + __version__ = "0.01" + __type__ = "account" + __description__ = """DDLStorage.com account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + MAIN_PAGE = "http://uptobox.com/" \ No newline at end of file diff --git a/module/plugins/hooks/AlldebridCom.py b/module/plugins/hooks/AlldebridCom.py index f9657ed8c..91a0a6e5b 100644 --- a/module/plugins/hooks/AlldebridCom.py +++ b/module/plugins/hooks/AlldebridCom.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster class AlldebridCom(MultiHoster): __name__ = "AlldebridCom" - __version__ = "0.11" + __version__ = "0.12" __type__ = "hook" __config__ = [("activated", "bool", "Activated", "False"), @@ -19,21 +19,8 @@ class AlldebridCom(MultiHoster): __author_name__ = ("Andy, Voigt") __author_mail__ = ("spamsales@online.de") - replacements = [("freakshare.net", "freakshare.com")] - def getHoster(self): https = "https" if self.getConfig("https") else "http" page = getURL(https + "://www.alldebrid.com/api.php?action=get_host").replace("\"","").strip() - hosters = set([x.strip() for x in page.split(",") if x.strip()]) - - configMode = self.getConfig('hosterListMode') - if configMode in ("listed", "unlisted"): - configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) - configList.discard(u'') - if configMode == "listed": - hosters &= configList - else: - hosters -= configList - - return list(hosters) + return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index aec4bd0d7..b290838bb 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -19,7 +19,8 @@ from __future__ import with_statement import hashlib, zlib from os import remove -from os.path import getsize, isfile +from os.path import getsize, isfile, splitext +import re from module.utils import save_join, fs_encode from module.plugins.Hook import Hook @@ -50,7 +51,7 @@ def computeChecksum(local_file, algorithm): class Checksum(Hook): __name__ = "Checksum" - __version__ = "0.06" + __version__ = "0.07" __description__ = "Verify downloaded file size and checksum (enable in general preferences)" __config__ = [("activated", "bool", "Activated", True), ("action", "fail;retry;nothing", "What to do if check fails?", "retry"), @@ -58,12 +59,19 @@ class Checksum(Hook): __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") + methods = { 'sfv':'crc32', 'crc': 'crc32', 'hash': 'md5'} + regexps = { 'sfv': r'^(?P[^;].+)\s+(?P[0-9A-Fa-f]{8})$', + 'md5': r'^(?P[0-9A-Fa-f]{32}) (?P.+)$', + 'crc': r'filename=(?P.+)\nsize=(?P\d+)\ncrc32=(?P[0-9A-Fa-f]{8})$', + 'default': r'^(?P[0-9A-Fa-f]+)\s+\*?(?P.+)$' } + def setup(self): - self.algorithms = sorted(getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")), reverse = True) - self.algorithms.extend(["crc32", "adler32"]) - if not self.config['general']['checksum']: - self.logInfo("Checksum validation is disabled in general configuration") + self.logInfo("Checksum validation is disabled in general configuration") + + 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): """ @@ -127,4 +135,35 @@ class Checksum(Hook): elif action == "retry": if local_file: remove(local_file) - pyfile.plugin.retry(reason = msg, max_tries = self.getConfig("max_tries")) \ No newline at end of file + pyfile.plugin.retry(reason = msg, max_tries = self.getConfig("max_tries")) + + + def packageFinished(self, pypack): + download_folder = save_join(self.config['general']['download_folder'], pypack.folder, "") + + for link in pypack.getChildren().itervalues(): + file_type = splitext(link["name"])[1][1:].lower() + #self.logDebug(link, file_type) + + if file_type not in self.formats: + continue + + hash_file = fs_encode(save_join(download_folder, link["name"])) + if not isfile(hash_file): + self.logWarning("File not found: %s" % link["name"]) + continue + + with open(hash_file) as f: + text = f.read() + + for m in re.finditer(self.regexps.get(file_type, self.regexps['default']), text): + data = m.groupdict() + self.logDebug(link["name"], data) + + local_file = fs_encode(save_join(download_folder, data["name"])) + 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).' % (data["name"], algorithm, checksum)) + else: + self.logWarning("%s checksum for file %s does not match (%s != %s)" % (algorithm, data["name"], checksum, data["hash"])) \ No newline at end of file diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index 21a988555..22b9050b4 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -11,7 +11,7 @@ def getConfigSet(option): class EasybytezCom(MultiHoster): __name__ = "EasybytezCom" - __version__ = "0.02" + __version__ = "0.03" __type__ = "hook" __config__ = [("activated", "bool", "Activated", "False"), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), @@ -21,16 +21,16 @@ class EasybytezCom(MultiHoster): __author_mail__ = ("zoidberg@mujmail.cz") def getHoster(self): - - hoster = set(['2shared.com', 'easy-share.com', 'filefactory.com', 'fileserve.com', 'filesonic.com', 'hotfile.com', 'mediafire.com', 'megaupload.com', 'netload.in', 'rapidshare.com', 'uploading.com', 'wupload.com', 'oron.com', 'uploadstation.com', 'ul.to', 'uploaded.to']) + self.account = self.core.accountManager.getAccountPlugin(self.__name__) + user = self.account.selectAccount()[0] - configMode = self.getConfig('hosterListMode') - if configMode in ("listed", "unlisted"): - configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) - configList.discard(u'') - if configMode == "listed": - hoster &= configList - else: - hoster -= configList + try: + req = self.account.getAccountRequest(user) + page = req.load("http://www.easybytez.com") - return list(hoster) \ No newline at end of file + found = re.search(r'\s*Supported sites:(.*)', page) + return found.group(1).split(',') + except Exception, e: + self.logDebug(e) + self.logWarning("Unable to load supported hoster list, using last known") + return ['bitshare.com', 'crocko.com', 'ddlstorage.com', 'depositfiles.com', 'extabit.com', 'hotfile.com', 'mediafire.com', 'netload.in', 'rapidgator.net', 'rapidshare.com', 'uploading.com', 'uload.to', 'uploaded.to'] \ No newline at end of file diff --git a/module/plugins/hooks/MultishareCz.py b/module/plugins/hooks/MultishareCz.py index a00c6cb2b..f8fa9290a 100644 --- a/module/plugins/hooks/MultishareCz.py +++ b/module/plugins/hooks/MultishareCz.py @@ -11,7 +11,7 @@ def getConfigSet(option): class MultishareCz(MultiHoster): __name__ = "MultishareCz" - __version__ = "0.03" + __version__ = "0.04" __type__ = "hook" __config__ = [("activated", "bool", "Activated", "False"), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), @@ -20,21 +20,9 @@ class MultishareCz(MultiHoster): __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - replacements = [("share-rapid.cz", "sharerapid.com")] HOSTER_PATTERN = r']*?alt="([^"]+)">\s*[^>]*?alt="OK"' def getHoster(self): page = getURL("http://www.multishare.cz/monitoring/") - hosters = set(h.lower().strip() for h in re.findall(self.HOSTER_PATTERN, page)) - - configMode = self.getConfig('hosterListMode') - if configMode in ("listed", "unlisted"): - configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) - configList.discard(u'') - if configMode == "listed": - hosters &= configList - elif configMode == "unlisted": - hosters -= configList - - return list(hosters) \ No newline at end of file + return re.findall(self.HOSTER_PATTERN, page) \ No newline at end of file diff --git a/module/plugins/hooks/Premium4Me.py b/module/plugins/hooks/Premium4Me.py index fc3ce2343..b49eb41a9 100644 --- a/module/plugins/hooks/Premium4Me.py +++ b/module/plugins/hooks/Premium4Me.py @@ -15,23 +15,10 @@ class Premium4Me(MultiHoster): __author_name__ = ("RaNaN", "zoidberg") __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz") - replacements = [("freakshare.net", "freakshare.com")] - def getHoster(self): page = getURL("http://premium4.me/api/hosters.php?authcode=%s" % self.account.authcode) - hosters = set([x.strip() for x in page.replace("\"", "").split(";")]) - - configMode = self.getConfig('hosterListMode') - if configMode in ("listed", "unlisted"): - configList = set(self.getConfig('hosterList').strip().lower().replace(',','|').split('|')) - configList.discard(u'') - if configMode == "listed": - hosters &= configList - elif configMode == "unlisted": - hosters -= configList - - return list(hosters) + return [x.strip() for x in page.replace("\"", "").split(";")] def coreReady(self): diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py index 3825e9219..37905c23e 100644 --- a/module/plugins/hooks/PremiumizeMe.py +++ b/module/plugins/hooks/PremiumizeMe.py @@ -5,7 +5,7 @@ from module.network.RequestFactory import getURL class PremiumizeMe(MultiHoster): __name__ = "PremiumizeMe" - __version__ = "0.1" + __version__ = "0.11" __type__ = "hook" __description__ = """Premiumize.Me hook plugin""" @@ -16,8 +16,6 @@ class PremiumizeMe(MultiHoster): __author_name__ = ("Florian Franzen") __author_mail__ = ("FlorianFranzen@gmail.com") - replacements = [("freakshare.net", "freakshare.com")] - interval = 0 # Disable periodic calls, we dont use them anyway def getHoster(self): @@ -38,20 +36,7 @@ class PremiumizeMe(MultiHoster): return [] # Extract hosters from json file - hosters = set(data['result']['hosterlist']) - - - # Read config to check if certain hosters should not be handled - configMode = self.getConfig('hosterListMode') - if configMode in ("listed", "unlisted"): - configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) - configList.discard(u'') - if configMode == "listed": - hosters &= configList - else: - hosters -= configList - - return list(hosters) + return data['result']['hosterlist'] def coreReady(self): # Get account plugin and check if there is a valid account available diff --git a/module/plugins/hooks/RealdebridCom.py b/module/plugins/hooks/RealdebridCom.py index bd3179673..0f06d14bc 100644 --- a/module/plugins/hooks/RealdebridCom.py +++ b/module/plugins/hooks/RealdebridCom.py @@ -5,7 +5,7 @@ from module.plugins.internal.MultiHoster import MultiHoster class RealdebridCom(MultiHoster): __name__ = "RealdebridCom" - __version__ = "0.41" + __version__ = "0.42" __type__ = "hook" __config__ = [("activated", "bool", "Activated", "False"), @@ -16,21 +16,8 @@ class RealdebridCom(MultiHoster): __author_name__ = ("Devirex, Hazzard") __author_mail__ = ("naibaf_11@yahoo.de") - replacements = [("freakshare.net", "freakshare.com")] - def getHoster(self): https = "https" if self.getConfig("https") else "http" page = getURL(https + "://real-debrid.com/api/hosters.php").replace("\"","").strip() - hosters = set([x.strip() for x in page.split(",") if x.strip()]) - - configMode = self.getConfig('hosterListMode') - if configMode in ("listed", "unlisted"): - configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) - configList.discard(u'') - if configMode == "listed": - hosters &= configList - else: - hosters -= configList - - return list(hosters) + return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index b16987f5c..8903bd07f 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -14,8 +14,6 @@ class RehostTo(MultiHoster): __author_name__ = ("RaNaN") __author_mail__ = ("RaNaN@pyload.org") - replacements = [("freakshare.net", "freakshare.com")] - def getHoster(self): page = getURL("http://rehost.to/api.php?cmd=get_supported_och_dl&long_ses=%s" % self.long_ses) diff --git a/module/plugins/hooks/ZeveraCom.py b/module/plugins/hooks/ZeveraCom.py index 46c752c21..cadf60069 100644 --- a/module/plugins/hooks/ZeveraCom.py +++ b/module/plugins/hooks/ZeveraCom.py @@ -5,29 +5,15 @@ from module.plugins.internal.MultiHoster import MultiHoster class ZeveraCom(MultiHoster): __name__ = "ZeveraCom" - __version__ = "0.01" + __version__ = "0.02" __type__ = "hook" __config__ = [("activated", "bool", "Activated", "False"), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] __description__ = """Real-Debrid.com hook plugin""" - __author_name__ = ("Devirex, Hazzard") - __author_mail__ = ("naibaf_11@yahoo.de") - - replacements = [("freakshare.net", "freakshare.com"), ("2shared.com", "twoshared.com"), ("4shared.com", "fourshared.com"), - ("easy-share.com", "crocko.com"), ("hellshare.com", "hellshare.cz")] + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") def getHoster(self): page = getURL("http://www.zevera.com/jDownloader.ashx?cmd=gethosters") - hosters = set([x.strip() for x in page.replace("\"", "").split(",")]) - - configMode = self.getConfig('hosterListMode') - if configMode in ("listed", "unlisted"): - configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) - configList.discard(u'') - if configMode == "listed": - hosters &= configList - else: - hosters -= configList - - return list(hosters) \ No newline at end of file + return [x.strip() for x in page.replace("\"", "").split(",")] \ No newline at end of file diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 1ac33931f..14dfbba62 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -12,10 +12,10 @@ class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" __pattern__ = r"^unmatchable$" - __version__ = "0.151" + __version__ = "0.16" __description__ = """Base Plugin when any other didnt fit""" - __author_name__ = ("RaNaN", 'hagg') - __author_mail__ = ("RaNaN@pyload.org", '') + __author_name__ = ("RaNaN") + __author_mail__ = ("RaNaN@pyload.org") def setup(self): self.chunkLimit = -1 @@ -47,15 +47,22 @@ class BasePlugin(Hoster): except BadHeader, e: if e.code in (401, 403): self.logDebug("Auth required") - - pwd = pyfile.package().password.strip() - if ":" not in pwd: - self.fail(_("Authorization required (username:password)")) - - self.req.addAuth(pwd) + + servers = [ x['login'] for x in core.accountManager.getAccountPlugin('Http').getAllAccounts() ] + server = urlparse(pyfile.url).netloc + + if server in servers: + self.logDebug("Logging on to %s" % server) + self.req.addAuth(self.account.accounts[server]["password"]) + else: + for pwd in pyfile.package().password.splitlines() + if ":" in pwd: + self.req.addAuth(pwd.strip()) + break + else: + self.fail(_("Authorization required (username:password)")) + self.downloadFile(pyfile) - elif e.code == 404: - self.offline() else: raise @@ -64,18 +71,21 @@ class BasePlugin(Hoster): def downloadFile(self, pyfile): - header = self.load(pyfile.url, just_header = True) - #self.logDebug(header) - - # self.load does not raise a BadHeader on 404 responses, do it here - if header.has_key('code') and header['code'] == 404: - raise BadHeader(404) - - if 'location' in header: - self.logDebug("Location: " + header['location']) - url = unquote(header['location']) - else: - url = pyfile.url + url = pyfile.url + + for i in range(5): + header = self.load(pyfile.url, just_header = True) + + # self.load does not raise a BadHeader on 404 responses, do it here + if header.has_key('code') and header['code'] == 404: + raise BadHeader(404) + + if 'location' in header: + self.logDebug("Location: " + header['location']) + url = unquote(header['location']) + self.logDebug("URL: %s" % url, html_unescape(unquote(urlparse(url).path.split("/")[-1]))) + else: + break name = html_unescape(unquote(urlparse(url).path.split("/")[-1])) @@ -92,4 +102,4 @@ class BasePlugin(Hoster): if not name: name = url pyfile.name = name self.logDebug("Filename: %s" % pyfile.name) - self.download(url, disposition=True) + self.download(url, disposition=True) \ No newline at end of file diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 7c2af85ed..3bda3b32e 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -17,24 +17,75 @@ @author: jeix @author: mkaay """ +from urlparse import urlparse, urljoin +from urllib import quote, unquote +import pycurl, re from module.plugins.Hoster import Hoster - +from module.network.HTTPRequest import BadHeader class Ftp(Hoster): __name__ = "Ftp" - __version__ = "0.31" + __version__ = "0.41" __pattern__ = r'(ftps?|sftp)://(.*?:.*?@)?.*?/.*' # ftp://user:password@ftp.server.org/path/to/file __type__ = "hoster" __description__ = """A Plugin that allows you to download from an from an ftp directory""" - __author_name__ = ("jeix", "mkaay") - __author_mail__ = ("jeix@hasnomail.com", "mkaay@mkaay.de") + __author_name__ = ("jeix", "mkaay", "zoidberg") + __author_mail__ = ("jeix@hasnomail.com", "mkaay@mkaay.de", "zoidberg@mujmail.cz") - def process(self, pyfile): - pyfile.name = self.pyfile.url.rpartition('/')[2] - + def setup(self): self.chunkLimit = -1 - self.resumeDownload = True - - self.download(pyfile.url) - + self.resumeDownload = True + + def process(self, pyfile): + parsed_url = urlparse(pyfile.url) + netloc = parsed_url.netloc + + pyfile.name = parsed_url.path.rpartition('/')[2] + try: + pyfile.name = unquote(str(pyfile.name)).decode('utf8') + except: + pass + + if not "@" in netloc: + servers = [ x['login'] for x in self.account.getAllAccounts() ] if self.account else [] + + if netloc in servers: + self.logDebug("Logging on to %s" % netloc) + self.req.addAuth(self.account.accounts[netloc]["password"]) + else: + for pwd in pyfile.package().password.splitlines(): + if ":" in pwd: + self.req.addAuth(pwd.strip()) + break + + self.req.http.c.setopt(pycurl.NOBODY, 1) + + try: + response = self.load(pyfile.url) + except pycurl.error, e: + self.fail("Error %d: %s" % e.args) + + self.req.http.c.setopt(pycurl.NOBODY, 0) + self.logDebug(self.req.http.header) + + found = re.search(r"Content-Length:\s*(\d+)", response) + if found: + pyfile.size = int(found.group(1)) + self.download(pyfile.url) + else: + #Naive ftp directory listing + if re.search(r'^25\d.*?"', self.req.http.header, re.M): + pyfile.url = pyfile.url.rstrip('/') + pkgname = "/".join((pyfile.package().name,urlparse(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() ] + self.logDebug("LINKS", links) + self.core.api.addPackage(pkgname, links, 1) + #self.core.files.addLinks(links, pyfile.package().id) + else: + self.fail("Unexpected server response") + + \ No newline at end of file diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py new file mode 100644 index 000000000..ae2f14a14 --- /dev/null +++ b/module/plugins/hoster/UptoboxCom.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + +class UptoboxCom(XFileSharingPro): + __name__ = "UptoboxCom" + __type__ = "hoster" + __pattern__ = r"http://(?:\w*\.)*?uptobox.com/\w{12}" + __version__ = "0.06" + __description__ = """Uptobox.com hoster plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + FILE_INFO_PATTERN = r'

\s*Download File\s*]*>(?P[^>]+)

\s*[^\(]*\((?P[^\)]+)\)' + HOSTER_NAME = "uptobox.com" + + def setup(self): + self.resumeDownload = self.multiDL = self.premium + self.chunkLimit = 1 + +getInfo = create_getInfo(UptoboxCom) \ No newline at end of file diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index e9e321c06..0f25eb8d2 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -11,32 +11,54 @@ class MultiHoster(Hook): Generic MultiHoster plugin """ - __version__ = "0.12" + __version__ = "0.15" interval = 0 hosters = [] - replacements = [] + 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"), + ("ul.to","uploaded.to"), ("uploaded.net","uploaded.to")] supported = [] ignored = [] + new_supported = [] def getHosterCached(self): if not self.hosters: try: - self.hosters = [x.strip() for x in self.getHoster()] - self.hosters = filter(lambda x: x and x not in self.ignored, self.hosters) + hosterSet = self.toHosterSet(self.getHoster()) - set(self.ignored) except Exception, e: self.logError("%s" % str(e)) return [] - - for rep in self.replacements: - if rep[0] in self.hosters: - self.hosters.remove(rep[0]) - if rep[1] not in self.hosters: - self.hosters.append(rep[1]) + + try: + configMode = self.getConfig('hosterListMode') + if configMode in ("listed", "unlisted"): + configSet = self.toHosterSet(self.getConfig('hosterList').replace('|',',').replace(';',',').split(',')) + + if configMode == "listed": + hosterSet &= configSet + else: + hosterSet -= configSet + + except Exception, e: + self.logError("%s" % str(e)) + + self.hosters = list(hosterSet) return self.hosters - + + def toHosterSet(self, hosters): + hosters = set((x.strip().lower() for x in hosters)) + + for rep in self.replacements: + if rep[0] in hosters: + hosters.remove(rep[0]) + hosters.add(rep[1]) + + hosters.discard(u'') + return hosters def getHoster(self): """Load list of supported hoster @@ -49,23 +71,29 @@ class MultiHoster(Hook): pluginMap = {} for name in self.core.pluginManager.hosterPlugins.keys(): pluginMap[name.lower()] = name - - new_supported = [] + + accountList = [ name.lower() for name, data in self.core.accountManager.accounts.items() if data ] + excludedList = [] for hoster in self.getHosterCached(): name = remove_chars(hoster.lower(), "-.") - if name in pluginMap: - self.supported.append(pluginMap[name]) + if name in accountList: + excludedList.append(hoster) else: - new_supported.append(hoster) + if name in pluginMap: + self.supported.append(pluginMap[name]) + else: + self.new_supported.append(hoster) - if not self.supported and not new_supported: + if not self.supported and not self.new_supported: self.logError(_("No Hoster loaded")) return module = self.core.pluginManager.getPlugin(self.__name__) klass = getattr(module, self.__name__) + + print module, klass # inject plugin plugin self.logDebug("Overwritten Hosters: %s" % ", ".join(sorted(self.supported))) @@ -73,25 +101,42 @@ class MultiHoster(Hook): dict = self.core.pluginManager.hosterPlugins[hoster] dict["new_module"] = module dict["new_name"] = self.__name__ + + if excludedList: + self.logInfo("The following hosters were not overwritten - account exists: %s" % ", ".join(sorted(excludedList))) + + if self.new_supported: + self.logDebug("New Hosters: %s" % ", ".join(sorted(self.new_supported))) + + # create new regexp + if not klass.__pattern__: + regexp = r".*(%s).*" % "|".join([x.replace(".", "\\.") for x in new_supported]) + else: + regexp = r"%s|.*(%s).*" % ([klass.__pattern__], "|".join([x.replace(".", "\\.") for x in self.new_supported])) + self.logDebug("Regexp: %s" % regexp) + + dict = self.core.pluginManager.hosterPlugins[self.__name__] + dict["pattern"] = regexp + dict["re"] = re.compile(regexp) - self.logDebug("New Hosters: %s" % ", ".join(sorted(new_supported))) - - # create new regexp - if not klass.__pattern__: - regexp = r".*(%s).*" % "|".join([x.replace(".", "\\.") for x in new_supported]) - else: - regexp = r".*(%s).*" % "|".join([klass.__pattern__] + [x.replace(".", "\\.") for x in new_supported]) - dict = self.core.pluginManager.hosterPlugins[self.__name__] - dict["pattern"] = regexp - dict["re"] = re.compile(regexp) + def unloadHoster(self, hoster): + dict = self.core.pluginManager.hosterPlugins[hoster] + self.logDebug(dict) + if "module" in dict: + del dict["module"] + if "new_module" in dict: + del dict["new_module"] + del dict["new_name"] def unload(self): for hoster in self.supported: - dict = self.core.pluginManager.hosterPlugins[hoster] - if "module" in dict: - del dict["module"] - - del dict["new_module"] - del dict["new_name"] + self.unloadHoster(hoster) + + def downloadFailed(self, pyfile): + hdict = self.core.pluginManager.hosterPlugins[pyfile.pluginname] + self.logDebug("Unload MultiHoster", pyfile.pluginname, hdict) + if "new_name" in hdict and hdict['new_name'] == self.__name__: + self.unloadHoster(pyfile.pluginname) + pyfile.setStatus("queued") \ No newline at end of file diff --git a/module/plugins/internal/XFSPAccount.py b/module/plugins/internal/XFSPAccount.py index ad25ad2c8..8333c7265 100644 --- a/module/plugins/internal/XFSPAccount.py +++ b/module/plugins/internal/XFSPAccount.py @@ -33,7 +33,7 @@ class XFSPAccount(Account): MAIN_PAGE = None - VALID_UNTIL_PATTERN = r'>Premium account expire:([^<]+)' + VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:([^<]+)' TRAFFIC_LEFT_PATTERN = r'>Traffic available today:([^<]+)' def loadAccountInfo(self, user, req): -- cgit v1.2.3 From 233bf90feb2941ecacee56966fdee2cd2f65d7b2 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Tue, 25 Sep 2012 19:07:51 +0200 Subject: small plugin fixes --- module/plugins/hooks/EasybytezCom.py | 5 ----- module/plugins/hooks/MultishareCz.py | 5 ----- module/plugins/hoster/BasePlugin.py | 5 ++--- module/plugins/hoster/CzshareCom.py | 4 ++-- module/plugins/hoster/HellshareCz.py | 4 ++-- module/plugins/hoster/RyushareCom.py | 4 ++-- module/plugins/hoster/UptoboxCom.py | 1 + module/plugins/internal/MultiHoster.py | 14 ++++++++------ 8 files changed, 17 insertions(+), 25 deletions(-) (limited to 'module') diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index 22b9050b4..6a4ded85b 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -4,11 +4,6 @@ from module.network.RequestFactory import getURL from module.plugins.internal.MultiHoster import MultiHoster import re -def getConfigSet(option): - s = set(option.lower().replace(',','|').split('|')) - s.discard(u'') - return s - class EasybytezCom(MultiHoster): __name__ = "EasybytezCom" __version__ = "0.03" diff --git a/module/plugins/hooks/MultishareCz.py b/module/plugins/hooks/MultishareCz.py index f8fa9290a..7e5a3e007 100644 --- a/module/plugins/hooks/MultishareCz.py +++ b/module/plugins/hooks/MultishareCz.py @@ -4,11 +4,6 @@ from module.network.RequestFactory import getURL from module.plugins.internal.MultiHoster import MultiHoster import re -def getConfigSet(option): - s = set(option.lower().split('|')) - s.discard(u'') - return s - class MultishareCz(MultiHoster): __name__ = "MultishareCz" __version__ = "0.04" diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 14dfbba62..7d6990c8b 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -55,7 +55,7 @@ class BasePlugin(Hoster): self.logDebug("Logging on to %s" % server) self.req.addAuth(self.account.accounts[server]["password"]) else: - for pwd in pyfile.package().password.splitlines() + for pwd in pyfile.package().password.splitlines(): if ":" in pwd: self.req.addAuth(pwd.strip()) break @@ -74,7 +74,7 @@ class BasePlugin(Hoster): url = pyfile.url for i in range(5): - header = self.load(pyfile.url, just_header = True) + header = self.load(url, just_header = True) # self.load does not raise a BadHeader on 404 responses, do it here if header.has_key('code') and header['code'] == 404: @@ -83,7 +83,6 @@ class BasePlugin(Hoster): if 'location' in header: self.logDebug("Location: " + header['location']) url = unquote(header['location']) - self.logDebug("URL: %s" % url, html_unescape(unquote(urlparse(url).path.split("/")[-1]))) else: break diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 538e3ed86..356771ce4 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -17,7 +17,7 @@ """ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo +from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo, PluginParseError from module.network.RequestFactory import getURL def toInfoPage(url): @@ -45,7 +45,7 @@ class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" __pattern__ = r"http://(\w*\.)*czshare\.(com|cz)/(\d+/|download.php\?).*" - __version__ = "0.88" + __version__ = "0.89" __description__ = """CZshare.com""" __author_name__ = ("zoidberg") diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index 9b50f55dc..9130cd797 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -25,8 +25,8 @@ from module.network.RequestFactory import getURL class HellshareCz(SimpleHoster): __name__ = "HellshareCz" __type__ = "hoster" - __pattern__ = r"(http://(?:.*\.)*hellshare\.(?:cz|com|sk|hu)/[^?]*/\d+).*" - __version__ = "0.78" + __pattern__ = r"(http://(?:.*\.)*hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+).*" + __version__ = "0.79" __description__ = """Hellshare.cz""" __author_name__ = ("zoidberg") diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py index b3d7bafc6..9bbbdcb91 100644 --- a/module/plugins/hoster/RyushareCom.py +++ b/module/plugins/hoster/RyushareCom.py @@ -4,8 +4,8 @@ from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInf class RyushareCom(XFileSharingPro): __name__ = "RyushareCom" __type__ = "hoster" - __pattern__ = r"http://(?:\w*\.)*?ryushare.com/\w{12}" - __version__ = "0.02" + __pattern__ = r"http://(?:\w*\.)*?ryushare.com/\w{11,}" + __version__ = "0.03" __description__ = """ryushare.com hoster plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py index ae2f14a14..60a93c1e5 100644 --- a/module/plugins/hoster/UptoboxCom.py +++ b/module/plugins/hoster/UptoboxCom.py @@ -11,6 +11,7 @@ class UptoboxCom(XFileSharingPro): __author_mail__ = ("zoidberg@mujmail.cz") FILE_INFO_PATTERN = r'

\s*Download File\s*]*>(?P[^>]+)

\s*[^\(]*\((?P[^\)]+)\)' + FILE_OFFLINE_PATTERN = r'
File Not Found
' HOSTER_NAME = "uptobox.com" def setup(self): diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index 0f25eb8d2..044bc3423 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -14,14 +14,16 @@ class MultiHoster(Hook): __version__ = "0.15" interval = 0 - hosters = [] 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"), + ("hellshare.com", "hellshare.cz"), ("share-rapid.cz","sharerapid.com"), ("sharerapid.cz","sharerapid.com"), ("ul.to","uploaded.to"), ("uploaded.net","uploaded.to")] - supported = [] ignored = [] - new_supported = [] + + def setup(self): + self.hosters = [] + self.supported = [] + self.new_supported = [] def getHosterCached(self): if not self.hosters: @@ -74,7 +76,7 @@ class MultiHoster(Hook): accountList = [ name.lower() for name, data in self.core.accountManager.accounts.items() if data ] excludedList = [] - + for hoster in self.getHosterCached(): name = remove_chars(hoster.lower(), "-.") @@ -112,7 +114,7 @@ class MultiHoster(Hook): if not klass.__pattern__: regexp = r".*(%s).*" % "|".join([x.replace(".", "\\.") for x in new_supported]) else: - regexp = r"%s|.*(%s).*" % ([klass.__pattern__], "|".join([x.replace(".", "\\.") for x in self.new_supported])) + regexp = r"%s|.*(%s).*" % (klass.__pattern__, "|".join([x.replace(".", "\\.") for x in self.new_supported])) self.logDebug("Regexp: %s" % regexp) dict = self.core.pluginManager.hosterPlugins[self.__name__] -- cgit v1.2.3 From fc3d05bfc4f026efbdc0e9299a2fcbb463397f78 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Tue, 25 Sep 2012 23:21:23 +0200 Subject: filebeer.info (free only) - closed #687 --- module/plugins/hoster/FilebeerInfo.py | 88 +++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 module/plugins/hoster/FilebeerInfo.py (limited to 'module') diff --git a/module/plugins/hoster/FilebeerInfo.py b/module/plugins/hoster/FilebeerInfo.py new file mode 100644 index 000000000..d7d3640a8 --- /dev/null +++ b/module/plugins/hoster/FilebeerInfo.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: zoidberg +""" + +import re +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.ReCaptcha import ReCaptcha +from pycurl import FOLLOWLOCATION + +class FilebeerInfo(SimpleHoster): + __name__ = "FilebeerInfo" + __type__ = "hoster" + __pattern__ = r"http://(?:www\.)?filebeer\.info/(?!\d*~f)\w+" + __version__ = "0.01" + __description__ = """Filebeer.info plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + FILE_INFO_PATTERN = r'\s*(?P.+?) \((?P[0-9.]+) (?P[kKMG])i?B\)(
\s*)?
' + FILE_OFFLINE_PATTERN = r'Upload Files - FileBeer.info' + + RECAPTCHA_KEY_PATTERN = r'http://www.google.com/recaptcha/api/(?:challenge|noscript)?k=(\w+)' + FREE_URL_PATTERN = r"" + WAIT_TIME_PATTERN = r"\(\'\.download-timer-seconds\'\)\.html\((\d+)\)" + + def setup(self): + self.resumeDownload = True + self.multiDL = False + + def handleFree(self): + if not 'id="form-join"' in self.html: + found = re.search(self.FREE_URL_PATTERN, self.html) + url = found.group(1) if found else "%s?d=1" % self.pyfile.url.rstrip('/') + + found = re.search(self.WAIT_TIME_PATTERN, self.html) + self.setWait(int(found.group(1)) if found else 60) + self.wait() + + self.html = self.load(url) + + action, inputs = self.parseHtmlForm('form-join') + if not action: + self.retry(max_tries=5, wait_time=60, reason='Form not found') + + found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) + recaptcha_key = found.group(1) if found else '6LeuAc4SAAAAAOSry8eo2xW64K1sjHEKsQ5CaS10' + + recaptcha = ReCaptcha(self) + for i in range(5): + inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(recaptcha_key) + + self.req.http.c.setopt(FOLLOWLOCATION, 0) + self.html = self.load(action, post = inputs) + self.header = self.req.http.header + self.req.http.c.setopt(FOLLOWLOCATION, 1) + + found = re.search("Location\s*:\s*(.*)", self.header, re.I) + if found: + download_url = found.group(1).strip() + self.correctCaptcha() + break + elif 'Captcha confirmation text is invalid' in self.html: + self.invalidCaptcha() + else: + self.parseError('download url') + + else: self.fail("No valid captcha solution received") + + self.multiDL = True + + self.req.http.lastURL = action + self.download(download_url) + +getInfo = create_getInfo(FilebeerInfo) \ No newline at end of file -- cgit v1.2.3 From df0b35be0bc0e2b13be8c6787bbce03082f0e08e Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Thu, 27 Sep 2012 20:28:32 +0200 Subject: add filebeer.info/fastshare.cz/quickshare.cz premium, closed #688 --- module/plugins/accounts/CramitIn.py | 12 +++++ module/plugins/accounts/FastshareCz.py | 52 ++++++++++++++++++ module/plugins/accounts/FilebeerInfo.py | 57 ++++++++++++++++++++ module/plugins/accounts/FilerioCom.py | 12 +++++ module/plugins/accounts/QuickshareCz.py | 53 ++++++++++++++++++ module/plugins/accounts/RarefileNet.py | 12 +++++ module/plugins/hoster/CramitIn.py | 4 +- module/plugins/hoster/FastshareCz.py | 20 ++++++- module/plugins/hoster/FilebeerInfo.py | 46 ++++++++++------ module/plugins/hoster/FilerioCom.py | 12 ++--- module/plugins/hoster/QuickshareCz.py | 95 ++++++++++++++++++++++----------- module/plugins/hoster/RarefileNet.py | 6 ++- 12 files changed, 322 insertions(+), 59 deletions(-) create mode 100644 module/plugins/accounts/CramitIn.py create mode 100644 module/plugins/accounts/FastshareCz.py create mode 100644 module/plugins/accounts/FilebeerInfo.py create mode 100644 module/plugins/accounts/FilerioCom.py create mode 100644 module/plugins/accounts/QuickshareCz.py create mode 100644 module/plugins/accounts/RarefileNet.py (limited to 'module') diff --git a/module/plugins/accounts/CramitIn.py b/module/plugins/accounts/CramitIn.py new file mode 100644 index 000000000..182c9d647 --- /dev/null +++ b/module/plugins/accounts/CramitIn.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class CramitIn(XFSPAccount): + __name__ = "CramitIn" + __version__ = "0.01" + __type__ = "account" + __description__ = """cramit.in account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + MAIN_PAGE = "http://cramit.in/" \ No newline at end of file diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py new file mode 100644 index 000000000..333ee3761 --- /dev/null +++ b/module/plugins/accounts/FastshareCz.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: zoidberg +""" + +import re +from module.plugins.Account import Account +from module.utils import parseFileSize + +class FastshareCz(Account): + __name__ = "FastshareCz" + __version__ = "0.01" + __type__ = "account" + __description__ = """fastshare.cz account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + def loadAccountInfo(self, user, req): + html = req.load("http://www.fastshare.cz/user", decode = True) + + found = re.search(r'Kredit: (.+?) ', html) + if found: + trafficleft = parseFileSize(found.group(1)) / 1024 + premium = True if trafficleft else False + else: + trafficleft = None + premium = False + + return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium} + + def login(self, user, data, req): + 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: + self.wrongPassword() \ No newline at end of file diff --git a/module/plugins/accounts/FilebeerInfo.py b/module/plugins/accounts/FilebeerInfo.py new file mode 100644 index 000000000..9cfdb867c --- /dev/null +++ b/module/plugins/accounts/FilebeerInfo.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: zoidberg +""" + +import re +from time import mktime, strptime +from module.plugins.Account import Account +from module.utils import parseFileSize + +class FilebeerInfo(Account): + __name__ = "FilebeerInfo" + __version__ = "0.01" + __type__ = "account" + __description__ = """filebeer.info account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + VALID_UNTIL_PATTERN = r'Reverts To Free Account:\s\s*\s*(.*?)\s*' + + def loadAccountInfo(self, user, req): + html = req.load("http://filebeer.info/upgrade.php", decode = True) + premium = 'Paid User ' in html + + validuntil = None + if premium: + try: + validuntil = mktime(strptime(re.search(self.VALID_UNTIL_PATTERN, html).group(1), "%d/%m/%Y %H:%M:%S")) + except Exception, e: + self.logError(e) + + return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} + + def login(self, user, data, req): + html = req.load('http://filebeer.info/login.php', post = { + "submit": 'Login', + "loginPassword": data['password'], + "loginUsername": user, + "submitme": '1' + }, decode = True) + + if "