diff options
Diffstat (limited to 'module/plugins/hoster/RyushareCom.py')
-rw-r--r-- | module/plugins/hoster/RyushareCom.py | 63 |
1 files changed, 30 insertions, 33 deletions
diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py index 4d3e9b7f3..0964c51fc 100644 --- a/module/plugins/hoster/RyushareCom.py +++ b/module/plugins/hoster/RyushareCom.py @@ -1,37 +1,41 @@ # -*- coding: utf-8 -*- - -# Test links (random.bin): +# +# Test links: # http://ryushare.com/cl0jy8ric2js/random.bin import re -from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo from module.plugins.internal.CaptchaService import SolveMedia -class RyushareCom(XFileSharingPro): - __name__ = "RyushareCom" - __type__ = "hoster" +class RyushareCom(XFSHoster): + __name__ = "RyushareCom" + __type__ = "hoster" + __version__ = "0.20" + __pattern__ = r'http://(?:www\.)?ryushare\.com/\w+' - __version__ = "0.15" + __description__ = """Ryushare.com hoster plugin""" - __author_name__ = ("zoidberg", "stickell", "quareevo") - __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it", "quareevo@arcor.de") + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it"), + ("quareevo", "quareevo@arcor.de")] - HOSTER_NAME = "ryushare.com" - FILE_SIZE_PATTERN = r'You have requested <font color="red">[^<]+</font> \((?P<S>[\d\.]+) (?P<U>\w+)' + HOSTER_DOMAIN = "ryushare.com" + + WAIT_PATTERN = r'You have to wait ((?P<H>\d+) hour[s]?, )?((?P<M>\d+) minute[s], )?(?P<S>\d+) second[s]' + + LINK_PATTERN = r'<a href="([^"]+)">Click here to download<' - WAIT_PATTERN = r'You have to wait ((?P<hour>\d+) hour[s]?, )?((?P<min>\d+) minute[s], )?(?P<sec>\d+) second[s]' - DIRECT_LINK_PATTERN = r'(http://([^/]*?ryushare.com|\d+\.\d+\.\d+\.\d+)(:\d+/d/|/files/\w+/\w+/)[^"\'<]+)' - SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"' def getDownloadLink(self): retry = False self.html = self.load(self.pyfile.url) action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) if "method_premium" in inputs: - del inputs["method_premium"] + del inputs['method_premium'] self.html = self.load(self.pyfile.url, post=inputs) action, inputs = self.parseHtmlForm('F1') @@ -42,10 +46,10 @@ class RyushareCom(XFileSharingPro): self.setWait(1 * 60 * 60, True) retry = True - match = re.search(self.WAIT_PATTERN, self.html) - if match: - m = match.groupdict(0) - waittime = int(m["hour"]) * 60 * 60 + int(m["min"]) * 60 + int(m["sec"]) + m = re.search(self.WAIT_PATTERN, self.html) + if m: + wait = m.groupdict(0) + waittime = int(wait['H']) * 60 * 60 + int(wait['M']) * 60 + int(wait['S']) self.setWait(waittime, True) retry = True @@ -53,31 +57,24 @@ class RyushareCom(XFileSharingPro): if retry: self.retry() - for _ in xrange(5): - m = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if not m: - self.parseError("Error parsing captcha") - - captchaKey = m.group(1) - captcha = SolveMedia(self) - challenge, response = captcha.challenge(captchaKey) + for _i in xrange(5): + solvemedia = SolveMedia(self) + challenge, response = solvemedia.challenge() - inputs["adcopy_challenge"] = challenge - inputs["adcopy_response"] = response + inputs['adcopy_challenge'] = challenge + inputs['adcopy_response'] = response self.html = self.load(self.pyfile.url, post=inputs) if "WRONG CAPTCHA" in self.html: self.invalidCaptcha() - self.logInfo("Invalid Captcha") else: self.correctCaptcha() break else: - self.fail("You have entered 5 invalid captcha codes") + self.fail(_("You have entered 5 invalid captcha codes")) if "Click here to download" in self.html: - m = re.search(r'<a href="([^"]+)">Click here to download</a>', self.html) - return m.group(1) + return re.search(r'<a href="([^"]+)">Click here to download</a>', self.html).group(1) getInfo = create_getInfo(RyushareCom) |