提交 87019560 编写于 作者: H hjdhnx

ocr接口修改

上级 b81fb1a5
......@@ -32,7 +32,8 @@ WALL_PAPER = "https://tuapi.eees.cc/api.php?category=fengjing&type=302" # 自
SUP_PORT = 9001 # supervisord 服务端口
RETRY_CNT = 3 # 验证码重试次数
# OCR_API = 'http://192.168.3.224:9000/api/ocr_img' # 验证码识别接口,传参数data
OCR_API = 'http://dm.mudery.com:10000' # 验证码识别接口,传参数data
# OCR_API = 'http://dm.mudery.com:10000' # 验证码识别接口,传参数data
OCR_API = 'https://api.nn.ci/ocr/b64/text' # 验证码识别接口,传参数data
UNAME = 'admin' # 管理员账号
PWD = 'drpy' # 管理员密码
USE_PY = 0 # 开启py源
......
......@@ -22,7 +22,7 @@ class storage_service(object):
def __init__(self):
conf_list = ['LIVE_URL', 'USE_PY', 'JS_MODE','JS0_DISABLE','JS0_PASSWORD','PLAY_URL', 'PLAY_DISABLE', 'LAZYPARSE_MODE', 'WALL_PAPER_ENABLE',
'WALL_PAPER', 'UNAME', 'PWD', 'LIVE_MODE', 'CATE_EXCLUDE', 'TAB_EXCLUDE','SEARCH_TIMEOUT','SEARCH_LIMIT','MULTI_MODE','XR_MODE','JS_PROXY','ENV','ALI_TOKEN']
'WALL_PAPER', 'UNAME', 'PWD', 'LIVE_MODE', 'CATE_EXCLUDE', 'TAB_EXCLUDE','SEARCH_TIMEOUT','SEARCH_LIMIT','MULTI_MODE','XR_MODE','JS_PROXY','ENV','ALI_TOKEN','OCR_API']
for conf in conf_list:
if not self.hasItem(conf):
print(f'开始初始化{conf}')
......@@ -32,9 +32,9 @@ class storage_service(object):
def getStoreConf(self):
# MAX_CONTENT_LENGTH 最大上传和端口ip一样是顶级配置,无法外部修改的
conf_list = ['LIVE_URL', 'LIVE_MODE','PLAY_URL', 'PID_URL','USE_PY','JS_MODE', 'JS0_DISABLE','JS0_PASSWORD','PLAY_DISABLE', 'LAZYPARSE_MODE', 'WALL_PAPER_ENABLE',
'WALL_PAPER', 'UNAME', 'PWD', 'CATE_EXCLUDE', 'TAB_EXCLUDE','SEARCH_TIMEOUT','SEARCH_LIMIT','MULTI_MODE','XR_MODE','JS_PROXY','ENV','ALI_TOKEN']
'WALL_PAPER', 'UNAME', 'PWD', 'CATE_EXCLUDE', 'TAB_EXCLUDE','SEARCH_TIMEOUT','SEARCH_LIMIT','MULTI_MODE','XR_MODE','JS_PROXY','ENV','ALI_TOKEN','OCR_API']
conf_name_list = ['直播地址', '直播模式','远程地址', '进程管理链接','启用py源', 'js模式','禁用js0','js0密码','禁用免嗅', '免嗅模式', '启用壁纸', '壁纸链接', '管理账号',
'管理密码', '分类排除', '线路排除','聚搜超时','搜索条数','多源模式','仙人模式','源代理','环境变量','阿里tk']
'管理密码', '分类排除', '线路排除','聚搜超时','搜索条数','多源模式','仙人模式','源代理','环境变量','阿里tk','OCR接口']
conf_lists = []
for i in range(len(conf_list)):
conf = conf_list[i]
......
......@@ -27,7 +27,9 @@ var rule = {
// class_parse:'.navbar-items li:gt(1):lt(7);a&&Text;a&&href;/(\\d+).html',
class_parse:'.navbar-items li:gt(1):lt(8);a&&Text;a&&href;/(\\d+).html',
searchUrl:'/index.php/ajax/suggest?mid=1&wd=**',
detailUrl:'/voddetail/fyid.html', //非必填,二级详情拼接链接
搜索:'json:list;name;pic;;id',
// searchUrl:'/index.php/ajax/suggest?mid=1&wd=**',
// 搜索:'json:list;name;pic;;id',
searchUrl:'/vodsearch/**-------------.html',
搜索:'a.module-card-item-poster;img&&alt;*;*;*',
}
\ No newline at end of file
3.9.40beta7
\ No newline at end of file
3.9.40beta8
\ No newline at end of file
......@@ -735,7 +735,12 @@ var OcrApi={
let html = request(this.api,{data:{img:img},headers:{'User-Agent':PC_UA},'method':'POST'},true);
html = JSON.parse(html);
code = html.url||'';
}catch (e) {}
// log('通过alist验证码接口过验证...');
// let html = request('https://api.nn.ci/ocr/b64/text',{data:img,headers:{'User-Agent':PC_UA},'method':'POST'},true);
// code = html||'';
}catch (e) {
log(`OCR识别验证码发生错误:${e.message}`)
}
return code
}
};
......
此差异已折叠。
test/yzm.png

424 字节

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : 测试OCR.py
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Author's Blog: https://blog.csdn.net/qq_32394351
# Date : 2023/3/28
import requests
import base64
requests.packages.urllib3.disable_warnings()
PC_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36'
UA = 'Mozilla/5.0'
api = 'https://api.nn.ci/ocr/b64/text'
api2 = 'http://dm.mudery.com:10000'
api3 = 'http://localhost:5705/parse/ocr'
def test():
with open('yzm1.png',mode='rb') as f:
img = f.read()
try:
# code = requests.post(api, data=base64.b64encode(img).decode(), headers={'user-agent': PC_UA}, verify=False).text
# code = requests.post(api, data=base64.b64encode(img).decode(), headers={'user-agent': PC_UA}, verify=False).text
code = requests.post(api3, data={"img":base64.b64encode(img).decode()}, headers={'user-agent': PC_UA}, verify=False).text
except Exception as e:
print(f'ocr识别发生错误:{e}')
code = ''
print(f'验证码为:{code}')
return code
if __name__ == '__main__':
test()
\ No newline at end of file
......@@ -12,8 +12,7 @@ from js2py.base import PyJsString
import requests,warnings
# 关闭警告
warnings.filterwarnings("ignore")
from requests.packages import urllib3
urllib3.disable_warnings()
requests.packages.urllib3.disable_warnings()
import requests.utils
import hashlib
......@@ -127,7 +126,8 @@ class OcrApi:
def classification(self,img):
try:
code = requests.post(self.api,data=img,headers={'user-agent':PC_UA},verify=False).text
# code = requests.post(self.api,data=img,headers={'user-agent':PC_UA},verify=False).text
code = requests.post(self.api,data=base64.b64encode(img).decode(),headers={'user-agent':PC_UA},verify=False).text
except Exception as e:
print(f'ocr识别发生错误:{e}')
code = ''
......@@ -136,7 +136,7 @@ class OcrApi:
def verifyCode(url,headers,timeout=5,total_cnt=3,api=None):
if not api:
# api = 'http://192.168.3.224:9000/api/ocr_img'
api = 'http://dm.mudery.com:10000'
api = 'https://api.nn.ci/ocr/b64/text'
lower_keys = list(map(lambda x: x.lower(), headers.keys()))
host = getHome(url)
if not 'referer' in lower_keys:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册