summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/RapiduNet.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/RapiduNet.py')
-rw-r--r--module/plugins/hoster/RapiduNet.py44
1 files changed, 24 insertions, 20 deletions
diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py
index 4b6ef55bb..5c12bf924 100644
--- a/module/plugins/hoster/RapiduNet.py
+++ b/module/plugins/hoster/RapiduNet.py
@@ -13,7 +13,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo
class RapiduNet(SimpleHoster):
__name__ = "RapiduNet"
__type__ = "hoster"
- __version__ = "0.02"
+ __version__ = "0.07"
__pattern__ = r'https?://(?:www\.)?rapidu\.net/(?P<ID>\d{10})'
@@ -24,8 +24,8 @@ class RapiduNet(SimpleHoster):
COOKIES = [("rapidu.net", "rapidu_lang", "en")]
- FILE_INFO_PATTERN = r'<h1 title="(?P<N>.*)">.*</h1>\s*<small>(?P<S>\d+(\.\d+)?)\s(?P<U>\w+)</small>'
- OFFLINE_PATTERN = r'404 - File not found'
+ INFO_PATTERN = r'<h1 title="(?P<N>.*)">.*</h1>\s*<small>(?P<S>\d+(\.\d+)?)\s(?P<U>\w+)</small>'
+ OFFLINE_PATTERN = r'404 - File not found'
ERROR_PATTERN = r'<div class="error">'
@@ -34,22 +34,24 @@ class RapiduNet(SimpleHoster):
def setup(self):
self.resumeDownload = True
- self.multiDL = True
- self.limitDL = 0 if self.premium else 2
+ self.multiDL = self.premium
- def handleFree(self):
- self.req.http.lastURL = self.pyfile.url
+ def handleFree(self, pyfile):
+ self.req.http.lastURL = pyfile.url
self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
- jsvars = self.getJsonResponse("https://rapidu.net/ajax.php?a=getLoadTimeToDownload", {'_go': None})
+ jsvars = self.getJsonResponse("https://rapidu.net/ajax.php",
+ get={'a': "getLoadTimeToDownload"},
+ post={'_go': ""},
+ decode=True)
if str(jsvars['timeToDownload']) is "stop":
- t = (24 * 60 * 60) - (int(time()) % (24 *60 * 60)) + altzone
+ t = (24 * 60 * 60) - (int(time()) % (24 * 60 * 60)) + altzone
self.logInfo("You've reach your daily download transfer")
- self.retry(10, 10 if t < 1 else None, "Try tomorrow again") #@NOTE: check t in case of not synchronised clock
+ self.retry(10, 10 if t < 1 else None, _("Try tomorrow again")) #@NOTE: check t in case of not synchronised clock
else:
self.wait(int(jsvars['timeToDownload']) - int(time()))
@@ -57,24 +59,26 @@ class RapiduNet(SimpleHoster):
recaptcha = ReCaptcha(self)
for _i in xrange(10):
- challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
-
- jsvars = self.getJsonResponse("https://rapidu.net/ajax.php?a=getCheckCaptcha",
- {'_go' : None,
- 'captcha1': challenge,
- 'captcha2': response,
- 'fileId' : self.info['ID']})
+ response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY)
+
+ jsvars = self.getJsonResponse("https://rapidu.net/ajax.php",
+ get={'a': "getCheckCaptcha"},
+ post={'_go' : "",
+ 'captcha1': challenge,
+ 'captcha2': response,
+ 'fileId' : self.info['pattern']['ID']},
+ decode=True)
if jsvars['message'] == 'success':
self.download(jsvars['url'])
break
- def getJsonResponse(self, url, post_data):
- res = self.load(url, post=post_data, decode=True)
+ def getJsonResponse(self, *args, **kwargs):
+ res = self.load(*args, **kwargs)
if not res.startswith('{'):
self.retry()
- self.logDebug(url, res)
+ self.logDebug(res)
return json_loads(res)