Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
言程序plus
dr_py
提交
329525d2
dr_py
项目概览
言程序plus
/
dr_py
与 Fork 源项目一致
从无法访问的项目Fork
通知
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,发现更多精彩内容 >>
提交
329525d2
编写于
9月 01, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加模板
上级
ee72f8f9
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
81 addition
and
5 deletion
+81
-5
classes/cms.py
classes/cms.py
+5
-0
config.py
config.py
+1
-0
js/vip影院.js
js/vip影院.js
+7
-0
js/模板.js
js/模板.js
+21
-0
js/玩偶姐姐.js
js/玩偶姐姐.js
+1
-0
models/rules.db
models/rules.db
+0
-0
readme.md
readme.md
+4
-0
templates/admin.html
templates/admin.html
+23
-2
templates/index.html
templates/index.html
+1
-1
utils/htmlParser.py
utils/htmlParser.py
+18
-2
未找到文件。
classes/cms.py
浏览文件 @
329525d2
...
@@ -39,6 +39,7 @@ class CMS:
...
@@ -39,6 +39,7 @@ class CMS:
self
.
retry_count
=
new_conf
.
get
(
'RETRY_CNT'
,
3
)
self
.
retry_count
=
new_conf
.
get
(
'RETRY_CNT'
,
3
)
self
.
lazy_mode
=
new_conf
.
get
(
'LAZYPARSE_MODE'
)
self
.
lazy_mode
=
new_conf
.
get
(
'LAZYPARSE_MODE'
)
self
.
ocr_api
=
new_conf
.
get
(
'OCR_API'
)
self
.
ocr_api
=
new_conf
.
get
(
'OCR_API'
)
self
.
cate_exclude
=
new_conf
.
get
(
'CATE_EXCLUDE'
,
''
)
try
:
try
:
self
.
vod
=
redirect
(
url_for
(
'vod'
)).
headers
[
'Location'
]
self
.
vod
=
redirect
(
url_for
(
'vod'
)).
headers
[
'Location'
]
except
:
except
:
...
@@ -352,6 +353,7 @@ class CMS:
...
@@ -352,6 +353,7 @@ class CMS:
r
.
encoding
=
self
.
encoding
r
.
encoding
=
self
.
encoding
html
=
r
.
text
html
=
r
.
text
# print(html)
# print(html)
# print(self.headers)
if
self
.
class_parse
and
not
has_cache
:
if
self
.
class_parse
and
not
has_cache
:
p
=
self
.
class_parse
.
split
(
';'
)
p
=
self
.
class_parse
.
split
(
';'
)
# print(p)
# print(p)
...
@@ -364,6 +366,9 @@ class CMS:
...
@@ -364,6 +366,9 @@ class CMS:
# print(items)
# print(items)
for
item
in
items
:
for
item
in
items
:
title
=
pdfh
(
item
,
p
[
1
])
title
=
pdfh
(
item
,
p
[
1
])
# 过滤排除掉标题名称
if
self
.
cate_exclude
and
jsp
.
test
(
self
.
cate_exclude
,
title
):
continue
url
=
pd
(
item
,
p
[
2
])
url
=
pd
(
item
,
p
[
2
])
# print(url)
# print(url)
tag
=
url
tag
=
url
...
...
config.py
浏览文件 @
329525d2
...
@@ -31,4 +31,5 @@ UNAME = 'admin' # 管理员账号
...
@@ -31,4 +31,5 @@ UNAME = 'admin' # 管理员账号
PWD
=
'drpy'
# 管理员密码
PWD
=
'drpy'
# 管理员密码
MAX_CONTENT_LENGTH
=
1
*
1024
*
1024
/
100
# 100 kB
MAX_CONTENT_LENGTH
=
1
*
1024
*
1024
/
100
# 100 kB
LIVE_MODE
=
1
# 0 本地 1外网
LIVE_MODE
=
1
# 0 本地 1外网
CATE_EXCLUDE
=
'首页|留言'
# 动态分类过滤
# {% if config.WALL_PAPER %}"wallpaper":"{{ config.WALL_PAPER }}",{% endif %}
# {% if config.WALL_PAPER %}"wallpaper":"{{ config.WALL_PAPER }}",{% endif %}
\ No newline at end of file
js/vip影院.js
0 → 100644
浏览文件 @
329525d2
var
rule
=
Object
.
assign
(
muban
.
vfed
,{
title
:
'
VIP影院
'
,
host
:
'
http://360yy.cn
'
,
url
:
'
/index.php/vod/show/id/fyclass/page/fypage.html
'
,
searchUrl
:
'
/index.php/vod/search/page/fypage/wd/**.html
'
,
});
\ No newline at end of file
js/模板.js
浏览文件 @
329525d2
...
@@ -74,6 +74,27 @@ var muban = {
...
@@ -74,6 +74,27 @@ var muban = {
一级
:
'
.stui-vodlist li;a&&title;a&&data-original;.pic-text&&Text;a&&href
'
,
一级
:
'
.stui-vodlist li;a&&title;a&&data-original;.pic-text&&Text;a&&href
'
,
二级
:{
"
title
"
:
"
.stui-content__detail .title&&Text;.stui-content__detail p:eq(-2)&&Text
"
,
"
img
"
:
"
.stui-content__thumb .lazyload&&data-original
"
,
"
desc
"
:
"
.stui-content__detail p:eq(0)&&Text;.stui-content__detail p:eq(1)&&Text;.stui-content__detail p:eq(2)&&Text
"
,
"
content
"
:
"
.detail&&Text
"
,
"
tabs
"
:
"
.stui-vodlist__head h3
"
,
"
lists
"
:
"
.stui-content__playlist:eq(#id) li
"
},
二级
:{
"
title
"
:
"
.stui-content__detail .title&&Text;.stui-content__detail p:eq(-2)&&Text
"
,
"
img
"
:
"
.stui-content__thumb .lazyload&&data-original
"
,
"
desc
"
:
"
.stui-content__detail p:eq(0)&&Text;.stui-content__detail p:eq(1)&&Text;.stui-content__detail p:eq(2)&&Text
"
,
"
content
"
:
"
.detail&&Text
"
,
"
tabs
"
:
"
.stui-vodlist__head h3
"
,
"
lists
"
:
"
.stui-content__playlist:eq(#id) li
"
},
搜索
:
'
#searchList li;a&&title;.lazyload&&data-original;.text-muted&&Text;a&&href;.text-muted:eq(-1)&&Text
'
,
搜索
:
'
#searchList li;a&&title;.lazyload&&data-original;.text-muted&&Text;a&&href;.text-muted:eq(-1)&&Text
'
,
},
vfed
:{
title
:
''
,
host
:
''
,
url
:
'
/index.php/vod/show/id/fyclass/page/fypage.html
'
,
searchUrl
:
'
/index.php/vod/search/page/fypage/wd/**.html
'
,
searchable
:
0
,
quickSearch
:
0
,
headers
:{
'
User-Agent
'
:
'
UC_UA
'
,
},
// class_parse:'.fed-pops-navbar&&ul.fed-part-rows&&a.fed-part-eone:gt(0):lt(5);a&&Text;a&&href;.*/(.*?).html',
class_parse
:
'
.fed-pops-navbar&&ul.fed-part-rows&&a;a&&Text;a&&href;.*/(.*?).html
'
,
play_parse
:
true
,
lazy
:
''
,
limit
:
6
,
推荐
:
'
ul.fed-list-info.fed-part-rows;li;a.fed-list-title&&Text;a&&data-original;.fed-list-remarks&&Text;a&&href
'
,
double
:
true
,
// 推荐内容是否双层定位
一级
:
'
.stui-vodlist li;a&&title;a&&data-original;.pic-text&&Text;a&&href
'
,
二级
:{
"
title
"
:
"
.stui-content__detail .title&&Text;.stui-content__detail p:eq(-2)&&Text
"
,
"
img
"
:
"
.stui-content__thumb .lazyload&&data-original
"
,
"
desc
"
:
"
.stui-content__detail p:eq(0)&&Text;.stui-content__detail p:eq(1)&&Text;.stui-content__detail p:eq(2)&&Text
"
,
"
content
"
:
"
.detail&&Text
"
,
"
tabs
"
:
"
.stui-vodlist__head h3
"
,
"
lists
"
:
"
.stui-content__playlist:eq(#id) li
"
},
搜索
:
'
#searchList li;a&&title;.lazyload&&data-original;.text-muted&&Text;a&&href;.text-muted:eq(-1)&&Text
'
,
}
}
...
...
js/玩偶姐姐.js
浏览文件 @
329525d2
...
@@ -8,6 +8,7 @@ var rule = {
...
@@ -8,6 +8,7 @@ var rule = {
},
},
timeout
:
5000
,
timeout
:
5000
,
class_parse
:
'
#side-menu:lt(1) li;a&&Text;a&&href;com/(.*?)/
'
,
class_parse
:
'
#side-menu:lt(1) li;a&&Text;a&&href;com/(.*?)/
'
,
limit
:
5
,
play_parse
:
true
,
play_parse
:
true
,
lazy
:
''
,
lazy
:
''
,
一级
:
'
.col-sm-6;h3&&Text;img&&data-src;.date&&Text;a&&href
'
,
一级
:
'
.col-sm-6;h3&&Text;img&&data-src;.date&&Text;a&&href
'
,
...
...
models/rules.db
浏览文件 @
329525d2
无法预览此类型文件
readme.md
浏览文件 @
329525d2
...
@@ -3,6 +3,10 @@
...
@@ -3,6 +3,10 @@
[
搭建教程
](
./安卓本地搭建说明.md
)
|
[
install_help
](
./安卓本地搭建说明.md
)
[
搭建教程
](
./安卓本地搭建说明.md
)
|
[
install_help
](
./安卓本地搭建说明.md
)
[
dr项目QQ官群
](
https://qm.qq.com/cgi-bin/qm/qr?k=H2KwcXrMdiR5M2blHR5gjZzPfN_S3N_C&jump_from=webapi
)
[
dr项目QQ官群
](
https://qm.qq.com/cgi-bin/qm/qr?k=H2KwcXrMdiR5M2blHR5gjZzPfN_S3N_C&jump_from=webapi
)
###### 更新日志
###### 更新日志
###### 2022/09/01
-
[X] 1.增加动态分类排除配置
-
[X] 2.优化pdfh,pdfa,pd等函数,支持多个&&写法,自动取第一个
-
[X] 3.增加vfed规则模板
###### 2022/08/31
###### 2022/08/31
-
[X] 1.增加管理员登录功能
-
[X] 1.增加管理员登录功能
-
[X] 2.增加管理员上传和删除内置规则功能
-
[X] 2.增加管理员上传和删除内置规则功能
...
...
templates/admin.html
浏览文件 @
329525d2
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
padding-left
:
10px
;
padding-left
:
10px
;
/*padding-top:10px;*/
/*padding-top:10px;*/
margin-left
:
10px
;
margin-left
:
10px
;
width
:
24
0px
;
width
:
36
0px
;
height
:
30px
;
height
:
30px
;
}
}
.green
{
.green
{
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
padding-left
:
10px
;
padding-left
:
10px
;
/*padding-top:10px;*/
/*padding-top:10px;*/
margin-left
:
10px
;
margin-left
:
10px
;
width
:
24
0px
;
width
:
36
0px
;
height
:
30px
;
height
:
30px
;
}
}
.btn
{
.btn
{
...
@@ -47,6 +47,19 @@
...
@@ -47,6 +47,19 @@
color
:
#FFFFFF
;
color
:
#FFFFFF
;
background-color
:
#1379cb
;
background-color
:
#1379cb
;
}
}
.view_home
{
letter-spacing
:
5px
;
margin-left
:
20px
;
width
:
150px
;
height
:
30px
;
text-align
:
center
;
border-style
:
solid
;
/*border-color: #8CD4F5;*/
border-color
:
#17af30
;
text-decoration
:
none
;
color
:
#FFFFFF
;
background-color
:
#17af30
;
}
/*li a {*/
/*li a {*/
/* display: block !important;*/
/* display: block !important;*/
/*}*/
/*}*/
...
@@ -60,6 +73,12 @@
...
@@ -60,6 +73,12 @@
location
.
href
=
'
/admin/view/
'
+
rule
+
'
.js
'
;
location
.
href
=
'
/admin/view/
'
+
rule
+
'
.js
'
;
});
});
$
(
"
.view_home
"
).
click
(
function
(){
// location.reload();
let
rule
=
this
.
getAttribute
(
'
value
'
).
trim
();
location
.
href
=
'
/vod?rule=
'
+
rule
;
});
$
(
"
.clear
"
).
click
(
function
(){
$
(
"
.clear
"
).
click
(
function
(){
// location.reload();
// location.reload();
// let rule = this.innerText.trim();
// let rule = this.innerText.trim();
...
@@ -137,11 +156,13 @@
...
@@ -137,11 +156,13 @@
{% if rule.name|length > 2 %}
{% if rule.name|length > 2 %}
<li
class=
"red"
>
<li
class=
"red"
>
<a
class=
"view"
href=
"javascript:void(0);"
>
{{ rule.name }}
</a>
<a
class=
"view"
href=
"javascript:void(0);"
>
{{ rule.name }}
</a>
<a
class=
"view_home"
href=
"javascript:void(0);"
value=
"{{ rule.name }}"
>
主页数据预览
</a>
<a
class=
"clear"
href=
"javascript:void(0);"
value=
"{{ rule.name }}"
>
删除
</a>
<a
class=
"clear"
href=
"javascript:void(0);"
value=
"{{ rule.name }}"
>
删除
</a>
</li>
</li>
{% else %}
{% else %}
<li
class=
"green"
>
<li
class=
"green"
>
<a
class=
"view"
href=
"javascript:void(0);"
>
{{ rule.name }}
</a>
<a
class=
"view"
href=
"javascript:void(0);"
>
{{ rule.name }}
</a>
<a
class=
"view_home"
href=
"javascript:void(0);"
value=
"{{ rule.name }}"
>
主页数据预览
</a>
<a
class=
"clear"
href=
"javascript:void(0);"
value=
"{{ rule.name }}"
>
删除
</a>
<a
class=
"clear"
href=
"javascript:void(0);"
value=
"{{ rule.name }}"
>
删除
</a>
</li>
</li>
{% endif %}
{% endif %}
...
...
templates/index.html
浏览文件 @
329525d2
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
<div
class=
"btn"
style=
"display: none"
>
<div
class=
"btn"
style=
"display: none"
>
<a
href=
"/clear?rule="
>
缓存清理接口
</a>
<a
href=
"/clear?rule="
>
缓存清理接口
</a>
</div>
</div>
<div
class=
"btn"
>
<div
class=
"btn"
style=
"display: none"
>
<a
href=
"/vod?rule="
>
猫CMS接口
</a>
<a
href=
"/vod?rule="
>
猫CMS接口
</a>
</div>
</div>
<div
class=
"btn"
>
<div
class=
"btn"
>
...
...
utils/htmlParser.py
浏览文件 @
329525d2
...
@@ -6,21 +6,32 @@
...
@@ -6,21 +6,32 @@
from
pyquery
import
PyQuery
as
pq
from
pyquery
import
PyQuery
as
pq
from
urllib.parse
import
urljoin
from
urllib.parse
import
urljoin
import
re
class
jsoup
:
class
jsoup
:
def
__init__
(
self
,
MY_URL
=
''
):
def
__init__
(
self
,
MY_URL
=
''
):
self
.
MY_URL
=
MY_URL
self
.
MY_URL
=
MY_URL
def
test
(
self
,
text
,
string
):
searchObj
=
re
.
search
(
rf
'
{
text
}
'
,
string
,
re
.
M
|
re
.
I
)
test_ret
=
True
if
searchObj
else
False
return
test_ret
def
pdfh
(
self
,
html
,
parse
,
pd
=
False
):
def
pdfh
(
self
,
html
,
parse
,
pd
=
False
):
if
not
parse
:
if
not
parse
:
return
''
return
''
doc
=
pq
(
html
)
doc
=
pq
(
html
)
option
=
None
option
=
None
if
parse
.
find
(
'&&'
)
>
-
1
:
if
parse
.
find
(
'&&'
)
>
-
1
:
option
=
parse
.
split
(
'&&'
)[
1
]
option
=
parse
.
split
(
'&&'
)[
-
1
]
parse
=
parse
.
split
(
'&&'
)[
0
]
parse
=
parse
.
split
(
'&&'
)[:
-
1
]
# 如果只有一个&& 取的就直接是0
if
len
(
parse
)
>
1
:
# 如果不大于1可能就是option操作,不需要拼eq
parse
=
' '
.
join
([
i
if
self
.
test
(
':eq|:lt|:gt'
,
i
)
else
f
'
{
i
}
:eq(0)'
for
i
in
parse
])
else
:
parse
=
parse
[
0
]
if
self
.
test
(
':eq|:lt|:gt'
,
parse
[
0
])
else
f
'
{
parse
[
0
]
}
:eq(0)'
if
option
:
if
option
:
# print(f'parse:{parse}=>(option:{option})')
ret
=
doc
(
parse
)
ret
=
doc
(
parse
)
# FIXME 解析出来有多个的情况应该自动取第一个
# FIXME 解析出来有多个的情况应该自动取第一个
if
option
==
'Text'
:
if
option
==
'Text'
:
...
@@ -44,6 +55,11 @@ class jsoup:
...
@@ -44,6 +55,11 @@ class jsoup:
def
pdfa
(
self
,
html
,
parse
):
def
pdfa
(
self
,
html
,
parse
):
if
not
parse
:
if
not
parse
:
return
[]
return
[]
if
parse
.
find
(
'&&'
)
>
-
1
:
parse
=
parse
.
split
(
'&&'
)
# 带&&的重新拼接
# print(f"{parse[0]},{self.test(':eq|:lt|:gt', parse[0])}")
parse
=
' '
.
join
([
parse
[
i
]
if
self
.
test
(
':eq|:lt|:gt'
,
parse
[
i
])
or
i
>=
len
(
parse
)
-
1
else
f
'
{
parse
[
i
]
}
:eq(0)'
for
i
in
range
(
len
(
parse
))])
# print(f'pdfa:{parse}')
doc
=
pq
(
html
)
doc
=
pq
(
html
)
# return [item.html() for item in doc(parse).items()]
# return [item.html() for item in doc(parse).items()]
return
[
str
(
item
)
for
item
in
doc
(
parse
).
items
()]
return
[
str
(
item
)
for
item
in
doc
(
parse
).
items
()]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录