summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2014-04-28 17:03:17 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2014-04-28 17:03:17 +0200
commitbceba031a5c66358415d48707b04e351d2530146 (patch)
tree0c517888bb764cd5c1a332c1e04d11a45f231067 /module/plugins/hoster
parent1Fichier: fixed #592 (diff)
downloadpyload-bceba031a5c66358415d48707b04e351d2530146.tar.xz
Uptobox: fixed #588
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r--module/plugins/hoster/UptoboxCom.py41
1 files changed, 40 insertions, 1 deletions
diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py
index b4b35ab20..e403425c1 100644
--- a/module/plugins/hoster/UptoboxCom.py
+++ b/module/plugins/hoster/UptoboxCom.py
@@ -16,14 +16,19 @@
# @author: Walter Purcaro
###############################################################################
+import re
+from urllib import unquote
+
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha, SolveMedia
+from module.utils import html_unescape
class UptoboxCom(XFileSharingPro):
__name__ = "UptoboxCom"
__type__ = "hoster"
__pattern__ = r'https?://(?:www\.)?uptobox\.com/\w+'
- __version__ = "0.08"
+ __version__ = "0.09"
__description__ = """Uptobox.com hoster plugin"""
__author_name__ = "Walter Purcaro"
__author_mail__ = "vuolter@gmail.com"
@@ -38,5 +43,39 @@ class UptoboxCom(XFileSharingPro):
DIRECT_LINK_PATTERN = r'"(https?://\w+\.uptobox\.com/d/.*?)"'
+ def handleCaptcha(self, inputs):
+ found = re.search(self.SOLVEMEDIA_PATTERN, self.html)
+ if found:
+ captcha_key = found.group(1)
+ captcha = SolveMedia(self)
+ inputs['adcopy_challenge'], inputs['adcopy_response'] = captcha.challenge(captcha_key)
+ return 4
+ else:
+ found = re.search(self.CAPTCHA_URL_PATTERN, self.html)
+ if found:
+ captcha_url = found.group(1)
+ inputs['code'] = self.decryptCaptcha(captcha_url)
+ return 2
+ else:
+ found = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.DOTALL)
+ if found:
+ captcha_div = found.group(1)
+ self.logDebug(captcha_div)
+ numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>',
+ html_unescape(captcha_div))
+ inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))])
+ self.logDebug("CAPTCHA", inputs['code'], numerals)
+ return 3
+ else:
+ found = re.search(self.RECAPTCHA_URL_PATTERN, self.html)
+ if found:
+ recaptcha_key = unquote(found.group(1))
+ self.logDebug("RECAPTCHA KEY: %s" % recaptcha_key)
+ recaptcha = ReCaptcha(self)
+ inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(
+ recaptcha_key)
+ return 1
+ return 0
+
getInfo = create_getInfo(UptoboxCom)