Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
逆着光、寻觅
dr_py
提交
806a20f7
dr_py
项目概览
逆着光、寻觅
/
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,发现更多精彩内容 >>
提交
806a20f7
编写于
9月 16, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
版本升级
上级
ca27fd9f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
104 addition
and
56 deletion
+104
-56
base/rules.db
base/rules.db
+0
-0
controllers/vod.py
controllers/vod.py
+102
-55
js/version.txt
js/version.txt
+1
-1
readme.md
readme.md
+1
-0
未找到文件。
base/rules.db
浏览文件 @
806a20f7
无法预览此类型文件
controllers/vod.py
浏览文件 @
806a20f7
...
@@ -23,70 +23,116 @@ from concurrent.futures import ThreadPoolExecutor,as_completed,thread # 引入
...
@@ -23,70 +23,116 @@ from concurrent.futures import ThreadPoolExecutor,as_completed,thread # 引入
vod
=
Blueprint
(
"vod"
,
__name__
)
vod
=
Blueprint
(
"vod"
,
__name__
)
@
vod
.
route
(
'/vod'
)
def
search_one
(
rule
,
wd
,
before
:
str
=
''
):
def
vod_home
():
t1
=
time
()
def
search_one
(
rule
,
wd
,
before
:
str
=
''
):
if
not
before
:
t1
=
time
()
with
open
(
'js/模板.js'
,
encoding
=
'utf-8'
)
as
f
:
if
not
before
:
before
=
f
.
read
()
with
open
(
'js/模板.js'
,
encoding
=
'utf-8'
)
as
f
:
js_path
=
f
'js/
{
rule
}
.js'
before
=
f
.
read
()
try
:
js_path
=
f
'js/
{
rule
}
.js'
ctx
,
js_code
=
parser
.
runJs
(
js_path
,
before
=
before
)
ctx
,
js_code
=
parser
.
runJs
(
js_path
,
before
=
before
)
if
not
js_code
:
if
not
js_code
:
return
None
return
None
ruleDict
=
ctx
.
rule
.
to_dict
()
ruleDict
=
ctx
.
rule
.
to_dict
()
ruleDict
[
'id'
]
=
rule
# 把路由请求的id装到字典里,后面播放嗅探才能用
ruleDict
[
'id'
]
=
rule
# 把路由请求的id装到字典里,后面播放嗅探才能用
logger
.
info
(
f
'规则
{
rule
}
装载耗时:
{
get_interval
(
t1
)
}
毫秒'
)
logger
.
info
(
f
'规则
{
rule
}
装载耗时:
{
get_interval
(
t1
)
}
毫秒'
)
try
:
cms
=
CMS
(
ruleDict
,
db
,
RuleClass
,
PlayParse
,
cfg
)
cms
=
CMS
(
ruleDict
,
db
,
RuleClass
,
PlayParse
,
cfg
)
data
=
cms
.
searchContent
(
wd
,
show_name
=
True
)
data
=
cms
.
searchContent
(
wd
,
show_name
=
True
)
return
data
return
data
except
Exception
as
e
:
except
Exception
as
e
:
print
(
f
'
{
rule
}
发生错误:
{
e
}
'
)
print
(
f
'
{
rule
}
发生错误:
{
e
}
'
)
return
None
return
None
def
multi_search2
(
wd
):
t1
=
time
()
lsg
=
storage_service
()
try
:
timeout
=
round
(
int
(
lsg
.
getItem
(
'SEARCH_TIMEOUT'
,
5000
))
/
1000
,
2
)
except
:
timeout
=
5
rules
=
getRules
(
'js'
)[
'list'
]
rule_names
=
list
(
map
(
lambda
x
:
x
[
'name'
],
rules
))
rules_exclude
=
[
'drpy'
]
new_rules
=
list
(
filter
(
lambda
x
:
x
.
get
(
'searchable'
,
0
)
and
x
.
get
(
'name'
,
''
)
not
in
rules_exclude
,
rules
))
search_sites
=
[
new_rule
[
'name'
]
for
new_rule
in
new_rules
]
nosearch_sites
=
set
(
rule_names
)
^
set
(
search_sites
)
nosearch_sites
.
remove
(
'drpy'
)
# print(nosearch_sites)
logger
.
info
(
f
'开始聚搜
{
wd
}
,共计
{
len
(
search_sites
)
}
个规则,聚搜超时
{
timeout
}
秒'
)
logger
.
info
(
f
'不支持聚搜的规则,共计
{
len
(
nosearch_sites
)
}
个规则:
{
","
.
join
(
nosearch_sites
)
}
'
)
# print(search_sites)
res
=
[]
with
open
(
'js/模板.js'
,
encoding
=
'utf-8'
)
as
f
:
before
=
f
.
read
()
logger
.
info
(
f
'聚搜准备工作耗时:
{
get_interval
(
t1
)
}
毫秒'
)
t2
=
time
()
thread_pool
=
ThreadPoolExecutor
(
len
(
search_sites
))
# 定义线程池来启动多线程执行此任务
obj_list
=
[]
try
:
for
site
in
search_sites
:
obj
=
thread_pool
.
submit
(
search_one
,
site
,
wd
,
before
)
obj_list
.
append
(
obj
)
thread_pool
.
shutdown
(
wait
=
True
)
# 等待所有子线程并行完毕
vod_list
=
[
obj
.
result
()
for
obj
in
obj_list
]
for
vod
in
vod_list
:
if
vod
and
isinstance
(
vod
,
dict
)
and
vod
.
get
(
'list'
)
and
len
(
vod
[
'list'
])
>
0
:
res
.
extend
(
vod
[
'list'
])
result
=
{
'list'
:
res
}
logger
.
info
(
f
'drpy聚搜
{
len
(
search_sites
)
}
个源耗时
{
get_interval
(
t2
)
}
毫秒,含准备共计耗时
{
get_interval
(
t1
)
}
毫秒'
)
except
Exception
as
e
:
result
=
{
'list'
:
[]
}
logger
.
info
(
f
'drpy聚搜
{
len
(
search_sites
)
}
个源耗时
{
get_interval
(
t2
)
}
毫秒,含准备共计耗时:
{
get_interval
(
t1
)
}
毫秒,发生错误:
{
e
}
'
)
return
jsonify
(
result
)
def
multi_search
(
wd
):
def
multi_search
(
wd
):
lsg
=
storage_service
()
lsg
=
storage_service
()
t1
=
time
()
t1
=
time
()
try
:
timeout
=
round
(
int
(
lsg
.
getItem
(
'SEARCH_TIMEOUT'
,
5000
))
/
1000
,
2
)
except
:
timeout
=
5
rules
=
getRules
(
'js'
)[
'list'
]
rule_names
=
list
(
map
(
lambda
x
:
x
[
'name'
],
rules
))
rules_exclude
=
[
'drpy'
]
new_rules
=
list
(
filter
(
lambda
x
:
x
.
get
(
'searchable'
,
0
)
and
x
.
get
(
'name'
,
''
)
not
in
rules_exclude
,
rules
))
search_sites
=
[
new_rule
[
'name'
]
for
new_rule
in
new_rules
]
nosearch_sites
=
set
(
rule_names
)
^
set
(
search_sites
)
nosearch_sites
.
remove
(
'drpy'
)
# print(nosearch_sites)
logger
.
info
(
f
'开始聚搜
{
wd
}
,共计
{
len
(
search_sites
)
}
个规则,聚搜超时
{
timeout
}
秒'
)
logger
.
info
(
f
'不支持聚搜的规则,共计
{
len
(
nosearch_sites
)
}
个规则:
{
","
.
join
(
nosearch_sites
)
}
'
)
# print(search_sites)
res
=
[]
with
open
(
'js/模板.js'
,
encoding
=
'utf-8'
)
as
f
:
before
=
f
.
read
()
with
ThreadPoolExecutor
(
max_workers
=
len
(
search_sites
))
as
executor
:
to_do
=
[]
for
site
in
search_sites
:
future
=
executor
.
submit
(
search_one
,
site
,
wd
,
before
)
to_do
.
append
(
future
)
try
:
try
:
timeout
=
round
(
int
(
lsg
.
getItem
(
'SEARCH_TIMEOUT'
,
5000
))
/
1000
,
2
)
for
future
in
as_completed
(
to_do
,
timeout
=
timeout
):
# 并发执行
except
:
ret
=
future
.
result
()
timeout
=
5
# print(ret)
rules
=
getRules
(
'js'
)[
'list'
]
if
ret
and
isinstance
(
ret
,
dict
)
and
ret
.
get
(
'list'
):
rule_names
=
list
(
map
(
lambda
x
:
x
[
'name'
],
rules
))
res
.
extend
(
ret
[
'list'
])
rules_exclude
=
[
'drpy'
]
except
Exception
as
e
:
new_rules
=
list
(
filter
(
lambda
x
:
x
.
get
(
'searchable'
,
0
)
and
x
.
get
(
'name'
,
''
)
not
in
rules_exclude
,
rules
))
print
(
f
'发生错误:
{
e
}
'
)
search_sites
=
[
new_rule
[
'name'
]
for
new_rule
in
new_rules
]
import
atexit
nosearch_sites
=
set
(
rule_names
)
^
set
(
search_sites
)
atexit
.
unregister
(
thread
.
_python_exit
)
nosearch_sites
.
remove
(
'drpy'
)
executor
.
shutdown
=
lambda
wait
:
None
# print(nosearch_sites)
logger
.
info
(
f
'drpy聚搜
{
len
(
search_sites
)
}
个源共计耗时
{
get_interval
(
t1
)
}
毫秒'
)
logger
.
info
(
f
'开始聚搜
{
wd
}
,共计
{
len
(
search_sites
)
}
个规则,聚搜超时
{
timeout
}
秒'
)
return
jsonify
({
logger
.
info
(
f
'不支持聚搜的规则,共计
{
len
(
nosearch_sites
)
}
个规则:
{
","
.
join
(
nosearch_sites
)
}
'
)
"list"
:
res
# print(search_sites)
})
res
=
[]
with
open
(
'js/模板.js'
,
encoding
=
'utf-8'
)
as
f
:
before
=
f
.
read
()
with
ThreadPoolExecutor
(
max_workers
=
len
(
search_sites
))
as
executor
:
to_do
=
[]
for
site
in
search_sites
:
future
=
executor
.
submit
(
search_one
,
site
,
wd
,
before
)
to_do
.
append
(
future
)
try
:
for
future
in
as_completed
(
to_do
,
timeout
=
timeout
):
# 并发执行
ret
=
future
.
result
()
# print(ret)
if
ret
and
isinstance
(
ret
,
dict
)
and
ret
.
get
(
'list'
):
res
.
extend
(
ret
[
'list'
])
except
Exception
as
e
:
print
(
f
'发生错误:
{
e
}
'
)
import
atexit
atexit
.
unregister
(
thread
.
_python_exit
)
executor
.
shutdown
=
lambda
wait
:
None
logger
.
info
(
f
'drpy聚搜
{
len
(
search_sites
)
}
个源共计耗时
{
get_interval
(
t1
)
}
毫秒'
)
return
jsonify
({
"list"
:
res
})
@
vod
.
route
(
'/vod'
)
def
vod_home
():
t0
=
time
()
t0
=
time
()
rule
=
getParmas
(
'rule'
)
rule
=
getParmas
(
'rule'
)
ac
=
getParmas
(
'ac'
)
ac
=
getParmas
(
'ac'
)
...
@@ -187,6 +233,7 @@ def vod_home():
...
@@ -187,6 +233,7 @@ def vod_home():
if
rule
==
'drpy'
:
if
rule
==
'drpy'
:
# print(f'准备单独处理聚合搜索:{wd}')
# print(f'准备单独处理聚合搜索:{wd}')
return
multi_search
(
wd
)
return
multi_search
(
wd
)
# return multi_search2(wd)
else
:
else
:
data
=
cms
.
searchContent
(
wd
)
data
=
cms
.
searchContent
(
wd
)
# print(data)
# print(data)
...
...
js/version.txt
浏览文件 @
806a20f7
3.6.9
3.6.10
\ No newline at end of file
\ No newline at end of file
readme.md
浏览文件 @
806a20f7
...
@@ -55,6 +55,7 @@
...
@@ -55,6 +55,7 @@
-
[X] 6.增加豆瓣首页插件以及详情评分功能,可以custom自定义
-
[X] 6.增加豆瓣首页插件以及详情评分功能,可以custom自定义
-
[X] 7.增加嗅探配置,可自定义
-
[X] 7.增加嗅探配置,可自定义
-
[X] 8.版本升级 至3.6.9
-
[X] 8.版本升级 至3.6.9
-
[X] 9.版本升级 至3.7.10,优化drpy搜索必定成功
###### 2022/09/15
###### 2022/09/15
-
[X] 1.修复生成配置文件中静态文件链接对应的配置文本爬虫地址渲染异常问题
-
[X] 1.修复生成配置文件中静态文件链接对应的配置文本爬虫地址渲染异常问题
-
[X] 2.删除custom里的xb、xp源
-
[X] 2.删除custom里的xb、xp源
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录