From 3d5aa943fafd4c84261465ba17b402dd07e5a2d5 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 5 Dec 2014 10:56:05 +0100 Subject: [FastshareCz] Cleanup --- module/plugins/hoster/FastshareCz.py | 67 ++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 38 deletions(-) (limited to 'module') diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 14931f681..8b01b5edd 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://www.fastshare.cz/2141189/random.bin import re @@ -13,33 +10,41 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FastshareCz(SimpleHoster): __name__ = "FastshareCz" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.24" __pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+' __description__ = """FastShare.cz hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + URL_REPLACEMENTS = [("#.*", "")] + + COOKIES = [("fastshare.cz", "lang", "en")] + CONTENT_DISPOSITION = True - INFO_PATTERN = r'

(?P[^<]+)

\s*
\s*Size\s*: (?P\d+) (?P[\w^_]+),' + INFO_PATTERN = r'

(?P[^<]+)

\s*
\s*Size\s*: (?P\d+) (?P[\w^_]+),' OFFLINE_PATTERN = r'>(The file has been deleted|Requested page not found)' - URL_REPLACEMENTS = [("#.*", "")] + LINK_FREE_PATTERN = r'action=(/free/.*?)>\s*\s* 100% of FREE slots are full" in self.html: - self.retry(12, 60, _("No free slots")) + def handleFree(self): m = re.search(self.FREE_URL_PATTERN, self.html) if m: action, captcha_src = m.groups() @@ -48,37 +53,23 @@ class FastshareCz(SimpleHoster): 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}) + self.download(urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18}) + + def checkFile(self): check = self.checkDownload({ - 'paralell_dl': "FastShare.cz|