From 58e98ab99bd7672492109786c4db7076d231631b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 10 Mar 2015 15:32:24 +0100 Subject: [FileSharkPl] Fix https://github.com/pyload/pyload/issues/1040 (2) --- module/plugins/hoster/FileSharkPl.py | 30 ++++++------------------------ module/plugins/internal/SimpleHoster.py | 5 ++++- 2 files changed, 10 insertions(+), 25 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index ac669ab1b..df54997d8 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileSharkPl(SimpleHoster): __name__ = "FileSharkPl" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d+/\w+' @@ -20,10 +20,9 @@ class FileSharkPl(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] - NAME_PATTERN = r'

(?P.+)

' - SIZE_PATTERN = r'

(.*?)(?P\d+\.?\d*)\s(?P\w+)

' - - OFFLINE_PATTERN = '(P|p)lik zosta. (usuni.ty|przeniesiony)' + NAME_PATTERN = r'

(?P.+)

' + SIZE_PATTERN = r'

(.*?)(?P\d+\.?\d*)\s(?P\w+)

' + OFFLINE_PATTERN = r'(P|p)lik zosta. (usuni.ty|przeniesiony)' LINK_FREE_PATTERN = r'' LINK_PREMIUM_PATTERN = r'' @@ -33,7 +32,7 @@ class FileSharkPl(SimpleHoster): IP_ERROR_PATTERN = r'Strona jest dost.pna wy..cznie dla u.ytkownik.w znajduj.cych si. na terenie Polski' SLOT_ERROR_PATTERN = r'Osi.gni.to maksymaln. liczb. .ci.ganych jednocze.nie plik.w\.' - CAPTCHA_PATTERN = '' @@ -80,7 +79,7 @@ class FileSharkPl(SimpleHoster): link = urljoin("http://fileshark.pl", m.group(1)) - self.html = self.load(link, decode=True) + self.html = self.load(link) m = re.search(self.WAIT_PATTERN, self.html) if m: @@ -111,23 +110,6 @@ class FileSharkPl(SimpleHoster): self.download(link, post=inputs, disposition=True) - def checkFile(self): - check = self.checkDownload({'wrong_captcha': re.compile(r''), - 'wait_pattern' : re.compile(self.SECONDS_PATTERN), - 'DL-found' : re.compile('')}) - if check == "DL-found": - self.correctCaptcha() - - elif check == "wrong_captcha": - self.invalidCaptcha() - self.retry(10, 1, _("Wrong captcha solution")) - - elif check == "wait_pattern": - self.retry() - - return super(FileSharkPl, self).checkFile() - - def _decode64(self, data, *args, **kwargs): return data.decode('base64') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index b2c40a828..3a38c4eea 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -246,7 +246,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.19" + __version__ = "1.20" __pattern__ = r'^unmatchable$' @@ -516,6 +516,9 @@ class SimpleHoster(Hoster): if hasattr(self, 'ERROR_PATTERN'): rules['error'] = re.compile(self.ERROR_PATTERN) + if hasattr(self, 'WAIT_PATTERN'): + rules['wait error'] = re.compile(self.WAIT_PATTERN) + check = self.checkDownload(rules) if check: #@TODO: Move to hoster in 0.4.10 errmsg = check.strip().capitalize() -- cgit v1.2.3