提交 0639d5f5 编写于 作者: H hjdhnx

自建

上级 14aad948
......@@ -79,7 +79,8 @@ const OCR_RETRY = 3;//ocr验证重试次数
// const OCR_API = 'http://dm.mudery.com:10000';//ocr在线识别接口
// const OCR_API = 'http://192.168.3.239:5705/parse/ocr';//ocr在线识别接口
// const OCR_API = 'http://cms.nokia.press/parse/ocr';//ocr在线识别接口
const OCR_API = 'http://cms.nokia.press:5707/parse/ocr';//ocr在线识别接口
// const OCR_API = 'http://cms.nokia.press:5707/parse/ocr';//ocr在线识别接口
const OCR_API = 'http://drpy.nokia.press:8028/ocr/drpy/text';//ocr在线识别接口
if(typeof(MY_URL)==='undefined'){
var MY_URL; // 全局注入变量,pd函数需要
}
......@@ -733,12 +734,12 @@ var OcrApi={
classification:function (img){ // img是byte类型,这里不方便搞啊
let code = '';
try {
let html = request(this.api,{data:{img:img},headers:{'User-Agent':PC_UA},'method':'POST'},true);
html = JSON.parse(html);
code = html.url||'';
// log('通过alist验证码接口过验证...');
// let html = request('https://api.nn.ci/ocr/b64/text',{data:img,headers:{'User-Agent':PC_UA},'method':'POST'},true);
// code = html||'';
// let html = request(this.api,{data:{img:img},headers:{'User-Agent':PC_UA},'method':'POST'},true);
// html = JSON.parse(html);
// code = html.url||'';
log('通过drpy_ocr验证码接口过验证...');
let html = request(OCR_API,{data:{img:img},headers:{'User-Agent':PC_UA},'method':'POST'},true);
code = html||'';
}catch (e) {
log(`OCR识别验证码发生错误:${e.message}`)
}
......
此差异已折叠。
......@@ -10,10 +10,13 @@ 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'
# api = 'https://api.nn.ci/ocr/b64/text'
api = 'http://192.168.10.99:9898/ocr/b64/text'
api2 = 'http://dm.mudery.com:10000'
# api3 = 'http://localhost:5705/parse/ocr'
api3 = 'http://cms.nokia.press:5707/parse/ocr'
api3 = 'http://localhost:5705/parse/ocr'
# api4 = 'http://192.168.10.99:9898/ocr/drpy/text'
api4 = 'http://drpy.nokia.press:8028/ocr/drpy/text'
# api3 = 'http://cms.nokia.press:5707/parse/ocr'
def test():
with open('yzm1.png',mode='rb') as f:
img = f.read()
......@@ -21,7 +24,8 @@ def test():
print(base64.b64encode(img).decode())
# 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
# code = requests.post(api3, data={"img":base64.b64encode(img).decode()}, headers={'user-agent': PC_UA}, verify=False).text
code = requests.post(api4, data={"img":base64.b64encode(img).decode()}, headers={'user-agent': PC_UA}, verify=False).text
except Exception as e:
print(f'ocr识别发生错误:{e}')
code = ''
......
......@@ -66,12 +66,12 @@ function play(flag, id, flags) {
function search(wd, quick) {
console.log("search");
let yzm_url = 'http://192.168.10.99:57051/static/img/yzm.png';
let yzm_url = 'http://192.168.10.99:5705/static/img/yzm.png';
console.log('测试验证码地址:',yzm_url);
let img_base64 = req(yzm_url,{buffer:2}).content;
console.log(img_base64);
// const res = req('https://api.nn.ci/ocr/b64/text', {body:img_base64,method:'POST'});
const res = req('https://api.nn.ci/ocr/b64/text', {data:img_base64,method:'POST',headers:{'content-type':'text/plain'}});
const res = req('http://drpy.nokia.press:8028/ocr/drpy/text', {data:{img:img_base64},method:'POST'});
console.log('验证码识别结果:',res.content);
let d = [];
d.push({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册