Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
言程序plus
dr_py
提交
f2ef5244
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,发现更多精彩内容 >>
提交
f2ef5244
编写于
9月 09, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加推荐内容支持js:写法
上级
789affa5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
128 addition
and
64 deletion
+128
-64
controllers/cms.py
controllers/cms.py
+95
-64
js/奇珍异兽.js
js/奇珍异兽.js
+2
-0
py/爱奇艺推荐.js
py/爱奇艺推荐.js
+31
-0
未找到文件。
controllers/cms.py
浏览文件 @
f2ef5244
...
...
@@ -434,41 +434,94 @@ class CMS:
return
result
def
homeVideoContent
(
self
,
html
,
fypage
=
1
):
if
not
self
.
推荐
:
p
=
self
.
推荐
if
not
p
:
return
self
.
blank
()
p
=
self
.
推荐
.
split
(
';'
)
# 解析
if
not
self
.
double
and
len
(
p
)
<
5
:
return
self
.
blank
()
if
self
.
double
and
len
(
p
)
<
6
:
return
self
.
blank
()
jsp
=
jsoup
(
self
.
homeUrl
)
result
=
{}
videos
=
[]
jsp
=
jsoup
(
self
.
homeUrl
)
is_json
=
str
(
p
[
0
]).
startswith
(
'json:'
)
pdfh
=
jsp
.
pjfh
if
is_json
else
jsp
.
pdfh
pdfa
=
jsp
.
pjfa
if
is_json
else
jsp
.
pdfa
pd
=
jsp
.
pj
if
is_json
else
jsp
.
pd
# print(html)
try
:
if
self
.
double
:
items
=
pdfa
(
html
,
p
[
0
])
for
item
in
items
:
items2
=
pdfa
(
item
,
p
[
1
])
for
item2
in
items2
:
is_js
=
isinstance
(
p
,
str
)
and
str
(
p
).
strip
().
startswith
(
'js:'
)
# 是js
if
is_js
:
headers
[
'Referer'
]
=
getHome
(
self
.
host
)
py_ctx
.
update
({
'input'
:
self
.
homeUrl
,
'HOST'
:
self
.
host
,
'TYPE'
:
'home'
,
# 海阔js环境标志
'fetch_params'
:
{
'headers'
:
headers
,
'timeout'
:
self
.
d
.
timeout
,
'encoding'
:
self
.
d
.
encoding
},
'd'
:
self
.
d
,
'getParse'
:
self
.
d
.
getParse
,
'saveParse'
:
self
.
d
.
saveParse
,
'jsp'
:
jsp
,
'setDetail'
:
setDetail
,
})
ctx
=
py_ctx
jscode
=
getPreJs
()
+
p
.
strip
().
replace
(
'js:'
,
''
,
1
)
# print(jscode)
try
:
loader
,
_
=
runJScode
(
jscode
,
ctx
=
ctx
)
# print(loader.toString())
vods
=
loader
.
eval
(
'VODS'
)
# print(vods)
if
isinstance
(
vods
,
JsObjectWrapper
):
videos
=
vods
.
to_list
()
except
Exception
as
e
:
logger
.
info
(
f
'首页推荐执行js获取列表出错:
{
e
}
'
)
else
:
p
=
p
.
strip
().
split
(
';'
)
# 解析
if
not
self
.
double
and
len
(
p
)
<
5
:
return
self
.
blank
()
if
self
.
double
and
len
(
p
)
<
6
:
return
self
.
blank
()
jsp
=
jsoup
(
self
.
homeUrl
)
is_json
=
str
(
p
[
0
]).
startswith
(
'json:'
)
pdfh
=
jsp
.
pjfh
if
is_json
else
jsp
.
pdfh
pdfa
=
jsp
.
pjfa
if
is_json
else
jsp
.
pdfa
pd
=
jsp
.
pj
if
is_json
else
jsp
.
pd
# print(html)
try
:
if
self
.
double
:
items
=
pdfa
(
html
,
p
[
0
])
for
item
in
items
:
items2
=
pdfa
(
item
,
p
[
1
])
for
item2
in
items2
:
try
:
title
=
pdfh
(
item2
,
p
[
2
])
img
=
pd
(
item2
,
p
[
3
])
desc
=
pdfh
(
item2
,
p
[
4
])
links
=
[
pd
(
item2
,
p5
)
if
not
self
.
detailUrl
else
pdfh
(
item2
,
p5
)
for
p5
in
p
[
5
].
split
(
'+'
)]
link
=
'$'
.
join
(
links
)
content
=
''
if
len
(
p
)
<
7
else
pdfh
(
item2
,
p
[
6
])
videos
.
append
({
"vod_id"
:
link
,
"vod_name"
:
title
,
"vod_pic"
:
img
,
"vod_remarks"
:
desc
,
"no_use"
:{
"vod_content"
:
content
,
"type_id"
:
1
,
"type_name"
:
"首页推荐"
,
},
})
except
:
pass
else
:
items
=
pdfa
(
html
,
p
[
0
].
replace
(
'json:'
,
''
))
# print(items)
for
item
in
items
:
try
:
title
=
pdfh
(
item2
,
p
[
2
])
img
=
pd
(
item2
,
p
[
3
])
desc
=
pdfh
(
item2
,
p
[
4
])
links
=
[
pd
(
item2
,
p5
)
if
not
self
.
detailUrl
else
pdfh
(
item2
,
p5
)
for
p5
in
p
[
5
].
split
(
'+'
)]
title
=
pdfh
(
item
,
p
[
1
])
img
=
pd
(
item
,
p
[
2
])
desc
=
pdfh
(
item
,
p
[
3
])
# link = pd(item, p[4])
links
=
[
pd
(
item
,
p5
)
if
not
self
.
detailUrl
else
pdfh
(
item
,
p5
)
for
p5
in
p
[
4
].
split
(
'+'
)]
link
=
'$'
.
join
(
links
)
content
=
''
if
len
(
p
)
<
7
else
pdfh
(
item2
,
p
[
6
])
content
=
''
if
len
(
p
)
<
6
else
pdfh
(
item
,
p
[
5
])
videos
.
append
({
"vod_id"
:
link
,
"vod_name"
:
title
,
"vod_pic"
:
img
,
"vod_remarks"
:
desc
,
"no_use"
:{
"no_use"
:
{
"vod_content"
:
content
,
"type_id"
:
1
,
"type_name"
:
"首页推荐"
,
...
...
@@ -476,46 +529,24 @@ class CMS:
})
except
:
pass
else
:
items
=
pdfa
(
html
,
p
[
0
].
replace
(
'json:'
,
''
))
# print(items)
for
item
in
items
:
try
:
title
=
pdfh
(
item
,
p
[
1
])
img
=
pd
(
item
,
p
[
2
])
desc
=
pdfh
(
item
,
p
[
3
])
# link = pd(item, p[4])
links
=
[
pd
(
item
,
p5
)
if
not
self
.
detailUrl
else
pdfh
(
item
,
p5
)
for
p5
in
p
[
4
].
split
(
'+'
)]
link
=
'$'
.
join
(
links
)
content
=
''
if
len
(
p
)
<
6
else
pdfh
(
item
,
p
[
5
])
videos
.
append
({
"vod_id"
:
link
,
"vod_name"
:
title
,
"vod_pic"
:
img
,
"vod_remarks"
:
desc
,
"no_use"
:
{
"vod_content"
:
content
,
"type_id"
:
1
,
"type_name"
:
"首页推荐"
,
},
})
except
:
pass
# result['list'] = videos[min((fypage-1)*self.limit,len(videos)-1):min(fypage*self.limit,len(videos))]
result
[
'list'
]
=
videos
result
[
'no_use'
]
=
{
'code'
:
1
,
'msg'
:
'数据列表'
,
'page'
:
fypage
,
'pagecount'
:
math
.
ceil
(
len
(
videos
)
/
self
.
limit
),
'limit'
:
self
.
limit
,
'total'
:
len
(
videos
),
'now_count'
:
len
(
result
[
'list'
]),
}
return
result
except
Exception
as
e
:
logger
.
info
(
f
'首页内容获取失败:
{
e
}
'
)
return
self
.
blank
()
except
Exception
as
e
:
logger
.
info
(
f
'首页内容获取失败:
{
e
}
'
)
return
self
.
blank
()
result
[
'list'
]
=
videos
result
[
'no_use'
]
=
{
'code'
:
1
,
'msg'
:
'数据列表'
,
'page'
:
fypage
,
'pagecount'
:
math
.
ceil
(
len
(
videos
)
/
self
.
limit
),
'limit'
:
self
.
limit
,
'total'
:
len
(
videos
),
'now_count'
:
len
(
result
[
'list'
]),
}
# print(result)
return
result
def
categoryContent
(
self
,
fyclass
,
fypage
):
"""
...
...
@@ -548,7 +579,7 @@ class CMS:
headers
[
'Referer'
]
=
getHome
(
url
)
py_ctx
.
update
({
'input'
:
url
,
'TYPE'
:
'
hom
e'
,
# 海阔js环境标志
'TYPE'
:
'
cat
e'
,
# 海阔js环境标志
'fetch_params'
:
{
'headers'
:
headers
,
'timeout'
:
self
.
d
.
timeout
,
'encoding'
:
self
.
d
.
encoding
},
'd'
:
self
.
d
,
'cateID'
:
fyclass
,
# 分类id
...
...
js/奇珍异兽.js
浏览文件 @
f2ef5244
...
...
@@ -21,6 +21,8 @@ var rule = {
// lazy:'js:input="https://cache.json.icu/home/api?type=ys&uid=292796&key=fnoryABDEFJNPQV269&url="+input.split("?")[0];log(input);let html=JSON.parse(request(input));log(html);input=html.url||input',
// 推荐:'.list_item;img&&alt;img&&src;a&&Text;a&&data-float',
// 一级:'json:.data.list;.name;.imageUrl;.latestOrder;.albumId',
推荐
:
''
,
// 推荐:'js:let d=[];fetch_params.headers["user-agent"]=PC_UA;pdfh=jsp.pdfh;pdfa=jsp.pdfa;pd=jsp.pd;let html=fetch(HOST,fetch_params);let lists=pdfa(html,".qy-mod-li");lists.forEach(function(it){try{let title=pdfh(it,"p.sub&&title");let desc=pdfh(it,".qy-mod-label&&Text");let pic_url=pd(it,"img&&src");d.push({title:title,desc:desc,img:pic_url})}catch(e){}});res=setResult(d);',
一级
:
'
js:let d=[];if(cateID==="16"){input=input.replace("channel_id=16","channel_id=1").split("three_category_id")[0];input+="three_category_id=27401"}else if(cateID==="5"){input=input.replace("data_type=1","data_type=2")}let html=request(input);let json=JSON.parse(html);if(json.code==="A00003"){fetch_params.headers["user-agent"]=PC_UA;json=JSON.parse(fetch(input,fetch_params))}json.data.list.forEach(function(data){if(data.channelId===1){desc=data.hasOwnProperty("score")?data.score+"分
\\
t":""}else if(data.channelId===2||data.channelId===4){if(data.latestOrder===data.videoCount){desc=(data.hasOwnProperty("score")?data.score+"分
\\
t":"")+data.latestOrder+"集全"}else{if(data.videoCount){desc=(data.hasOwnProperty("score")?data.score+"分
\\
t":"")+data.latestOrder+"/"+data.videoCount+"集"}else{desc="更新至 "+data.latestOrder+"集"}}}else if(data.channelId===6){desc=data.period+"期"}else if(data.channelId===5){desc=data.focus}else{if(data.latestOrder){desc="更新至 第"+data.latestOrder+"期"}else if(data.period){desc=data.period}else{desc=data.focus}}url=cateID+"$"+data.albumId;d.push({url:url,title:data.name,desc:desc,pic_url:data.imageUrl.replace(".jpg","_390_520.jpg?caplist=jpg,webp")})});setResult(d);
'
,
// 一级:'js:let d=[];if(cateID==="16"){input=input.replace("channel_id=16","channel_id=1").split("three_category_id")[0];input+="three_category_id=27401"}else if(cateID==="5"){input=input.replace("data_type=1","data_type=2")}let html=fetch(input,fetch_params);let json=JSON.parse(html);if(json.code==="A00003"){fetch_params.headers["user-agent"]=PC_UA;json=JSON.parse(fetch(input,fetch_params))}json.data.list.forEach(function(data){if(data.channelId===1){desc=data.hasOwnProperty("score")?data.score+"分\\t":""}else if(data.channelId===2||data.channelId===4){if(data.latestOrder===data.videoCount){desc=(data.hasOwnProperty("score")?data.score+"分\\t":"")+data.latestOrder+"集全"}else{if(data.videoCount){desc=(data.hasOwnProperty("score")?data.score+"分\\t":"")+data.latestOrder+"/"+data.videoCount+"集"}else{desc="更新至 "+data.latestOrder+"集"}}}else if(data.channelId===6){desc=data.period+"期"}else if(data.channelId===5){desc=data.focus}else{if(data.latestOrder){desc="更新至 第"+data.latestOrder+"期"}else if(data.period){desc=data.period}else{desc=data.focus}}url=cateID+"$"+data.albumId;d.push({url:url,title:data.name,desc:desc,pic_url:data.imageUrl.replace(".jpg","_390_520.jpg?caplist=jpg,webp")})});setResult(d);',
// 一级:'json:.data.list;.name;.imageUrl;.playUrl;.latestOrder',
...
...
py/爱奇艺推荐.js
0 → 100644
浏览文件 @
f2ef5244
js
:
let
d
=
[];
// print(input);
// print(HOST);
fetch_params
.
headers
[
'
user-agent
'
]
=
PC_UA
;
// print(fetch_params);
pdfh
=
jsp
.
pdfh
;
pdfa
=
jsp
.
pdfa
;
pd
=
jsp
.
pd
;
let
html
=
fetch
(
HOST
,
fetch_params
);
let
lists
=
pdfa
(
html
,
'
.qy-mod-li
'
);
// print(lists.length);
lists
.
forEach
(
function
(
it
){
try
{
let
title
=
pdfh
(
it
,
'
p.sub&&title
'
);
let
desc
=
pdfh
(
it
,
'
.qy-mod-label&&Text
'
);
let
pic_url
=
pd
(
it
,
'
img&&src
'
);
d
.
push
({
title
:
title
,
desc
:
desc
,
img
:
pic_url
,
});
}
catch
(
e
){
// print(e.message);
}
});
// print(d);
res
=
setResult
(
d
);
// print(res);
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录