超级鹰的使用

利用超级鹰验证验证码

python 复制代码
from selenium import webdriver
from chaojiying import Chaojiying_Client

browser = webdriver.Chrome()
browser.get("")
username = browser.find_element(By.XPATH,"")
username.send_keys("")
password = browser.find_element(By.XPATH,"")
password.send_keys("")
img = browser.find_element().screenshot_as_png
chaojiying = Chaojiying_Client("username","password","soft_id")#用户中心>>软件ID 生成一个替换 96001
dic = chaojiying.postPic(img,1902)
verify_code = dic["pic_str"]#获取验证码
browser.find_element("").send_keys(verify_code)
browser.find_element("").click()
cookie_dict = browser.get_cookies()
print(cookie_dict)
browser.quit()

#使用cookie免密码登录网页

python 复制代码
browser = webdriver.Chrome()
browser.get("")
browser.implicitly_wait(10)
cookies = [{}]
for cookie in cookies
	if 'expiry' in cookie:
		del cookie['expiry']
	browser.add_cookie(cookie)
browser.refresh()
browser.get("")
  • 超级鹰代码
python 复制代码
#!/usr/bin/env python
# coding:utf-8

import requests
from hashlib import md5

class Chaojiying_Client(object):

    def __init__(self, username, password, soft_id):
        self.username = username
        password =  password.encode('utf8')
        self.password = md5(password).hexdigest()
        self.soft_id = soft_id
        self.base_params = {
            'user': self.username,
            'pass2': self.password,
            'softid': self.soft_id,
        }
        self.headers = {
            'Connection': 'Keep-Alive',
            'User-Agent': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)',
        }

    def PostPic(self, im, codetype):
        """
        im: 图片字节
        codetype: 题目类型 参考 http://www.chaojiying.com/price.html
        """
        params = {
            'codetype': codetype,
        }
        params.update(self.base_params)
        files = {'userfile': ('ccc.jpg', im)}
        r = requests.post('http://upload.chaojiying.net/Upload/Processing.php', data=params, files=files, headers=self.headers)
        return r.json()

    def PostPic_base64(self, base64_str, codetype):
        """
        im: 图片字节
        codetype: 题目类型 参考 http://www.chaojiying.com/price.html
        """
        params = {
            'codetype': codetype,
            'file_base64':base64_str
        }
        params.update(self.base_params)
        r = requests.post('http://upload.chaojiying.net/Upload/Processing.php', data=params, headers=self.headers)
        return r.json()

    def ReportError(self, im_id):
        """
        im_id:报错题目的图片ID
        """
        params = {
            'id': im_id,
        }
        params.update(self.base_params)
        r = requests.post('http://upload.chaojiying.net/Upload/ReportError.php', data=params, headers=self.headers)
        return r.json()


if __name__ == '__main__':
    chaojiying = Chaojiying_Client('yz572204188', 'mima', '96001')	#用户中心>>软件ID 生成一个替换 96001
    im = open('a.jpg', 'rb').read()													#本地图片文件路径 来替换 a.jpg 有时WIN系统须要//
    print(chaojiying.PostPic(im, 1902))											#1902 验证码类型  官方网站>>价格体系 3.4+版 print 后要加()
    #print chaojiying.PostPic(base64_str, 1902)  #此处为传入 base64代码
相关推荐
Python私教17 小时前
Playwright MCP 用 a11y 树抓页面:比全量 DOM 省 token 的采集 Agent
爬虫
枫叶林FYL19 小时前
项目九:异步高性能爬虫与数据采集中枢 —— 基于 Crawl<sub>4</sub>AI 与 Playwright 的现代化数据采集平台 项目总览
爬虫·python·深度学习·wpf
影sir21 小时前
Selenium常用函数(窗口与弹窗)
selenium·测试工具
上海云盾-小余1 天前
恶意爬虫精准拦截:网站流量净化与资源守护方案
网络·爬虫·web安全
小白学大数据1 天前
深度探索:Python 爬虫实现豆瓣音乐全站采集
开发语言·爬虫·python·数据分析
烟雨江南aabb1 天前
Python第六弹:python爬虫篇:什么是爬虫
开发语言·爬虫·python
深蓝电商API1 天前
分布式电商爬虫架构:Scrapy-Redis+消息队列的集群部署
分布式·爬虫·架构
WL_Aurora2 天前
Python爬虫实战(六):新发地蔬菜价格数据采集.
爬虫·python
盲敲代码的阿豪2 天前
Python 入门基础教程(爬虫前置版)
开发语言·爬虫·python
深蓝电商API2 天前
电商网站行为检测绕过:鼠标轨迹模拟 + 点击热区分析
爬虫