From 748dfa2f3b80092d4308291721742526d9421a28 Mon Sep 17 00:00:00 2001 From: Stefano Date: Sun, 13 Oct 2013 16:49:56 +0200 Subject: FastshareCz: improved plugin. Fixes #302 --- module/plugins/hoster/FastshareCz.py | 37 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'module/plugins/hoster/FastshareCz.py') diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 844b8cd59..d2b644d4c 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -20,58 +20,49 @@ # http://www.fastshare.cz/2141189/random.bin import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns +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.17" + __version__ = "0.18" __description__ = """FastShare.cz""" __author_name__ = ("zoidberg", "stickell") FILE_INFO_PATTERN = r'

(?P[^<]+)

\s*
\s*(?:Velikost|Size)\s*: (?P[^,]+),' FILE_OFFLINE_PATTERN = ur'Tento soubor byl smazán' FILE_URL_REPLACEMENTS = [('#.*', '')] + SH_COOKIES = [('fastshare.cz', 'lang', 'en')] FREE_URL_PATTERN = r'action=(/free/.*?)>\s*]+)' NOT_ENOUGH_CREDIC_PATTERN = "Nem.te dostate.n. kredit pro sta.en. tohoto souboru" - def process(self, pyfile): - pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS) - self.req.setOption("timeout", 120) - if self.premium and (not self.SH_CHECK_TRAFFIC or self.checkTrafficLeft()): - self.handlePremium() - else: - self.html = self.load(pyfile.url, decode=not self.SH_BROKEN_ENCODING, cookies=self.SH_COOKIES) - self.getFileInfo() - self.handleFree() - def handleFree(self): - if u">100% FREE slotů je plných.<" in self.html: - self.setWait(60, False) - self.wait() - self.retry(120, "No free slots") + self.html = self.load(self.pyfile.url) + + 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: 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, "submit": u"stáhnout"}) + 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}) check = self.checkDownload({ "paralell_dl": - "FastShare.cz|