summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar quareevo <quareevo@arcor.de> 2013-08-22 16:32:20 +0200
committerGravatar quareevo <quareevo@arcor.de> 2013-08-22 16:32:20 +0200
commit8561453ddb867e535936a90ba4d673d38474a6ca (patch)
treef33c3d6ea5c40efe95bab4bf7b9d82098335a4a4 /module
parentMerge pull request #232 from Apollo-Hartigan/WindowsPhoneToastNotify (diff)
downloadpyload-8561453ddb867e535936a90ba4d673d38474a6ca.tar.xz
Ryushare: added SolveMedia captcha and fixed waiting pattern
Diffstat (limited to 'module')
-rw-r--r--module/plugins/hoster/RyushareCom.py69
1 files changed, 48 insertions, 21 deletions
diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py
index eff9a6140..79fa0672e 100644
--- a/module/plugins/hoster/RyushareCom.py
+++ b/module/plugins/hoster/RyushareCom.py
@@ -1,22 +1,23 @@
# -*- coding: utf-8 -*-
-import re
-
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+from module.plugins.internal.CaptchaService import SolveMedia
+import re
class RyushareCom(XFileSharingPro):
__name__ = "RyushareCom"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)*?ryushare.com/\w{11,}"
- __version__ = "0.11"
+ __version__ = "0.12"
__description__ = """ryushare.com hoster plugin"""
- __author_name__ = ("zoidberg", "stickell")
- __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+ __author_name__ = ("zoidberg", "stickell","quareevo")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it","quareevo@arcor.de")
HOSTER_NAME = "ryushare.com"
- WAIT_PATTERN = r'(?:You have to|Please) wait (?:(?P<min>\d+) minutes, )?(?:<span id="[^"]+">)?(?P<sec>\d+)(?:</span>)? seconds'
+ 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'<a href="([^"]+)">Click here to download</a>'
+ SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"'
def setup(self):
self.resumeDownload = self.multiDL = True
@@ -26,6 +27,7 @@ class RyushareCom(XFileSharingPro):
self.chunkLimit = 3
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:
@@ -34,24 +36,49 @@ class RyushareCom(XFileSharingPro):
self.html = self.load(self.pyfile.url, post=inputs)
action, inputs = self.parseHtmlForm('F1')
- for i in xrange(10):
- self.logInfo('Attempt to detect direct link #%d' % i)
+ self.setWait(65)
+ # Wait
+ if 'You have reached the download-limit!!!' in self.html:
+ self.setWait(3600, 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'])
+ self.setWait(waittime,True)
+ retry = True
- # Wait
- if 'You have reached the download-limit!!!' in self.html:
- self.setWait(3600, True)
- else:
- m = re.search(self.WAIT_PATTERN, self.html).groupdict('0')
- waittime = int(m['min']) * 60 + int(m['sec'])
- self.setWait(waittime)
- self.wait()
+ self.wait()
+ if retry == True:
+ self.retry()
- self.html = self.load(self.pyfile.url, post=inputs)
- if 'Click here to download' in self.html:
- m = re.search(self.DIRECT_LINK_PATTERN, self.html)
- return m.group(1)
+ for i 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)
+
+ 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.logDebug("Invalid Captcha")
+ else:
+ self.correctCaptcha()
+ break
- self.parseError('No direct link within 10 retries')
+ else:
+ self.fail("You have entered 5 invalid captcha codes")
+ if 'Click here to download' in self.html:
+ m = re.search(self.DIRECT_LINK_PATTERN, self.html)
+ return m.group(1)
getInfo = create_getInfo(RyushareCom)