summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-08-14 21:48:19 +0200
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-08-14 21:48:19 +0200
commit88f34841c319c1c67469a361350b0482d4952e11 (patch)
tree029ddc70f471abf7092672eacadf000f8553ea34
parentshare-online.biz error handling - should fix #649 (diff)
downloadpyload-88f34841c319c1c67469a361350b0482d4952e11.tar.xz
closed #653, #654, fix cbh
-rw-r--r--module/plugins/hooks/CaptchaBrotherhood.py13
-rw-r--r--module/plugins/hoster/FilepostCom.py26
-rw-r--r--module/plugins/hoster/RapidgatorNet.py7
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py13
4 files changed, 41 insertions, 18 deletions
diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py
index d3c1dd043..a22a5ee1d 100644
--- a/module/plugins/hooks/CaptchaBrotherhood.py
+++ b/module/plugins/hooks/CaptchaBrotherhood.py
@@ -44,7 +44,7 @@ class CaptchaBrotherhoodException(Exception):
class CaptchaBrotherhood(Hook):
__name__ = "CaptchaBrotherhood"
- __version__ = "0.02"
+ __version__ = "0.03"
__description__ = """send captchas to CaptchaBrotherhood.com"""
__config__ = [("activated", "bool", "Activated", False),
("username", "str", "Username", ""),
@@ -73,9 +73,14 @@ class CaptchaBrotherhood(Hook):
def submit(self, captcha, captchaType="file", match=None):
try:
img = Image.open(captcha)
- self.logDebug("CAPTCHA IMAGE", img, img.format)
output = StringIO.StringIO()
- img.save(output, "JPEG")
+ self.logDebug("CAPTCHA IMAGE", img, img.format, img.mode)
+ if img.format in ("GIF", "JPEG"):
+ img.save(output, img.format)
+ else:
+ if img.mode != "RGB":
+ img = img.convert("RGB")
+ img.save(output, "JPEG")
data = output.getvalue()
output.close()
except Exception, e:
@@ -150,7 +155,7 @@ class CaptchaBrotherhood(Hook):
def captchaInvalid(self, task):
if task.data['service'] == self.__name__ and "ticket" in task.data:
- response = self.get_api("complainCaptcha", ticket)
+ response = self.get_api("complainCaptcha", task.data['ticket'])
def processCaptcha(self, task):
c = task.captchaFile
diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py
index 834ad7199..bc47856e5 100644
--- a/module/plugins/hoster/FilepostCom.py
+++ b/module/plugins/hoster/FilepostCom.py
@@ -14,6 +14,11 @@
along with this program; if not, see <http://www.gnu.org/licenses/>.
@author: zoidberg
+
+ changelog:
+ 0.27 - 2012-08-12 - hgg
+ fix "global name 'js_answer' is not defined" bug
+ fix captcha bug #1 (failed on non-english "captcha wrong" errors)
"""
import re
@@ -26,7 +31,7 @@ class FilepostCom(SimpleHoster):
__name__ = "FilepostCom"
__type__ = "hoster"
__pattern__ = r"https?://(?:www\.)?(?:filepost\.com/files|fp.io)/([^/]+).*"
- __version__ = "0.26"
+ __version__ = "0.27"
__description__ = """Filepost.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
@@ -81,7 +86,7 @@ class FilepostCom(SimpleHoster):
get_dict['JsHttpRequest'] = str(int(time()*10000)) + '-xml'
if pokus:
post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"] = recaptcha.challenge(captcha_key)
- self.logDebug(u"RECAPTCHA: %s : %s : %s" % (captcha_key, post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"]))
+ self.logDebug(u"RECAPTCHA: %s : %s : %s" % (captcha_key, post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"]))
download_url = self.getJsonResponse(get_dict, post_dict, 'link')
if download_url:
@@ -101,19 +106,30 @@ class FilepostCom(SimpleHoster):
if not 'js' in json_response: self.parseError('JSON %s 1' % field)
+ # i changed js_answer to json_response['js'] since js_answer is nowhere set.
+ # i don't know the JSON-HTTP specs in detail, but the previous author
+ # accessed json_response['js']['error'] as well as js_answer['error'].
+ # see the two lines commented out with "# ~?".
if 'error' in json_response['js']:
if json_response['js']['error'] == 'download_delay':
- self.retry(js_answer['params']['next_download'])
+ self.retry(json_response['js']['params']['next_download'])
+ # ~? self.retry(js_answer['params']['next_download'])
elif 'Wrong file password' in json_response['js']['error']:
return None
elif 'You entered a wrong CAPTCHA code' in json_response['js']['error']:
return None
+ elif 'CAPTCHA Code nicht korrekt' in json_response['js']['error']:
+ return None
+ elif 'CAPTCHA' in json_response['js']['error']:
+ self.logDebug('error response is unknown, but mentions CAPTCHA -> return None')
+ return None
else:
- self.fail(js_answer['error'])
+ self.fail(json_response['js']['error'])
+ # ~? self.fail(js_answer['error'])
if not 'answer' in json_response['js'] or not field in json_response['js']['answer']:
self.parseError('JSON %s 2' % field)
return json_response['js']['answer'][field]
-getInfo = create_getInfo(FilepostCom) \ No newline at end of file
+getInfo = create_getInfo(FilepostCom)
diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py
index 3b0981b8b..678a3d707 100644
--- a/module/plugins/hoster/RapidgatorNet.py
+++ b/module/plugins/hoster/RapidgatorNet.py
@@ -67,7 +67,7 @@ class RapidgatorNet(SimpleHoster):
__name__ = "RapidgatorNet"
__type__ = "hoster"
__pattern__ = r"http://(?:www\.)?(rapidgator.net)/file/(\d+)"
- __version__ = "0.05"
+ __version__ = "0.06"
__description__ = """rapidgator.net"""
__author_name__ = ("zoidberg","chrox")
@@ -81,8 +81,9 @@ class RapidgatorNet(SimpleHoster):
SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"'
def handleFree(self):
- if "You can download files up to 500 MB in free mode" in self.html:
- self.fail("File too large for free download")
+ if "You can download files up to 500 MB in free mode" in self.html \
+ or "This file can be downloaded by premium only" in self.html:
+ self.fail("Premium account needed for download")
self.checkWait()
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index 377ba5671..a5885d54f 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -43,7 +43,7 @@ class ShareonlineBiz(Hoster):
__name__ = "ShareonlineBiz"
__type__ = "hoster"
__pattern__ = r"http://[\w\.]*?(share\-online\.biz|egoshare\.com)/(download.php\?id\=|dl/)[\w]+"
- __version__ = "0.32"
+ __version__ = "0.33"
__description__ = """Shareonline.biz Download Hoster"""
__author_name__ = ("spoob", "mkaay", "zoidberg")
__author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
@@ -71,9 +71,10 @@ class ShareonlineBiz(Hoster):
check = self.checkDownload({"failure": re.compile(self.ERROR_INFO_PATTERN)})
if check == "failure":
- if self.premium:
- self.account.getAccountInfo(self.user, True)
- self.retry(reason = " ".join(self.lastCheck.groups()) or "Unknown error")
+ try:
+ self.retry(reason = self.lastCheck.group(1).decode("utf8"))
+ except:
+ self.retry(reason = "Unknown error")
if self.api_data:
self.check_data = {"size": int(self.api_data['size']), "md5": self.api_data['md5']}
@@ -136,8 +137,8 @@ class ShareonlineBiz(Hoster):
msg = found.group(1) if found else ""
self.logError(err, msg or "Unknown error occurred")
- if err in ('freelimit', 'size'):
- self.fail(msg or "File too big")
+ if err in ('freelimit', 'size', 'proxy'):
+ self.fail(msg or "Premium account needed")
if err in ('invalid'):
self.fail(msg or "File not available")
elif err in ('server'):