Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxaah
dr_py
提交
37ce0a32
dr_py
项目概览
sxaah
/
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,发现更多精彩内容 >>
提交
37ce0a32
编写于
9月 08, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
尝试增加全局自动过宝塔验证
上级
77c526af
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
53 addition
and
15 deletion
+53
-15
controllers/cms.py
controllers/cms.py
+30
-13
js/奇珍异兽.js
js/奇珍异兽.js
+2
-1
libs/pre.js
libs/pre.js
+19
-0
models/rules.db
models/rules.db
+0
-0
py/爱奇艺一级.js
py/爱奇艺一级.js
+2
-1
未找到文件。
controllers/cms.py
浏览文件 @
37ce0a32
...
...
@@ -3,6 +3,7 @@
# File : cms.py
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Date : 2022/8/25
import
json
import
requests
import
re
...
...
@@ -301,6 +302,25 @@ class CMS:
else
:
return
''
def
checkHtml
(
self
,
r
):
r
.
encoding
=
self
.
encoding
html
=
r
.
text
if
html
.
find
(
'?btwaf='
)
>
-
1
:
btwaf
=
re
.
search
(
'btwaf(.*?)"'
,
html
,
re
.
M
|
re
.
I
).
groups
()[
0
]
url
=
r
.
url
.
split
(
'#'
)[
0
]
+
'?btwaf'
+
btwaf
# print(f'需要过宝塔验证:{url}')
cookies_dict
=
requests
.
utils
.
dict_from_cookiejar
(
r
.
cookies
)
cookie_str
=
';'
.
join
([
f
'
{
k
}
=
{
cookies_dict
[
k
]
}
'
for
k
in
cookies_dict
])
self
.
headers
[
'cookie'
]
=
cookie_str
r
=
requests
.
get
(
url
,
headers
=
self
.
headers
,
timeout
=
self
.
timeout
)
r
.
encoding
=
self
.
encoding
html
=
r
.
text
if
html
.
find
(
'?btwaf='
)
<
0
:
self
.
saveCookie
(
cookie_str
)
# print(html)
return
html
def
saveParse
(
self
,
play_url
,
real_url
):
if
not
self
.
db
:
msg
=
'未提供数据库连接'
...
...
@@ -367,8 +387,7 @@ class CMS:
else
:
new_classes
=
[]
r
=
requests
.
get
(
self
.
homeUrl
,
headers
=
self
.
headers
,
timeout
=
self
.
timeout
)
r
.
encoding
=
self
.
encoding
html
=
r
.
text
html
=
self
.
checkHtml
(
r
)
# print(html)
# print(self.headers)
if
self
.
class_parse
and
not
has_cache
:
...
...
@@ -558,10 +577,9 @@ class CMS:
items
=
[]
try
:
r
=
requests
.
get
(
url
,
headers
=
self
.
headers
,
timeout
=
self
.
timeout
)
r
.
encoding
=
self
.
encoding
print
(
r
.
url
)
# html = r.text
html
=
r
.
json
()
if
is_json
else
r
.
text
html
=
self
.
checkHtml
(
r
)
if
is_json
:
html
=
json
.
loads
(
html
)
# print(html)
items
=
pdfa
(
html
,
p
[
0
].
replace
(
'json:'
,
''
,
1
))
except
:
...
...
@@ -657,10 +675,9 @@ class CMS:
obj
=
{}
vod_name
=
''
r
=
requests
.
get
(
url
,
headers
=
self
.
headers
,
timeout
=
self
.
timeout
)
r
.
encoding
=
self
.
encoding
# html = r.text
html
=
r
.
json
()
if
is_json
else
r
.
text
# print(html)
html
=
self
.
checkHtml
(
r
)
if
is_json
:
html
=
json
.
loads
(
html
)
if
p
.
get
(
'title'
):
p1
=
p
[
'title'
].
split
(
';'
)
vod_name
=
pdfh
(
html
,
p1
[
0
]).
replace
(
'
\n
'
,
' '
)
...
...
@@ -808,9 +825,9 @@ class CMS:
videos
=
[]
try
:
r
=
requests
.
get
(
url
,
headers
=
self
.
headers
,
timeout
=
self
.
timeout
)
r
.
encoding
=
self
.
encoding
# html = r.text
html
=
r
.
json
()
if
is_json
else
r
.
text
html
=
self
.
checkHtml
(
r
)
if
is_json
:
html
=
json
.
loads
(
html
)
# print(html)
if
not
is_json
and
html
.
find
(
'输入验证码'
)
>
-
1
:
cookie
=
verifyCode
(
url
,
self
.
headers
,
self
.
timeout
,
self
.
retry_count
,
self
.
ocr_api
)
...
...
js/奇珍异兽.js
浏览文件 @
37ce0a32
...
...
@@ -21,7 +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=[];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);
'
,
一级
:
'
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',
// 二级:{is_json:1,"title":"data.title;data.moviecategory[0]+data.moviecategory[1]","img":"data.cdncover","desc":"data.area[0];data.director[0]","content":"data.description","tabs":"data.playlink_sites;data.playlinksdetail.#idv.quality","lists":"data.playlinksdetail.#idv.default_url"},
二级
:{
is_json
:
1
,
"
title
"
:
"
data.name+data.subtitle;data.latestOrder
"
,
"
img
"
:
"
data.imageUrl
"
,
"
desc
"
:
"
data.categories;data.areas
"
,
"
content
"
:
"
data.description
"
,
"
tabs
"
:
"
data.name
"
,
"
lists
"
:
"
data.playlinksdetail.#idv.default_url
"
},
...
...
libs/pre.js
浏览文件 @
37ce0a32
...
...
@@ -161,4 +161,23 @@ function maoss(jxurl, ref, key) {
}
catch
(
e
)
{
return
''
;
}
}
function
request
(
url
,
obj
){
if
(
typeof
(
fetch_params
)
!==
'
undefined
'
){
obj
=
obj
?
Object
.
assign
(
fetch_params
,
obj
):
fetch_params
;
}
else
{
obj
=
obj
||
{}
}
// print(obj);
if
(
typeof
(
fetch
)
!==
undefined
){
let
html
=
fetch
(
url
,
obj
);
if
(
/
\?
btwaf=/
.
test
(
html
))
{
//宝塔验证
url
=
url
.
split
(
'
#
'
)[
0
]
+
'
?btwaf
'
+
html
.
match
(
/btwaf
(
.*
?)\"
/
)[
1
];
log
(
"
宝塔验证跳转到:
"
+
url
);
html
=
fetch
(
url
,
obj
);
}
return
html
}
return
''
}
\ No newline at end of file
models/rules.db
浏览文件 @
37ce0a32
无法预览此类型文件
py/爱奇艺一级.js
浏览文件 @
37ce0a32
...
...
@@ -7,7 +7,8 @@ if(cateID==='16'){//网络电影
}
else
if
(
cateID
===
'
5
'
){
//音乐
input
=
input
.
replace
(
"
data_type=1
"
,
"
data_type=2
"
);
}
let
html
=
fetch
(
input
,
fetch_params
);
// let html = fetch(input,fetch_params);
let
html
=
request
(
input
);
let
json
=
JSON
.
parse
(
html
);
if
(
json
.
code
===
"
A00003
"
)
{
fetch_params
.
headers
[
'
user-agent
'
]
=
PC_UA
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录