美文网首页
python 闪烁验证码识别问题

python 闪烁验证码识别问题

作者: 王镇_ee87 | 来源:发表于2020-12-24 10:53 被阅读0次

同事写的博客

思路就是:把gif图片每一帧都识别一下,然后拼接到一起
url = "https://www.******.cn:****/stcs/getCaptcha"
res = sess.get(url=url, headers=headers).content
im = Image.open(io.BytesIO(res))

im.save('1.png')
r = dm(im)

im.seek(im.tell() + 1)
im.save('2.png')
r = dm(im)

im.seek(im.tell() + 1)
im.save('3.png')
r = dm(im)

im.seek(im.tell() + 1)
im.save('4.png')
r = dm(im)

得到效果最好的代码

# 前两位
if a.get('4')[:2] == a.get('3')[:2] or a.get('2')[:2] == a.get('3')[:2]:
    res = a.get('3')[:2]
elif a.get('2')[:1] == a.get('3')[1:2]:
    res = a.get('3')[:2]
else:
    res = a.get('4')[:2]
# 第三位
res += a.get('3')[-1:]
# 最后一位
res += a.get('1')[-1:]
print(res)

相关文章

网友评论

      本文标题:python 闪烁验证码识别问题

      本文链接:https://www.haomeiwen.com/subject/fpabwktx.html