summaryrefslogtreecommitdiffstats
path: root/module/plugins/captcha
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/captcha')
-rw-r--r--module/plugins/captcha/GigasizeCom.py8
-rw-r--r--module/plugins/captcha/captcha.py5
2 files changed, 6 insertions, 7 deletions
diff --git a/module/plugins/captcha/GigasizeCom.py b/module/plugins/captcha/GigasizeCom.py
index 136092181..d31742eb5 100644
--- a/module/plugins/captcha/GigasizeCom.py
+++ b/module/plugins/captcha/GigasizeCom.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
from captcha import OCR
class GigasizeCom(OCR):
@@ -7,9 +8,12 @@ class GigasizeCom(OCR):
def get_captcha(self, image):
self.load_image(image)
self.threshold(2.8)
- self.run_gocr()
+ self.run_tesser(True, False, False, True)
return self.result_captcha
if __name__ == '__main__':
ocr = GigasizeCom()
- print ocr.get_captcha('gigasize-com/7.jpg')
+ import urllib
+ urllib.urlretrieve('http://www.gigasize.com/randomImage.php', "gigasize_tmp.jpg")
+
+ print ocr.get_captcha('gigasize_tmp.jpg')
diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py
index 8b3b4ccbc..12486fbc5 100644
--- a/module/plugins/captcha/captcha.py
+++ b/module/plugins/captcha/captcha.py
@@ -77,11 +77,6 @@ class OCR(object):
result = thread.e(command, inputdata)
return result
- def run_gocr(self):
- tmp = tempfile.NamedTemporaryFile(suffix=".jpg")
- self.image.save(tmp)
- self.result_captcha = self.run(['gocr', tmp.name]).replace("\n", "")
-
def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True):
#self.logger.debug("create tmp tif")
tmp = tempfile.NamedTemporaryFile(suffix=".tif")