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, 21 insertions, 23 deletions
diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py
index 0c40d95b9..da353ec70 100644
--- a/module/plugins/hoster/RapiduNet.py
+++ b/module/plugins/hoster/RapiduNet.py
@@ -1,21 +1,21 @@
# -*- coding: utf-8 -*-
+import pycurl
import re
-
-from pycurl import HTTPHEADER
-from time import time, altzone
+import time
from module.common.json_layer import json_loads
-from module.plugins.internal.CaptchaService import ReCaptcha
+from module.plugins.internal.ReCaptcha import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class RapiduNet(SimpleHoster):
__name__ = "RapiduNet"
__type__ = "hoster"
- __version__ = "0.05"
+ __version__ = "0.09"
__pattern__ = r'https?://(?:www\.)?rapidu\.net/(?P<ID>\d{10})'
+ __config__ = [("use_premium", "bool", "Use premium account if available", True)]
__description__ = """Rapidu.net hoster plugin"""
__license__ = "GPLv3"
@@ -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'<h1>404'
ERROR_PATTERN = r'<div class="error">'
@@ -39,7 +39,7 @@ class RapiduNet(SimpleHoster):
def handleFree(self, pyfile):
self.req.http.lastURL = pyfile.url
- self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
+ self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
jsvars = self.getJsonResponse("https://rapidu.net/ajax.php",
get={'a': "getLoadTimeToDownload"},
@@ -47,30 +47,28 @@ class RapiduNet(SimpleHoster):
decode=True)
if str(jsvars['timeToDownload']) is "stop":
- t = (24 * 60 * 60) - (int(time()) % (24 * 60 * 60)) + altzone
+ t = (24 * 60 * 60) - (int(time.time()) % (24 * 60 * 60)) + time.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
else:
- self.wait(int(jsvars['timeToDownload']) - int(time()))
+ self.wait(int(jsvars['timeToDownload']) - int(time.time()))
recaptcha = ReCaptcha(self)
+ 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)
- for _i in xrange(10):
- challenge, response = 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
+ if jsvars['message'] == 'success':
+ self.link = jsvars['url']
def getJsonResponse(self, *args, **kwargs):