From a40cf88920e94490d5c851fb273b8d2f48aef6fb Mon Sep 17 00:00:00 2001 From: mkaay Date: Fri, 10 Jun 2011 13:09:33 +0200 Subject: ernieb's hoster patches --- module/plugins/hoster/ShragleCom.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/ShragleCom.py') diff --git a/module/plugins/hoster/ShragleCom.py b/module/plugins/hoster/ShragleCom.py index c1cef9f3e..9ebf4917b 100644 --- a/module/plugins/hoster/ShragleCom.py +++ b/module/plugins/hoster/ShragleCom.py @@ -35,8 +35,12 @@ class ShragleCom(Hoster): def get_waiting_time(self): if self.html is None: self.download_html() - - return int(re.search('Please wait (\d+) seconds', self.html).group(1)) + + timestring = re.search('\s*var\sdownloadWait\s=\s(\d*);', self.html) + if timestring: + return int(timestring.group(1)) + else: + return 10 def download_html(self): self.html = self.load(self.pyfile.url) @@ -58,8 +62,13 @@ class ShragleCom(Hoster): if self.html is None: self.download_html() - file_name_pattern = r'You want to download \xc2\xbb(.*?)\xc2\xab' - return re.search(file_name_pattern, self.html).group(1) + #file_name_pattern = r'You want to download \xc2\xbb(.*?)\xc2\xab' + file_name_pattern = r'

(.*)
([\d\.]*) MB

' + res = re.search(file_name_pattern, self.html) + if res: + return res.group(1) + else: + self.fail("filename cant be extracted") def file_exists(self): """ returns True or False -- cgit v1.2.3