Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sjdr123
dr_py
提交
87019560
dr_py
项目概览
sjdr123
/
dr_py
与 Fork 源项目一致
Fork自
落幕懒人 / dr_py
通知
1
Star
0
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,发现更多精彩内容 >>
提交
87019560
编写于
3月 28, 2023
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ocr接口修改
上级
b81fb1a5
变更
10
展开全部
显示空白变更内容
内联
并排
Showing
10 changed file
with
52 addition
and
13 deletion
+52
-13
base/config.py
base/config.py
+2
-1
controllers/service.py
controllers/service.py
+3
-3
js/cokemv.js
js/cokemv.js
+4
-2
js/version.txt
js/version.txt
+1
-1
libs/drpy2.js
libs/drpy2.js
+6
-1
libs/drpy2.min.js
libs/drpy2.min.js
+1
-1
test/yzm.png
test/yzm.png
+0
-0
test/yzm1.png
test/yzm1.png
+0
-0
test/测试OCR.py
test/测试OCR.py
+31
-0
utils/encode.py
utils/encode.py
+4
-4
未找到文件。
base/config.py
浏览文件 @
87019560
...
...
@@ -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源
...
...
controllers/service.py
浏览文件 @
87019560
...
...
@@ -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
]
...
...
js/cokemv.js
浏览文件 @
87019560
...
...
@@ -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
js/version.txt
浏览文件 @
87019560
3.9.40beta7
\ No newline at end of file
3.9.40beta8
\ No newline at end of file
libs/drpy2.js
浏览文件 @
87019560
...
...
@@ -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
}
};
...
...
libs/drpy2.min.js
浏览文件 @
87019560
此差异已折叠。
点击以展开。
test/yzm.png
0 → 100644
浏览文件 @
87019560
424 字节
test/yzm1.png
0 → 100644
浏览文件 @
87019560
470 字节
test/测试OCR.py
0 → 100644
浏览文件 @
87019560
#!/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
utils/encode.py
浏览文件 @
87019560
...
...
@@ -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
=
'http
s://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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录