用selenium实现打码平台
注:本文以 人人网登陆 为例
import time
from selenium import webdriver
# 准备一个名为yudama的py文件
from yudama import indetify_by_filepath driver = webdriver.Chrome()
driver.get('http://www.renren.com/') # 输入账号框的id:email
输入人人网账号
# 输入密码框的id:password
输入人人网密码
driver.find_element_by_id('email').send_keys('xxx')
driver.find_element_by_id('password').send_keys('xxx') # 半自动
# icode = input('请输入验证码:') # 全自动解决验证码
time.sleep(1)
# 验证码id:verifyPic_login
# 根据验证码图片的id找到验证码
verifyPic = driver.find_elements_by_id('verifyPic_login')
if verifyPic:
img = verifyPic[0].screenshot_as_png
icode=indetify_by_filepath(img)
# 输入验证码框的id:icode
driver.find_element_by_id('icode').send_keys(icode)
# 登录键id:login
driver.find_element_by_id('login').click() # time.sleep(5)
# driver.close()
百度搜索 云打码

点击开发文档

调用示例及最新DLL --> PythonHTTP示例下载

打开下载好的py文件,更改配置
yudama.py
#coding=utf-8
import http.client, mimetypes, urllib, json, time, requests ###################################################################### class YDMHttp:
apiurl = 'http://api.yundama.com/api.php'
username = ''
password = ''
appid = ''
appkey = '' def __init__(self, username, password, appid, appkey):
self.username = username
self.password = password
self.appid = str(appid)
self.appkey = appkey def request(self, fields, files=[]):
response = self.post_url(self.apiurl, fields, files)
response = json.loads(response)
return response def balance(self):
data = {'method': 'balance', 'username': self.username, 'password': self.password, 'appid': self.appid,
'appkey': self.appkey}
response = self.request(data)
if (response):
if (response['ret'] and response['ret'] < 0):
return response['ret']
else:
return response['balance']
else:
return -9001 def login(self):
data = {'method': 'login', 'username': self.username, 'password': self.password, 'appid': self.appid,
'appkey': self.appkey}
response = self.request(data)
if (response):
if (response['ret'] and response['ret'] < 0):
return response['ret']
else:
return response['uid']
else:
return -9001 def upload(self, filename, codetype, timeout):
data = {'method': 'upload', 'username': self.username, 'password': self.password, 'appid': self.appid,
'appkey': self.appkey, 'codetype': str(codetype), 'timeout': str(timeout)}
file = {'file': filename}
response = self.request(data, file)
if (response):
if (response['ret'] and response['ret'] < 0):
return response['ret']
else:
return response['cid']
else:
return -9001 def result(self, cid):
data = {'method': 'result', 'username': self.username, 'password': self.password, 'appid': self.appid,
'appkey': self.appkey, 'cid': str(cid)}
response = self.request(data)
return response and response['text'] or '' def decode(self, filename, codetype, timeout):
cid = self.upload(filename, codetype, timeout)
if (cid > 0):
for i in range(0, timeout):
result = self.result(cid)
if (result != ''):
return cid, result
else:
time.sleep(1)
return -3003, ''
else:
return cid, '' def post_url(self, url, fields, files=[]):
# for key in files:
# files[key] = open(files[key], 'rb');
res = requests.post(url, files=files, data=fields)
return res.text ###################################################################### # 用户名 输入自己云打码账号
username = 'xxx' # 密码 输入自己的云打码密码
password = 'xxx' # appid
appid = 1 # appkey
appkey = '22cc5376925e9387a23cf797cb9ba745' # 验证码类型
codetype = 1005 # 超时
timeout = 60 def indetify(response_content):
if (username == 'username'):
print('请设置好相关参数再测试')
else:
# 初始化
yundama = YDMHttp(username, password, appid, appkey) # 登陆云打码
uid = yundama.login()
print('uid: %s' % uid) # 查询余额
balance = yundama.balance()
print('balance: %s' % balance) # 开始识别,图片路径,验证码类型ID,超时时间(秒),识别结果
cid, result = yundama.decode(response_content, codetype, timeout)
print('cid: %s, result: %s' % (cid, result))
return result def indetify_by_filepath(file_path): #打开注释
if (username == 'username'):
print('请设置好相关参数再测试')
else:
# 初始化
yundama = YDMHttp(username, password, appid, appkey) # 登陆云打码
uid = yundama.login()
print('uid: %s' % uid) # 查询余额
balance = yundama.balance()
print('balance: %s' % balance) # 开始识别,图片路径,验证码类型ID,超时时间(秒),识别结果
cid, result = yundama.decode(file_path, codetype, timeout)
print('cid: %s, result: %s' % (cid, result))
return result ######################################################################
if __name__ == '__main__':
url = "http://qian.sicent.com/Login/code.do"
content = requests.get(url).content
# 以二进制形式写入文件
with open("test.png", "wb") as f:
f.write(content)
indetify(content)
用selenium实现打码平台的更多相关文章
- Python 自动登录哔哩哔哩(2captcha打码平台)
前言 研究爬虫的各位小伙伴都知道,需要登录才能获取信息的网站,是比较难爬的,原因就是在于,现在各大网站为了反爬,都加入了图片验证码,滑动验证码之类的干扰 本篇就针对哔哩哔哩的滑动验证码进行讲解和破解 ...
- python爬虫之selenium+打码平台识别验证码
1.常用的打码平台:超级鹰.打码兔等 2.打码平台在识别图形验证码和点触验证码上比较好用 (1)12306点触验证码 from selenium import webdriver from selen ...
- selenium模块使用详解、打码平台使用、xpath使用、使用selenium爬取京东商品信息、scrapy框架介绍与安装
今日内容概要 selenium的使用 打码平台使用 xpath使用 爬取京东商品信息 scrapy 介绍和安装 内容详细 1.selenium模块的使用 # 之前咱们学requests,可以发送htt ...
- uu云验证码识别平台,验证码,验证码识别,全自动验证码识别技术,优优云全自动打码,代答题系统,优优云远程打码平台,uu云打码
uu云验证码识别平台,验证码,验证码识别,全自动验证码识别技术,优优云全自动打码,代答题系统,优优云远程打码平台,uu云打码 优优云验证码识别答题平台介绍 优优云|UU云(中国公司)是全球唯一领先的智 ...
- 代理 IP 云打码平台的使用
代理ip 获取代理ip的网站: 快代理 西祠代理 www.goubanjia.com #代理ip import requests headers = { 'User-Agent':'Mozilla/5 ...
- 若快打码平台python开发文档修改版
一.打码的作用 在进行爬虫过程中,部分网站的登录验证码是比较简单的,例如四个英文数字随机组合而成的验证码,有的是全数字随机组成的验证码,有的是全中文随机组成的验证码.为了爬虫进行自动化,需要解决自动登 ...
- Python学习--打码平台
打码平台介绍 作用:可以通过第三方平台进行智能识别或者人工识别图片. 优点:1. 价格便宜: 2. 使用简单: 3. 识别率高 平台介绍: - 云打码(推荐) [http://www.yundama. ...
- Python 通过打码平台实现验证码
在爬虫时,经常遇到登录需要验证码的情况,简单的验证码可以自己解决,复制的验证码需要借助机器学习,有一定的难度.还有一个简单的方案就是采用付费的打码平台. 比如R若快(http://www.ruokua ...
- 调用打码平台api获取验证码 (C#版)
一.打码平台很多,这里选择两个:联众和斐斐 联众开发文档: https://www.jsdati.com/docs/guide 斐斐开发文档: http://docs.fateadm.com/web/ ...
随机推荐
- opencv之为图像添加边界
我们经常会有对图像边缘做扩展的需求.比如 希望卷积后得到的矩阵大小不变 希望改变图像大小,但是不改变宽高比 opencv实现 opencv中使用copyMakeBorder()来完成这一功能 api ...
- CSS定位与布局
我们在编写网页代码时,首先应该做的就是设计好页面的布局形式,然后再往里面填充内容.网页布局的好与坏,直接决定了网页最终的展示效果.PC端常见的网页布局形式有两列布局.三列布局等.在CSS中,我们通常使 ...
- 【python小随笔】字典的使用
字典也是 Python 提供的一种常用的数据结构,它用于存放具有映射关系的数据. 比如有份成绩表数据,语文:79,数学:80,英语:92,这组数据看上去像两个列表,但这两个列表的元素之间有一定的关联关 ...
- 软件开发工具(第7章:Eclipse入门)
一.Eclipse简介 Eclipse [iˈklips],是一个开放源代 码的.基于Java的可扩展集成应 用程序开发环境. Eclipse最初主要用来进行Java语 言开发,但并非只有这个用途. ...
- Spring Boot 2.X(一):入门篇
什么是 Spring Boot Spring Boot 是由 Pivotal 团队提供的全新框架,其设计目的是用来简化新 Spring 应用的初始搭建以及开发过程.该框架遵循"约定优于配置& ...
- 分库分表(5) ---SpringBoot + ShardingSphere 实现分库分表
分库分表(5)--- ShardingSphere实现分库分表 有关分库分表前面写了四篇博客: 1.分库分表(1) --- 理论 2.分库分表(2) --- ShardingSphere(理论) 3. ...
- SEER流量众筹模块开发测试网络及使用文档发布
SEER利用区块链奖励机制,可解决传统体育赛事痛点,提高行业运转效率.比如提高赛事方收入,让观众自由选择想看的比赛,给予赛事众筹的参与者贡献影响力,使其获得由智能合约量化的激励等.此功能可广泛应用于包 ...
- 使用TryGetComponent取代GetComponent以避免Editor中的内存分配
作为Unity开发人员,可能或多或少都会遇到过一个常见的Unity的GC分配问题——在Editor中使用GetComponent方法来获取一个不存在的Component时会分配额外的内存.就像下图 需 ...
- Error response from daemon: Get https://registry-1.docker.io/v2/library/nginx/manifests/1.14-alpine: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fnginx%3Apull&service=registry.docker.
docker pull 镜像时报错: Error response from daemon: Get https://registry-1.docker.io/v2/library/nginx/man ...
- Flask的路由解读以及其配置
from flask import Flask app =Flask(__name__) 一.配置 配置一共有四中方式 方法一: 只能设置以下两种属性 app.debug=True app.secre ...