Repository: pyload/pyload

Issue:
LinkCryptWs - 'bool' object has no attribute 'decrypt'
Again an error with an crypter...

> 2458  14.08.2015 23:06:35 INFO    Debug Report written to debug_LinkCryptWs_14-08-2015_23-06-35.zip
> 2457    14.08.2015 23:06:35 ERROR   Decrypting failed: http://linkcrypt.ws/dir/u9zwn9sbm6nscp1 | 'bool' object has no attribute 'decrypt'
> 2456    14.08.2015 23:06:35 DEBUG   CRYPTER LinkCryptWs[1570]: Links are captcha protected
> 2455    14.08.2015 23:06:35 DEBUG   CRYPTER LinkCryptWs[1570]: LOAD URL http://linkcrypt.ws/dir/u9zwn9sbm6nscp1 | cookies=True | get={} | req=None | decode=True | multipart=False | post={} | ref=True | just_header=False
> 2454    14.08.2015 23:06:35 DEBUG   CRYPTER LinkCryptWs[1570]: PROCESS URL http://linkcrypt.ws/dir/u9zwn9sbm6nscp1 | PLUGIN VERSION 0.10
> 2453    14.08.2015 23:06:35 DEBUG   HOOK UserAgentSwitcher: Use custom user-agent string: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
> 2452    14.08.2015 23:06:35 INFO    Decrypting starts: http://linkcrypt.ws/dir/u9zwn9sbm6nscp1
> 2451    14.08.2015 23:06:35 DEBUG   Redirected import module.plugins.crypter.LinkCryptWs -> userplugins.crypter.LinkCryptWs



Discussion:
This https://gist.github.com/Bambie42/989aa620a14d783d2078 fixes the bool problem, but then the plugin always says the captcha is invalid... I think that is a cookie problem?

I will try it soon. Thx for your help.

you are right. now i cant decrype the captcha as you said.

Writing a simple decrypter with python-requests solve this issue, so i think this is pyload handling the cookies wrong?

I also think it depends on the cookie handling and that this is the reason for #1605 to fail too.


Resolving patch:
diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py
--- a/module/plugins/crypter/LinkCryptWs.py
+++ b/module/plugins/crypter/LinkCryptWs.py
@@ -31,7 +31,6 @@ class LinkCryptWs(Crypter):
 
 
     def setup(self):
-        self.captcha = False
         self.links   = []
         self.sources = ['cnl', 'web', 'dlc', 'rsdf', 'ccf']
 
@@ -60,7 +59,6 @@ def decrypt(self, pyfile):
             self.retry(8, 15, _("Can't handle Key-Captcha"))
 
         if self.is_captcha_protected():
-            self.captcha = True
             self.unlock_captcha_protection()
             self.handle_captcha_errors()
 
@@ -165,12 +163,11 @@ def handle_errors(self):
 
 
     def handle_captcha_errors(self):
-        if self.captcha:
-            if "Your choice was wrong!" in self.html:
-                self.captcha.invalid()
-                self.retry()
-            else:
-                self.captcha.correct()
+        if "Your choice was wrong!" in self.html:
+            self.captcha.invalid()
+            self.retry()
+        else:
+            self.captcha.correct()
 
 
     def handle_link_source(self, type):
diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py
--- a/module/plugins/internal/Captcha.py
+++ b/module/plugins/internal/Captcha.py
@@ -120,7 +120,7 @@ def _decrypt(self, raw, input_type='jpg', output_type='textual', ocr=False, time
                 self.log_warning(_("Error removing: %s") % tmp_img.name, e)
                 traceback.print_exc()
 
-        self.log_info(_("Captcha result: ") + result)  #@TODO: Remove from here?
+        #self.log_info(_("Captcha result: ") + result)  #@TODO: Remove from here?
 
         return result
 


Test patch: