diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2012-11-16 22:02:09 +0100 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2012-11-16 22:02:09 +0100 |
commit | 5f454557c5c60495104454ea948c3f0794c49ee9 (patch) | |
tree | ef3e9c1c6afec047027d35969a579070b5531775 /module | |
parent | update Youtube crypter (diff) | |
download | pyload-5f454557c5c60495104454ea948c3f0794c49ee9.tar.xz |
update fshare.vn, update hellshare.cz account
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/accounts/HellshareCz.py | 15 | ||||
-rw-r--r-- | module/plugins/hoster/FshareVn.py | 89 |
2 files changed, 68 insertions, 36 deletions
diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index 8ed134f59..312b1e76b 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -22,7 +22,7 @@ import re class HellshareCz(Account): __name__ = "HellshareCz" - __version__ = "0.12" + __version__ = "0.13" __type__ = "account" __description__ = """hellshare.cz account plugin""" __author_name__ = ("zoidberg") @@ -45,6 +45,19 @@ class HellshareCz(Account): return {"validuntil": -1, "trafficleft": credits, "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) + self.logDebug('Switch lang - HASH: %s' % hash) + html = req.load('http://www.hellshare.com/%s/' % hash) + + if re.search(self.CREDIT_LEFT_PATTERN, html): + self.logDebug('Already logged in') + return + html = req.load('http://www.hellshare.com/login?do=loginForm-submit', post={ "login": "Log in", "password": data["password"], diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 977e97211..77d6fdb3d 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -4,6 +4,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo from module.network.RequestFactory import getURL import re +from time import strptime, mktime, gmtime def getInfo(urls): for url in urls: @@ -23,20 +24,17 @@ class FshareVn(SimpleHoster): __name__ = "FshareVn" __type__ = "hoster" __pattern__ = r"http://(www\.)?fshare.vn/file/.*" - __version__ = "0.13" + __version__ = "0.14" __description__ = """FshareVn Download Hoster""" __author_name__ = ("zoidberg") __author_mail__ = ("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>' - FILE_OFFLINE_PATTERN = r'<div class=\\"f_left file_(enable|w)\\">' - FILE_NAME_REPLACEMENTS = [("(.*)", doubleDecode)] - - DOWNLOAD_URL_PATTERN = r"<a class=\"bt_down\" id=\"down\".*window.location='([^']+)'\">" - FORM_PATTERN = r'<form action="" method="post" name="frm_download">(.*?)</form>' - FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>' + FILE_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)] + DOWNLOAD_URL_PATTERN = r'action="(http://download.*?)[#"]' VIP_URL_PATTERN = r'<form action="([^>]+)" method="get" name="frm_download">' - WAIT_PATTERN = u"Vui lòng chờ lượt download kế tiếp" + WAIT_PATTERN = ur'Lượt tải xuống kế tiếp là:\s*(.*?)\s*<' def process(self, pyfile): self.html = self.load('http://www.fshare.vn/check_link.php', post = { @@ -44,61 +42,82 @@ class FshareVn(SimpleHoster): "arrlinks": pyfile.url }, decode = True) self.getFileInfo() - - url = self.handlePremium() if self.premium else self.handleFree() - self.download(url) + + if self.premium: + self.handlePremium() + else: + self.handleFree() self.checkDownloadedFile() def handleFree(self): self.html = self.load(self.pyfile.url, decode = True) - if self.WAIT_PATTERN in self.html: - self.retry(20, 300, "Try again later...") - + self.checkErrors() - found = re.search(self.FORM_PATTERN, self.html, re.DOTALL) - if not found: self.parseError('FORM') - form = found.group(1) - inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) + action, inputs = self.parseHtmlForm('frm_download') + self.url = self.pyfile.url + action + + if not inputs: self.parseError('FORM') + elif 'link_file_pwd_dl' in inputs: + for password in self.getPassword().splitlines(): + self.logInfo('Password protected link, trying "%s"' % 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") + else: + self.html = self.load(self.url, post=inputs, decode=True) - self.html = self.load(self.pyfile.url, post = inputs, decode = True) + self.checkErrors() - if self.WAIT_PATTERN in self.html: - self.retry(300, 20, "Try again later...") + found = re.search(r'var count = (\d+)', self.html) + self.setWait(int(found.group(1)) if found else 30) found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) - if not found: self.parseError('Free URL') - url = found.group(1) + if not found: self.parseError('FREE DL URL') + self.url = found.group(1) + self.logDebug("FREE DL URL: %s" % self.url) - found = re.search(r'var count = (\d+)', self.html) - self.setWait(int(found.group(1)) if found else 30) self.wait() - - return url + self.download(self.url) def handlePremium(self): header = self.load(self.pyfile.url, just_header = True) if 'location' in header and header['location'].startswith('http://download'): self.logDebug('Direct download') - return self.pyfile.url + self.url = self.pyfile.url else: self.html = self.load(self.pyfile.url) - + self.checkErrors() - + found = re.search(self.VIP_URL_PATTERN, self.html) if not found: if self.retries >= 3: self.resetAccount() self.account.relogin(self.user) self.retry(5, 1, 'VIP URL not found') - url = found.group(1) + self.url = found.group(1) self.logDebug('VIP URL: ' + url) - return url - + + self.download(self.url) + def checkErrors(self): - if '/error.php?' in self.req.lastEffectiveURL: + 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() - + + found = re.search(self.WAIT_PATTERN, self.html) + if found: + self.logInfo("Wait until %s ICT" % found.group(1)) + wait_until = mktime(strptime(found.group(1), "%d/%m/%Y %H:%M")) + self.setWait(wait_until - mktime(gmtime()) - 7 * 3600, True) + self.wait() + self.retry() + elif '<ul class="message-error">' in self.html: + self.logError("Unknown error occured or wait time not parsed") + self.retry(30, 120, "Unknown error") + def checkDownloadedFile(self): # check download check = self.checkDownload({ |