Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
m0_73487616
dr_py
提交
0639d5f5
dr_py
项目概览
m0_73487616
/
dr_py
与 Fork 源项目一致
Fork自
晚风拂柳颜 / dr_py
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
dr_py
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0639d5f5
编写于
3月 28, 2023
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
自建
上级
14aad948
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
19 addition
and
14 deletion
+19
-14
libs/drpy2.js
libs/drpy2.js
+8
-7
libs/drpy2.min.js
libs/drpy2.min.js
+1
-1
test/测试OCR.py
test/测试OCR.py
+8
-4
txt/js/origin/原始JS.js
txt/js/origin/原始JS.js
+2
-2
未找到文件。
libs/drpy2.js
浏览文件 @
0639d5f5
...
...
@@ -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
}
`
)
}
...
...
libs/drpy2.min.js
浏览文件 @
0639d5f5
此差异已折叠。
点击以展开。
test/测试OCR.py
浏览文件 @
0639d5f5
...
...
@@ -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
=
''
...
...
txt/js/origin/原始JS.js
浏览文件 @
0639d5f5
...
...
@@ -66,12 +66,12 @@ function play(flag, id, flags) {
function
search
(
wd
,
quick
)
{
console
.
log
(
"
search
"
);
let
yzm_url
=
'
http://192.168.10.99:5705
1
/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
(
'
http
s://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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录