Python3WebSpider / CrackGeetest

Crack Geetest
156 stars 141 forks source link

高分辨率屏幕下裁剪图片的修正办法 #3

Open smh2028 opened 6 years ago

smh2028 commented 6 years ago

captcha = screenshot.crop((left, top, right, bottom)) 作者的屏幕应该不是高分辨率,文本缩放是100%的。我的是19201080,为了看着舒服就把文本缩放调到了125%。这里把crop的各个参数都乘以相应的缩放倍数就好: `captcha = screenshot.crop((left1.25,top1.25,right1.25,bottom*1.25))`

yuanxiang1 commented 6 years ago

我的也是高分辨率的,怪不得老是对不上验证码图片,我的缩放是100%,但是需要调成1.5倍才能获取到验证码的图片

goodbad3 commented 6 years ago

可试搞成1.25倍还报错

goodbad3 commented 6 years ago

def get_geetest_image(self, name='captcha.png'): """ 获取验证码图片 :return: 图片对象 """ top, bottom, left, right = self.get_position() print('验证码位置', top, bottom, left, right) screenshot = self.get_screenshot() captcha = screenshot.crop((1.25 left,1.25 top,1.25 right,1.25 bottom))

size = 323,199

    #captcha.thumbnail(size)
    captcha.save(name)
    return captcha
goodbad3 commented 6 years ago

========================= RESTART: E:\Desktop\滑动.py ========================= 验证码位置 173 332.0833282470703 569 827.5166625976562 验证码位置 173 332.0833282470703 569 827.5166625976562 缺口位置 60 滑动轨迹 [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2, 2] Traceback (most recent call last): File "E:\Desktop\滑动.py", line 220, in crack.crack() File "E:\Desktop\滑动.py", line 208, in crack EC.text_to_be_present_in_element((By.CLASS_NAME, 'geetest_success_radar_tip_content'), '验证成功')) File "D:\python35\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message:

goodbad3 commented 6 years ago

验证码都能清楚看见

goodbad3 commented 6 years ago

@smh2028 ,可以发一下成功的源码没????

smh2028 commented 6 years ago

@goodbad3 我修改的部分贴出来了,只是增加了1.25这个倍数,其他的都和作者的源码一致

goodbad3 commented 6 years ago

@smh2028,改了1.25只是图片能全看见了,其它还是不成功,尴尬