diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/accounts/CramitIn.py | 12 | ||||
-rw-r--r-- | module/plugins/accounts/FastshareCz.py | 52 | ||||
-rw-r--r-- | module/plugins/accounts/FilebeerInfo.py | 57 | ||||
-rw-r--r-- | module/plugins/accounts/FilerioCom.py | 12 | ||||
-rw-r--r-- | module/plugins/accounts/QuickshareCz.py | 53 | ||||
-rw-r--r-- | module/plugins/accounts/RarefileNet.py | 12 | ||||
-rw-r--r-- | module/plugins/hoster/CramitIn.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/FastshareCz.py | 20 | ||||
-rw-r--r-- | module/plugins/hoster/FilebeerInfo.py | 46 | ||||
-rw-r--r-- | module/plugins/hoster/FilerioCom.py | 12 | ||||
-rw-r--r-- | module/plugins/hoster/QuickshareCz.py | 95 | ||||
-rw-r--r-- | module/plugins/hoster/RarefileNet.py | 6 |
12 files changed, 322 insertions, 59 deletions
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 <http://www.gnu.org/licenses/>. + + @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: </td><td>(.+?) ', 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 <http://www.gnu.org/licenses/>. + + @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</td>\s*<td>\s*(.*?)\s*</td>' + + def loadAccountInfo(self, user, req): + html = req.load("http://filebeer.info/upgrade.php", decode = True) + premium = 'Paid User </td>' 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 "<ul class='pageErrors'>" in html or ">Your username and password are invalid<" in html: + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/FilerioCom.py b/module/plugins/accounts/FilerioCom.py new file mode 100644 index 000000000..feacacaf5 --- /dev/null +++ b/module/plugins/accounts/FilerioCom.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class FilerioCom(XFSPAccount): + __name__ = "FilerioCom" + __version__ = "0.01" + __type__ = "account" + __description__ = """FileRio.in account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + MAIN_PAGE = "http://filerio.in/"
\ No newline at end of file diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py new file mode 100644 index 000000000..94649cc43 --- /dev/null +++ b/module/plugins/accounts/QuickshareCz.py @@ -0,0 +1,53 @@ +# -*- 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 <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +import re +from module.plugins.Account import Account +from module.utils import parseFileSize + +class QuickshareCz(Account): + __name__ = "QuickshareCz" + __version__ = "0.01" + __type__ = "account" + __description__ = """quickshare.cz account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + def loadAccountInfo(self, user, req): + html = req.load("http://www.quickshare.cz/premium", decode = True) + + found = re.search(r'Stav kreditu: <strong>(.+?)</strong>', 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.quickshare.cz/html/prihlaseni_process.php', post = { + "akce": u'Přihlásit', + "heslo": data['password'], + "jmeno": user + }, decode = True) + + if u'>Takový uživatel neexistuje.<' in html or u'>Špatné heslo.<' in html: + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/RarefileNet.py b/module/plugins/accounts/RarefileNet.py new file mode 100644 index 000000000..57f293c55 --- /dev/null +++ b/module/plugins/accounts/RarefileNet.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class RarefileNet(XFSPAccount): + __name__ = "RarefileNet" + __version__ = "0.01" + __type__ = "account" + __description__ = """RareFile.net account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + MAIN_PAGE = "http://rarefile.in/"
\ No newline at end of file diff --git a/module/plugins/hoster/CramitIn.py b/module/plugins/hoster/CramitIn.py index a7935c744..171fba0ff 100644 --- a/module/plugins/hoster/CramitIn.py +++ b/module/plugins/hoster/CramitIn.py @@ -5,7 +5,7 @@ class CramitIn(XFileSharingPro): __name__ = "CramitIn" __type__ = "hoster" __pattern__ = r"http://(?:\w*\.)*cramit.in/\w{12}" - __version__ = "0.03" + __version__ = "0.04" __description__ = """Cramit.in hoster plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") @@ -15,6 +15,6 @@ class CramitIn(XFileSharingPro): HOSTER_NAME = "cramit.in" def setup(self): - self.multiDL = self.premium + self.resumeDownload = self.multiDL = self.premium getInfo = create_getInfo(CramitIn)
\ No newline at end of file diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 654a1abe8..d71684166 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -23,7 +23,7 @@ class FastshareCz(SimpleHoster): __name__ = "FastshareCz" __type__ = "hoster" __pattern__ = r"http://(?:\w*\.)?fastshare.cz/\d+/.+" - __version__ = "0.12" + __version__ = "0.13" __description__ = """FastShare.cz""" __author_name__ = ("zoidberg") @@ -31,8 +31,11 @@ class FastshareCz(SimpleHoster): FILE_SIZE_PATTERN = r'<tr><td>Velikost: </td><td style=font-weight:bold>(?P<S>[^<]+)</td></tr>' FILE_OFFLINE_PATTERN = r'<div id="content">\s*<div style=background-color:white' SH_HTML_ENCODING = 'cp1250' + FILE_URL_REPLACEMENTS = [('#.*','')] FREE_URL_PATTERN = ur'<form method=post action=(/free/.*?)><b>Stáhnout FREE.*?<img src="([^"]*)">' + PREMIUM_URL_PATTERN = r'(http://data\d+\.fastshare\.cz/download\.php\?id=\d+\&[^\s\"\'<>]+)' + NOT_ENOUGH_CREDIC_PATTERN = "Nem.te dostate.n. kredit pro sta.en. tohoto souboru" def handleFree(self): found = re.search(self.FREE_URL_PATTERN, self.html) @@ -49,4 +52,19 @@ class FastshareCz(SimpleHoster): self.wait() self.retry() + def handlePremium(self): + if self.NOT_ENOUGH_CREDIC_PATTERN in self.html: + self.logWarning('Not enough traffic left') + self.resetAccount() + + found = re.search(self.PREMIUM_URL_PATTERN, self.html) + if not found: self.parseError("Premium URL") + url = found.group(1) + self.logDebug("PREMIUM URL: %s" % url) + self.download(url) + + check = self.checkDownload({"credit": re.compile(self.NOT_ENOUGH_CREDIC_PATTERN)}) + if check == "credit": + self.resetAccount() + getInfo = create_getInfo(FastshareCz)
\ No newline at end of file diff --git a/module/plugins/hoster/FilebeerInfo.py b/module/plugins/hoster/FilebeerInfo.py index d7d3640a8..a51f70a09 100644 --- a/module/plugins/hoster/FilebeerInfo.py +++ b/module/plugins/hoster/FilebeerInfo.py @@ -24,37 +24,42 @@ from pycurl import FOLLOWLOCATION class FilebeerInfo(SimpleHoster): __name__ = "FilebeerInfo" __type__ = "hoster" - __pattern__ = r"http://(?:www\.)?filebeer\.info/(?!\d*~f)\w+" - __version__ = "0.01" + __pattern__ = r"http://(?:www\.)?filebeer\.info/(?!\d*~f)(?P<ID>\w+).*" + __version__ = "0.02" __description__ = """Filebeer.info plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") + FILE_NAME_PATTERN = r'Filename:\s*</td>\s*<td>\s*(?P<N>.+?) ' + FILE_SIZE_PATTERN = r'Filesize:\s*</td>\s*<td>\s*(?P<S>[0-9.]+) (?P<U>[kKMG])i?B' FILE_INFO_PATTERN = r'<strong>\s*(?P<N>.+?) \((?P<S>[0-9.]+) (?P<U>[kKMG])i?B\)(<br/>\s*)?</strong>' FILE_OFFLINE_PATTERN = r'<title>Upload Files - FileBeer.info</title>' + FILE_URL_REPLACEMENTS = [(__pattern__, 'http://filebeer.info/\g<ID>~i')] + RECAPTCHA_KEY_PATTERN = r'http://www.google.com/recaptcha/api/(?:challenge|noscript)?k=(\w+)' - FREE_URL_PATTERN = r"<a href='(http://filebeer.info/.+?\?d=1)'>" + DOWNLOAD_URL_PATTERN = r"\[url\](.+?)\[/url\]" 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) + self.multiDL = self.premium + def handleFree(self): + url = self.getDownloadUrl() + + for i in range(5): + self.html = self.load(url) + if i == 4 or 'id="form-join"' in self.html: + break + else: + found = re.search(self.WAIT_TIME_PATTERN, self.html) + self.setWait(int(found.group(1)) +1 if found else 61) + self.wait() + action, inputs = self.parseHtmlForm('form-join') if not action: - self.retry(max_tries=5, wait_time=60, reason='Form not found') + self.fail('Form not found') found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) recaptcha_key = found.group(1) if found else '6LeuAc4SAAAAAOSry8eo2xW64K1sjHEKsQ5CaS10' @@ -83,6 +88,13 @@ class FilebeerInfo(SimpleHoster): self.multiDL = True self.req.http.lastURL = action - self.download(download_url) + self.download(download_url) + + def handlePremium(self): + self.download(self.getDownloadUrl()) + + def getDownloadUrl(self): + found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) + return ("%s?d=1" % found.group(1)) if found else ("http://filebeer.info/%s?d=1" % self.file_info['ID']) getInfo = create_getInfo(FilebeerInfo)
\ No newline at end of file diff --git a/module/plugins/hoster/FilerioCom.py b/module/plugins/hoster/FilerioCom.py index 3d983bedf..7be0fa4f6 100644 --- a/module/plugins/hoster/FilerioCom.py +++ b/module/plugins/hoster/FilerioCom.py @@ -4,17 +4,17 @@ from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInf class FilerioCom(XFileSharingPro): __name__ = "FilerioCom" __type__ = "hoster" - __pattern__ = r"http://(?:\w*\.)*file(rio|keen).com/\w{12}" - __version__ = "0.01" - __description__ = """FileRio.com hoster plugin""" + __pattern__ = r"http://(?:\w*\.)*(filerio\.(in|com)|filekeen\.com)/\w{12}" + __version__ = "0.02" + __description__ = """FileRio.in hoster plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") FILE_OFFLINE_PATTERN = '<b>"File Not Found"</b>|File has been removed due to Copyright Claim' - HOSTER_NAME = "filerio.com" - DIRECT_LINK_PATTERN = r'Download Link:.*?<a href="(.*?)"' + HOSTER_NAME = "filerio.in" + FILE_URL_REPLACEMENTS = [(r'http://.*?/','http://filerio.in/')] def setup(self): - self.multiDL = False + self.resumeDownload = self.multiDL = self.premium getInfo = create_getInfo(FilerioCom)
\ No newline at end of file diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index ef33d3263..4ea485672 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -18,51 +18,82 @@ import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pycurl import FOLLOWLOCATION class QuickshareCz(SimpleHoster): __name__ = "QuickshareCz" __type__ = "hoster" __pattern__ = r"http://.*quickshare.cz/stahnout-soubor/.*" - __version__ = "0.52" + __version__ = "0.53" __description__ = """Quickshare.cz""" __author_name__ = ("zoidberg") - VAR_PATTERN = r"var ID1 = '(?P<ID1>[^']+)';var ID2 = '(?P<ID2>[^']+)';var ID3 = '(?P<ID3>[^']+)';var ID4 = '(?P<ID4>[^']+)';var ID5 = '[^']*';var UU_prihlasen = '[^']*';var UU_kredit = [^;]*;var velikost = [^;]*;var kredit_odecet = [^;]*;var CaptchaText = '(?P<CaptchaText>[^']+)';var server = '(?P<Server>[^']+)';" - FILE_OFFLINE_PATTERN = r'<script type="text/javascript">location.href=\'/chyba\';</script>' 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>' - - def setup(self): - self.multiDL = False + FILE_OFFLINE_PATTERN = r'<script type="text/javascript">location.href=\'/chyba\';</script>' def process(self, pyfile): - self.html = self.load(pyfile.url, decode=True) + self.html = self.load(pyfile.url, decode = True) self.getFileInfo() - - # parse the name from the site and set attribute in pyfile - parsed_vars = re.search(self.VAR_PATTERN, self.html) - if parsed_vars is None: self.parseError("VARs") - pyfile.name = parsed_vars.group('ID3') - - # download the file, destination is determined by pyLoad - download_url = parsed_vars.group('Server') + "/download.php" - self.log.debug("File:" + pyfile.name) - self.log.debug("URL:" + download_url) - - self.download(download_url, post={ - "ID1": parsed_vars.group('ID1'), - "ID2": parsed_vars.group('ID2'), - "ID3": parsed_vars.group('ID3'), - "ID4": parsed_vars.group('ID4') - }) - - # check download - check = self.checkDownload({ - "no_slots": "obsazen na 100 %" - }) + # parse js variables + self.jsvars = dict((x, y.strip("'")) for x,y in re.findall(r"var (\w+) = ([0-9.]+|'[^']*')", self.html)) + self.logDebug(self.jsvars) + pyfile.name = self.jsvars['ID3'] + + # determine download type - free or premium + if self.premium: + if 'UU_prihlasen' in self.jsvars: + if self.jsvars['UU_prihlasen'] == '0': + self.logWarning('User not logged in') + self.relogin(user) + self.retry() + elif float(self.jsvars['UU_kredit']) < float(self.jsvars['kredit_odecet']): + self.logWarning('Not enough credit left') + self.premium = False + + if self.premium: + self.handlePremium() + else: + self.handleFree() + + check = self.checkDownload({"err": re.compile(r"\AChyba!")}, max_size=100) + if check == "err": + self.fail("File not found or plugin defect") + + def handleFree(self): + # get download url + download_url = '%s/download.php' % self.jsvars['server'] + data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ('ID1', 'ID2', 'ID3', 'ID4')) + self.logDebug("FREE URL1:" + download_url, data) + + self.req.http.c.setopt(FOLLOWLOCATION, 0) + self.load(download_url, post=data) + self.header = self.req.http.header + self.req.http.c.setopt(FOLLOWLOCATION, 1) + + found = re.search("Location\s*:\s*(.*)", self.header, re.I) + if not found: self.fail('File not found') + download_url = found.group(1) + self.logDebug("FREE URL2:" + download_url) + + # check errors + found = re.search(r'/chyba/(\d+)', download_url) + if found: + if found.group(1) == '1': + self.retry(max_tries=60, wait_time=120, reason="This IP is already downloading") + elif found.group(1) == '2': + self.retry(max_tries=60, wait_time=60, reason="No free slots available") + else: + self.fail('Error %d' % found.group(1)) - if check == "no_slots": - self.retry(5, 600, "No free slots") + # 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')) + self.logDebug("PREMIUM URL:" + download_url, data) + self.download(download_url, get=data) -create_getInfo(QuickshareCz)
\ No newline at end of file +getInfo = create_getInfo(QuickshareCz)
\ No newline at end of file diff --git a/module/plugins/hoster/RarefileNet.py b/module/plugins/hoster/RarefileNet.py index 8339d40eb..7c5543cc8 100644 --- a/module/plugins/hoster/RarefileNet.py +++ b/module/plugins/hoster/RarefileNet.py @@ -7,13 +7,17 @@ class RarefileNet(XFileSharingPro): __name__ = "RarefileNet" __type__ = "hoster" __pattern__ = r"http://(?:\w*\.)*rarefile.net/\w{12}" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Rarefile.net hoster plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") FILE_NAME_PATTERN = r'<td><font color="red">(?P<N>.*?)</font></td>' FILE_SIZE_PATTERN = r'<td>Size : (?P<S>.+?) ' + HOSTER_NAME = "rarefile.net" + + def setup(self): + self.resumeDownload = self.multiDL = self.premium def handleCaptcha(self, inputs): captcha_div = re.search(r'<b>Enter code.*?<div.*?>(.*?)</div>', self.html, re.S).group(1) |