diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-03-12 17:29:24 +0100 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2014-04-21 17:04:47 +0200 |
commit | 824e267e96ea1fca61b1b4400c224739fd9fd25c (patch) | |
tree | 7775355e79866dd1df77ca444fb8a6bb855126b9 | |
parent | New hoster: FileomCom (diff) | |
download | pyload-824e267e96ea1fca61b1b4400c224739fd9fd25c.tar.xz |
FastshareCz: Fixed #521
Merged #529
(cherry picked from commit 853e79074ea21cf31f46c23e4cef45609b19483f)
-rw-r--r-- | pyload/plugins/hoster/FastshareCz.py | 95 |
1 files changed, 53 insertions, 42 deletions
diff --git a/pyload/plugins/hoster/FastshareCz.py b/pyload/plugins/hoster/FastshareCz.py index fba704123..93fbad6be 100644 --- a/pyload/plugins/hoster/FastshareCz.py +++ b/pyload/plugins/hoster/FastshareCz.py @@ -1,55 +1,63 @@ # -*- 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 -""" +############################################################################### +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# @author: zoidberg +############################################################################### # Test links (random.bin): # http://www.fastshare.cz/2141189/random.bin import re +from urlparse import urljoin + from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FastshareCz(SimpleHoster): __name__ = "FastshareCz" __type__ = "hoster" - __pattern__ = r"http://(?:\w*\.)?fastshare.cz/\d+/.+" - __version__ = "0.21" - __description__ = """FastShare.cz""" - __author_name__ = ("zoidberg", "stickell") + __pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+' + __version__ = "0.22" + __description__ = """FastShare.cz hoster plugin""" + __author_name__ = ("zoidberg", "stickell", "Walter Purcaro") + __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it", "vuolter@gmail.com") + + FILE_INFO_PATTERN = r'<h1 class="dwp">(?P<N>[^<]+)</h1>\s*<div class="fileinfo">\s*Size\s*: (?P<S>\d+) (?P<U>\w+),' + FILE_OFFLINE_PATTERN = '>(The file has been deleted|Requested page not found)' - FILE_INFO_PATTERN = r'<h1 class="dwp">(?P<N>[^<]+)</h1>\s*<div class="fileinfo">\s*(?:Velikost|Size)\s*: (?P<S>[^,]+),' - FILE_OFFLINE_PATTERN = '(?:The file ?has been deleted|Requested page not found)' - FILE_URL_REPLACEMENTS = [('#.*', '')] - SH_COOKIES = [('fastshare.cz', 'lang', 'en')] + FILE_URL_REPLACEMENTS = [("#.*", "")] + SH_COOKIES = [(".fastshare.cz", "lang", "en")] FREE_URL_PATTERN = r'action=(/free/.*?)>\s*<img src="([^"]*)"><br' - 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" + PREMIUM_URL_PATTERN = r'(http://data\d+\.fastshare\.cz/download\.php\?id=\d+&)' + CREDIT_PATTERN = " credit for " def handleFree(self): - if '100% of FREE slots are full' in self.html: + if "> 100% of FREE slots are full" in self.html: self.retry(120, 60, "No free slots") found = re.search(self.FREE_URL_PATTERN, self.html) - if not found: + if found: + action, captcha_src = found.groups() + else: self.parseError("Free URL") - action, captcha_src = found.groups() - captcha = self.decryptCaptcha("http://www.fastshare.cz" + captcha_src) - self.download("http://www.fastshare.cz" + action, post={"code": captcha, "btn.x": 77, "btn.y": 18}) + + baseurl = "http://www.fastshare.cz" + captcha = self.decryptCaptcha(urljoin(baseurl, captcha_src)) + self.download(urljoin(baseurl, action), post={"code": captcha, "btn.x": 77, "btn.y": 18}) check = self.checkDownload({ "paralell_dl": @@ -64,24 +72,27 @@ class FastshareCz(SimpleHoster): def handlePremium(self): header = self.load(self.pyfile.url, just_header=True) - if 'location' in header: - url = header['location'] + if "location" in header: + url = header["location"] else: self.html = self.load(self.pyfile.url) - self.getFileInfo() - 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.getFileInfo() # - self.logDebug("PREMIUM URL: %s" % url) + if self.CREDIT_PATTERN in self.html: + self.logWarning("Not enough traffic left") + self.resetAccount() + else: + found = re.search(self.PREMIUM_URL_PATTERN, self.html) + if found: + url = found.group(1) + else: + self.parseError("Premium URL") + + self.logDebug("PREMIUM URL: " + url) self.download(url, disposition=True) - check = self.checkDownload({"credit": re.compile(self.NOT_ENOUGH_CREDIC_PATTERN)}) + check = self.checkDownload({"credit": re.compile(self.CREDIT_PATTERN)}) if check == "credit": self.resetAccount() |