diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2011-09-27 11:04:57 +0200 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2011-09-27 11:04:57 +0200 |
commit | a159147ae67249279677d51ff348c0c7c70f0b1d (patch) | |
tree | 5fbbf2b7ebcb6e435a35b1488a0173beb39ab577 /module | |
parent | plugins: czshare premium, czshare/quickshare/filefactory folders (diff) | |
download | pyload-a159147ae67249279677d51ff348c0c7c70f0b1d.tar.xz |
plugins: fix czshare premium, add ifolder.ru, share-rapid.com by MikyWoW
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/accounts/HellspyCz.py | 39 | ||||
-rw-r--r-- | module/plugins/accounts/ShareRapidCom.py | 36 | ||||
-rw-r--r-- | module/plugins/hoster/CzshareCom.py | 20 | ||||
-rw-r--r-- | module/plugins/hoster/DataportCz.py | 9 | ||||
-rw-r--r-- | module/plugins/hoster/EuroshareEu.py | 9 | ||||
-rw-r--r-- | module/plugins/hoster/FreevideoCz.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/IfolderRu.py | 113 | ||||
-rw-r--r-- | module/plugins/hoster/QuickshareCz.py | 5 | ||||
-rw-r--r-- | module/plugins/hoster/ShareRapidCom.py | 36 | ||||
-rw-r--r-- | module/plugins/hoster/StreamCz.py | 2 |
10 files changed, 227 insertions, 44 deletions
diff --git a/module/plugins/accounts/HellspyCz.py b/module/plugins/accounts/HellspyCz.py index 10c7e3882..c07fd748a 100644 --- a/module/plugins/accounts/HellspyCz.py +++ b/module/plugins/accounts/HellspyCz.py @@ -13,7 +13,7 @@ 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 """ @@ -28,55 +28,52 @@ class HellspyCz(Account): __description__ = """hellspy.cz account plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - + ACTION_PATTERN = r'<div id="snippet--loginBoxSn"><form[^>]*action="([^"]+user_hash=([^"]+))">' CREDIT_LEFT_PATTERN = r'<strong class="text-credits">(\d+)</strong>' WRONG_PASSWORD_PATTERN = r'<p class="block-error-3 marg-tb-050">\s*Wrong user or password was entered<br />' - phpsessid = '' + phpsessid = '' def loadAccountInfo(self, user, req): cj = self.getAccountCookies(user) - cj.setCookie(".hellspy.com", "PHPSESSID", self.phpsessid) - + cj.setCookie(".hellspy.com", "PHPSESSID", self.phpsessid) + html = req.load("http://www.hellspy.com/") - + found = re.search(self.CREDIT_LEFT_PATTERN, html) if found is None: credits = 0 else: credits = int(found.group(1)) * 1024 - + return {"validuntil": -1, "trafficleft": credits} - - def login(self, user, data,req): + + def login(self, user, data,req): html = req.load('http://www.hellspy.com/') found = re.search(self.ACTION_PATTERN, html) if found is None: - self.logError('Parse error (FORM)') + self.logError('Parse error (FORM)') action, self.phpsessid = found.group(1).replace('&','&'), found.group(2) - + self.logDebug("PHPSESSID:" + self.phpsessid) html = req.load("http://www.hellspy.com/--%s-" % self.phpsessid) - + html = req.load(action, post={ "login": "1", "password": data["password"], "username": user, "redir_url": 'http://www.hellspy.com/?do=loginBox-login', "permanent_login": "1" - }) - + }) + cj = self.getAccountCookies(user) cj.setCookie(".hellspy.com", "PHPSESSID", self.phpsessid) - + self.logDebug(req.lastURL) self.logDebug(req.lastEffectiveURL) - - html = req.load("http://www.hellspy.com/", get = {"do":"loginBox-login"}) - - if not re.search(self.CREDIT_LEFT_PATTERN, html): - self.wrongPassword() + html = req.load("http://www.hellspy.com/", get = {"do":"loginBox-login"}) -
\ No newline at end of file + if not re.search(self.CREDIT_LEFT_PATTERN, html): + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/ShareRapidCom.py b/module/plugins/accounts/ShareRapidCom.py new file mode 100644 index 000000000..9828b1f7e --- /dev/null +++ b/module/plugins/accounts/ShareRapidCom.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +import re +from module.plugins.Account import Account + +class ShareRapidCom(Account): + __name__ = "ShareRapidCom" + __version__ = "0.1" + __type__ = "account" + __description__ = """ShareRapid account plugin""" + __author_name__ = ("MikyWoW") + + def loadAccountInfo(self, user, req): + src = req.load("http://share-rapid.com/mujucet/", cookies=True) + if "Kredit:" in src: + start = src.index('Kredit:</td><td>') + src = src[start+16:] + start = src.index('GB') + kredit = src[0:start-1] + ret = float(kredit)*1024*1024 + tmp = {"premium": True, "trafficleft": ret, "validuntil": -1} + else: + tmp = {"premium": False, "trafficleft": None, "validuntil": None} + return tmp + + def login(self, user, data, req): + htm = req.load("http://share-rapid.com/prihlaseni/", cookies=True) + if "Heslo:" in htm: + start = htm.index('id="inp_hash" name="hash" value="') + htm = htm[start+33:] + hashes = htm[0:32] + html = req.load("http://share-rapid.com/prihlaseni/", + post={"hash": hashes,"login": user, "pass1": data["password"],"remember": 0, + "sbmt": "P%C5%99ihl%C3%A1sit"}, cookies=True) + if "Heslo:" in html: + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index f6cbb200a..140aa9569 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -63,7 +63,7 @@ class CzshareCom(Hoster): __name__ = "CzshareCom" __type__ = "hoster" __pattern__ = r"http://(\w*\.)*czshare\.(com|cz)/(\d+/|download.php\?).*" - __version__ = "0.8" + __version__ = "0.8a" __description__ = """CZshare.com""" __author_name__ = ("zoidberg") @@ -85,12 +85,7 @@ class CzshareCom(Hoster): def process(self, pyfile): self.getFileInfo(pyfile) - if self.premium and self.account is not None: - for i in range(2): - if self.handlePremium(pyfile): break - else: - self.resetAccount() - else: + if not self.account or not self.handlePremium(pyfile): self.handleFree(pyfile) self.checkDownloadedFile() @@ -120,13 +115,18 @@ class CzshareCom(Hoster): size = float(found.group(1).replace(',','.').replace(' ','')) pyfile.size = size * 1024 ** {'KiB': 1, 'MiB': 2, 'GiB': 3}[found.group(2)] + pyfile.url = url + def handlePremium(self, pyfile): - # check user credit + # check if user logged in found = re.search(self.USER_CREDIT_PATTERN, self.html) - if found is None: + if not found: self.account.relogin(self.user) - return False + self.html = self.load(pyfile.url, cookies=True, decode=True) + found = re.search(self.USER_CREDIT_PATTERN, self.html) + if not found: return False + # check user credit try: credit = float(found.group(1).replace(',','.').replace(' ','')) credit = credit * 1024 ** {'KB': 0, 'MB': 1, 'GB': 2}[found.group(2)] diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index ea1ed1282..896c4b47a 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -24,6 +24,7 @@ def getInfo(urls): result = [] for url in urls: + html = getURL(url, decode=True) if re.search(DataportCz.FILE_OFFLINE_PATTERN, html): # File offline @@ -36,12 +37,11 @@ def getInfo(urls): result.append((name, 0, 2, url)) yield result - class DataportCz(Hoster): __name__ = "DataportCz" __type__ = "hoster" __pattern__ = r"http://.*dataport.cz/file/.*" - __version__ = "0.3" + __version__ = "0.3a" __description__ = """dataport.cz""" __author_name__ = ("zoidberg") @@ -54,6 +54,7 @@ class DataportCz(Hoster): self.multiDL = False def process(self, pyfile): + self.html = self.load(pyfile.url, decode=True) if re.search(self.FILE_OFFLINE_PATTERN, self.html): @@ -62,7 +63,7 @@ class DataportCz(Hoster): if re.search(self.NO_SLOTS_PATTERN, self.html): self.setWait(900, True) self.wait() - self.retry() + self.retry(12, 0, "No free slots") found = re.search(self.FILE_NAME_PATTERN, self.html) if found is None: @@ -74,4 +75,4 @@ class DataportCz(Hoster): self.fail("Parse error (URL)") download_url = found.group(1) - self.download(download_url) + self.download(download_url)
\ No newline at end of file diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 1cb58bc3f..a0bfe0ab2 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -24,6 +24,7 @@ def getInfo(urls): result = [] for url in urls: + html = getURL(url, decode=True) if re.search(EuroshareEu.FILE_OFFLINE_PATTERN, html): # File offline @@ -32,17 +33,16 @@ def getInfo(urls): result.append((url, 0, 2, url)) yield result - class EuroshareEu(Hoster): __name__ = "EuroshareEu" __type__ = "hoster" __pattern__ = r"http://(\w*\.)?euroshare.eu/file/.*" - __version__ = "0.2" + __version__ = "0.2b" __description__ = """Euroshare.eu""" __author_name__ = ("zoidberg") URL_PATTERN = r'<a class="free" href="([^"]+)"></a>' - FILE_OFFLINE_PATTERN = r'<h2>S�bor sa nena.iel</h2>' + FILE_OFFLINE_PATTERN = r'<h2>S.bor sa nena.iel</h2>' ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>' def setup(self): @@ -67,5 +67,4 @@ class EuroshareEu(Hoster): def waitForFreeSlot(self): self.setWait(300, True) self.wait() - self.retry() -
\ No newline at end of file + self.retry()
\ No newline at end of file diff --git a/module/plugins/hoster/FreevideoCz.py b/module/plugins/hoster/FreevideoCz.py index 20ff674aa..dfa0eb01e 100644 --- a/module/plugins/hoster/FreevideoCz.py +++ b/module/plugins/hoster/FreevideoCz.py @@ -42,7 +42,7 @@ class FreevideoCz(Hoster): __author_name__ = ("zoidberg") URL_PATTERN = r'clip: {\s*url: "([^"]+)"' - FILE_OFFLINE_PATTERN = r'<h2 class="red-corner-full">Stránka nebyla nalezena</h2>' + FILE_OFFLINE_PATTERN = r'<h2 class="red-corner-full">Str.nka nebyla nalezena</h2>' def setup(self): self.multiDL = True diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py new file mode 100644 index 000000000..8675dbdc4 --- /dev/null +++ b/module/plugins/hoster/IfolderRu.py @@ -0,0 +1,113 @@ +# -*- 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 urllib import quote +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): + result = [] + + for url in urls: + + html = getURL(url, decode=True) + if re.search(IfolderRu.FILE_OFFLINE_PATTERN, html): + # File offline + result.append((url, 0, 1, url)) + else: + # Get file info + found = re.search(IfolderRu.FILE_INFO_PATTERN, html) + if found is not None: + name = found.group(1) + size = float(found.group(2)) * 1024 ** {u'Кб': 1, u'Мб': 2, u'Гб': 3}[found.group(3)] + result.append((name, size, 2, url)) + yield result + +class IfolderRu(Hoster): + __name__ = "IfolderRu" + __type__ = "hoster" + __pattern__ = r"http://(?:\w*\.)?ifolder.ru/(\d+)/?" + __version__ = "0.2" + __description__ = """ifolder.ru""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + + FILE_INFO_PATTERN = ur'<div><span>Название:</span> <b>([^<]+)</b></div>\s*<div><span>Размер:</span> <b>([0-9.]+) ([^<]+)</b></div>' + SESSION_ID_PATTERN = r'<a href=(http://ints.ifolder.ru/ints/sponsor/\?bi=\d*&session=([^&]+)&u=[^>]+)>' + FORM1_PATTERN = r'<form method=post name="form1" ID="Form1" style="margin-bottom:200px">(.*?)</form>' + FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>' + INTS_SESSION_PATTERN = r'\(\'ints_session\'\);\s*if\(tag\)\{tag.value = "([^"]+)";\}' + HIDDEN_INPUT_PATTERN = r"var s= 'hh([^']*)';" + DOWNLOAD_LINK_PATTERN = r'<a id="download_file_href" href="([^"]+)"' + WRONG_CAPTCHA_PATTERN = ur'<font color=Red>неверный код,<br>введите еще раз</font><br>' + FILE_OFFLINE_PATTERN = ur'<p>Файл номер <b>[^<]*</b> не найден !!!</p>' + + def setup(self): + self.resumeDownload = self.multiDL = True if self.account else False + self.chunkLimit = 1 + + def process(self, pyfile): + self.html = self.load(pyfile.url, cookies=True, decode=True) + if re.search(self.FILE_OFFLINE_PATTERN, self.html): self.offline() + + found = re.search(self.FILE_INFO_PATTERN, self.html) + pyfile.name = found.group(1) + pyfile.size = float(found.group(2)) * 1024 ** {u'Кб': 1, u'Мб': 2, u'Гб': 3}[found.group(3)] + file_id = re.search(self.__pattern__, pyfile.url).group(1) + + url = "http://ints.ifolder.ru/ints/?ifolder.ru/%s?ints_code=" % file_id + self.html = self.load(url, cookies=True, decode=True) + + url, session_id = re.search(self.SESSION_ID_PATTERN, self.html).groups() + self.html = self.load(url, cookies=True, decode=True) + + url = "http://ints.ifolder.ru/ints/frame/?session=%s" % session_id + self.html = self.load(url, cookies=True) + + self.setWait(31, False) + self.wait() + + captcha_url = "http://ints.ifolder.ru/random/images/?session=%s" % session_id + for i in range(5): + self.html = self.load(url, cookies=True) + + inputs = {} + form = re.search(self.FORM1_PATTERN, self.html, re.DOTALL).group(1) + inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) + inputs['ints_session'] = re.search(self.INTS_SESSION_PATTERN, form).group(1) + inputs['Submit1'] = u"Подтвердить".encode("utf-8") + inputs[re.search(self.HIDDEN_INPUT_PATTERN, form).group(1)] = '1' + inputs['confirmed_number'] = self.decryptCaptcha(captcha_url, cookies = True) + self.logDebug(inputs) + + self.html = self.load(url, decode = True, cookies = True, post = inputs) + if self.WRONG_CAPTCHA_PATTERN in self.html: + self.invalidCaptcha() + else: + break; + else: + self.fail("Invalid captcha") + + self.html = self.load("http://ifolder.ru/%s?ints_code=%s" % (file_id, session_id), decode=True, cookies = True) + + download_url = re.search(self.DOWNLOAD_LINK_PATTERN, self.html).group(1) + self.correctCaptcha() + self.logDebug("Download URL: %s" % download_url) + self.download(download_url)
\ No newline at end of file diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index fe8d6febe..acfafaa53 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -67,7 +67,7 @@ class QuickshareCz(Hoster): self.multiDL = False def process(self, pyfile): - self.html = self.load(pyfile.url) + self.html = self.load(pyfile.url, decode=True) # marks the file as "offline" when the pattern was found on the html-page if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None: @@ -77,7 +77,8 @@ class QuickshareCz(Hoster): parsed_vars = re.search(self.VAR_PATTERN, self.html) if parsed_vars is None: self.fail("Parser error") - # unreachable: pyfile.name = unicode(parsed_vars.group('ID3'), 'utf-8') + + pyfile.name = parsed_vars.group('ID3') # download the file, destination is determined by pyLoad download_url = parsed_vars.group('Server') + "/download.php" diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py new file mode 100644 index 000000000..e7979d0a8 --- /dev/null +++ b/module/plugins/hoster/ShareRapidCom.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from module.plugins.Hoster import Hoster + +class ShareRapidCom(Hoster): + __name__ = "ShareRapidCom" + __type__ = "hoster" + __pattern__ = r"http://(?:www.)?(share-rapid)?(.com|.cz)/" + __version__ = "0.1" + __description__ = """share-rapid Plugin""" + __author_name__ = ("MikyWoW") + __author_mail__ = ("MikyWoW@seznam.cz") + + def setup(self): + self.chunkLimit = 1 + self.resumeDownload = True + + def process(self, pyfile): + name = pyfile.url + if "?" in pyfile.url: + name = re.findall("([^?=]+)", name)[-3] + + pyfile.name = re.findall("([^/=]+)", name)[-1] + + self.html = self.load(pyfile.url) + + if "Stahovn je pstupn pouze pihlenm uivatelm" in self.html: + self.fail("Nepihlen") + else: + start = self.html.index('<a href="http://s') + self.html = self.html[start+9:] + start = self.html.index('"') + self.html = self.html[0:start] + self.download(self.html)
\ No newline at end of file diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 57c00b8ba..ca1033502 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -41,7 +41,7 @@ class StreamCz(Hoster): __description__ = """stream.cz""" __author_name__ = ("zoidberg") - FILE_OFFLINE_PATTERN = r'<h1 class="commonTitle">Stránku nebylo možné nalézt \(404\)</h1>' + FILE_OFFLINE_PATTERN = r'<h1 class="commonTitle">Str.nku nebylo mo.n. nal.zt \(404\)</h1>' FILE_NAME_PATTERN = r'<link rel="video_src" href="http://www.stream.cz/\w+/(\d+)-([^"]+)" />' CDN_PATTERN = r'<param name="flashvars" value="[^"]*&id=(?P<ID>\d+)(?:&cdnLQ=(?P<cdnLQ>\d*))?(?:&cdnHQ=(?P<cdnHQ>\d*))?(?:&cdnHD=(?P<cdnHD>\d*))?&' |