Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oidmav
dr_py
提交
77c526af
dr_py
项目概览
oidmav
/
dr_py
与 Fork 源项目一致
Fork自
晚风拂柳颜 / dr_py
通知
2
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,发现更多精彩内容 >>
提交
77c526af
编写于
9月 08, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
一级完美支持js
上级
b5fba2b1
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
293 addition
and
91 deletion
+293
-91
controllers/cms.py
controllers/cms.py
+79
-48
js/奇珍异兽.js
js/奇珍异兽.js
+31
-0
libs/pre.js
libs/pre.js
+122
-43
py/爱奇艺一级.js
py/爱奇艺一级.js
+61
-0
未找到文件。
controllers/cms.py
浏览文件 @
77c526af
...
...
@@ -24,7 +24,8 @@ from easydict import EasyDict as edict
py_ctx
=
{
'requests'
:
requests
,
'print'
:
print
,
'base64Encode'
:
base64Encode
,
'baseDecode'
:
baseDecode
,
'log'
:
logger
.
info
,
'fetch'
:
fetch
,
'post'
:
post
,
'request'
:
request
,
'getCryptoJS'
:
getCryptoJS
,
'buildUrl'
:
buildUrl
,
'getHome'
:
getHome
,
'setDetail'
:
setDetail
,
'join'
:
join
,
'urljoin2'
:
urljoin2
'buildUrl'
:
buildUrl
,
'getHome'
:
getHome
,
'setDetail'
:
setDetail
,
'join'
:
join
,
'urljoin2'
:
urljoin2
,
'PC_UA'
:
PC_UA
,
'MOBILE_UA'
:
MOBILE_UA
,
'UC_UA'
:
UC_UA
}
# print(getCryptoJS())
...
...
@@ -514,11 +515,38 @@ class CMS:
url
=
self
.
url
.
replace
(
'fyclass'
,
fyclass
).
replace
(
'fypage'
,
pg
)
if
fypage
==
1
and
self
.
test
(
'[\[\]]'
,
url
):
url
=
url
.
split
(
'['
)[
1
].
split
(
']'
)[
0
]
p
=
self
.
一级
.
split
(
';'
)
# 解析
p
=
self
.
一级
jsp
=
jsoup
(
self
.
url
)
videos
=
[]
is_js
=
isinstance
(
p
,
str
)
and
str
(
p
).
startswith
(
'js:'
)
# 是js
if
is_js
:
headers
[
'Referer'
]
=
getHome
(
url
)
py_ctx
.
update
({
'input'
:
url
,
'fetch_params'
:
{
'headers'
:
headers
,
'timeout'
:
self
.
d
.
timeout
,
'encoding'
:
self
.
d
.
encoding
},
'd'
:
self
.
d
,
'cateID'
:
fyclass
,
# 分类id
'detailUrl'
:
self
.
detailUrl
or
''
,
# 详情页链接
'getParse'
:
self
.
d
.
getParse
,
'saveParse'
:
self
.
d
.
saveParse
,
'jsp'
:
jsp
,
'setDetail'
:
setDetail
,
})
ctx
=
py_ctx
# print(ctx)
jscode
=
getPreJs
()
+
p
.
replace
(
'js:'
,
''
,
1
)
# print(jscode)
loader
,
_
=
runJScode
(
jscode
,
ctx
=
ctx
)
# print(loader.toString())
vods
=
loader
.
eval
(
'VODS'
)
# print(vods)
if
isinstance
(
vods
,
JsObjectWrapper
):
videos
=
vods
.
to_list
()
else
:
p
=
p
.
split
(
';'
)
# 解析
if
len
(
p
)
<
5
:
return
self
.
blank
()
jsp
=
jsoup
(
self
.
url
)
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
...
...
@@ -527,7 +555,6 @@ class CMS:
# print(pdfh(r.text,'body a.module-poster-item.module-item:eq(0)'))
# print(pdfh(r.text,'body a.module-poster-item.module-item:first'))
videos
=
[]
items
=
[]
try
:
r
=
requests
.
get
(
url
,
headers
=
self
.
headers
,
timeout
=
self
.
timeout
)
...
...
@@ -560,11 +587,15 @@ class CMS:
except
Exception
as
e
:
print
(
f
'发生了错误:
{
e
}
'
)
pass
# print(videos)
limit
=
40
cnt
=
9999
if
len
(
videos
)
>
0
else
0
result
[
'list'
]
=
videos
result
[
'page'
]
=
fypage
result
[
'pagecount'
]
=
9999
result
[
'limit'
]
=
9999
result
[
'total'
]
=
999999
result
[
'pagecount'
]
=
max
(
cnt
,
fypage
)
result
[
'limit'
]
=
limit
result
[
'total'
]
=
cnt
# print(result)
logger
.
info
(
f
'
{
self
.
getName
()
}
获取分类
{
fyclass
}
第
{
fypage
}
页耗时:
{
get_interval
(
t1
)
}
毫秒,共计
{
round
(
len
(
str
(
result
))
/
1000
,
2
)
}
kb'
)
return
result
...
...
@@ -576,7 +607,7 @@ class CMS:
url
=
self
.
detailUrl
.
replace
(
'fyid'
,
detailUrl
).
replace
(
'fyclass'
,
fyclass
)
else
:
url
=
detailUrl
#
print(url)
print
(
url
)
try
:
p
=
self
.
二级
# 解析
if
p
==
'*'
:
...
...
js/奇珍异兽.js
0 → 100644
浏览文件 @
77c526af
var
rule
=
{
title
:
'
奇珍异兽
'
,
host
:
'
https://www.iqiyi.com
'
,
homeUrl
:
''
,
// detailUrl:'https://pcw-api.iqiyi.com/albums/album/avlistinfo?aid=fyid&size=2000&page=1',
detailUrl
:
'
https://pcw-api.iqiyi.com/video/video/videoinfowithuser/fyid?agent_type=1&authcookie=&subkey=fyid&subscribe=1
'
,
searchUrl
:
'
https://search.video.iqiyi.com/o?if=html5&key=**&pageNum=fypage&pos=1&pageSize=24&site=iqiyi
'
,
searchable
:
1
,
quickSearch
:
1
,
url
:
'
https://pcw-api.iqiyi.com/search/recommend/list?channel_id=fyclass&data_type=1&is_purchase=&mode=24&page_id=fypage&ret_num=48&three_category_id=
'
,
// url:'https://pcw-api.iqiyi.com/search/video/videolists?channel_id=fyclass&pageNum=fypage&pageSize=24&data_type=1&site=iqiyi',
headers
:{
'
User-Agent
'
:
'
MOBILE_UA
'
},
timeout
:
5000
,
class_name
:
'
电影&电视剧&纪录片&动漫&综艺&音乐&网络电影
'
,
class_url
:
'
1&2&3&4&6&5&16
'
,
limit
:
20
,
// play_parse:true,
// 手动调用解析请求json的url,此lazy不方便
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);
'
,
// 一级:'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
"
},
// 二级:'',
搜索
:
'
json:.data.docinfos;.albumDocInfo.albumTitle;.albumDocInfo.albumVImage;.albumDocInfo.channel;.albumDocInfo.albumId;.albumDocInfo.tvFocus
'
,
}
\ No newline at end of file
libs/pre.js
浏览文件 @
77c526af
var
VODS
=
[];
if
(
!
String
.
prototype
.
includes
)
{
String
.
prototype
.
includes
=
function
(
search
,
start
)
{
if
(
typeof
start
!==
'
number
'
)
{
start
=
0
;
}
if
(
start
+
search
.
length
>
this
.
length
)
{
return
false
;
}
else
{
return
this
.
indexOf
(
search
,
start
)
!==
-
1
;
}
};
}
if
(
!
Array
.
prototype
.
includes
)
{
Object
.
defineProperty
(
Array
.
prototype
,
'
includes
'
,
{
value
:
function
(
searchElement
,
fromIndex
)
{
if
(
this
==
null
)
{
//this是空或者未定义,抛出错误
throw
new
TypeError
(
'
"this" is null or not defined
'
);
}
var
o
=
Object
(
this
);
//将this转变成对象
var
len
=
o
.
length
>>>
0
;
//无符号右移0位,获取对象length属性,如果未定义就会变成0
if
(
len
===
0
)
{
//length为0直接返回false未找到目标值
return
false
;
}
var
n
=
fromIndex
|
0
;
//查找起始索引
var
k
=
Math
.
max
(
n
>=
0
?
n
:
len
-
Math
.
abs
(
n
),
0
);
//计算正确起始索引,因为有可能是负值
while
(
k
<
len
)
{
//从起始索引处开始循环
if
(
o
[
k
]
===
searchElement
)
{
//如果某一位置与寻找目标相等,返回true,找到了
return
true
;
}
k
++
;
}
return
false
;
//未找到,返回false
}
});
}
Object
.
assign
=
function
()
{
var
target
=
arguments
[
0
];
for
(
var
i
=
1
;
i
<
arguments
.
length
;
i
++
)
{
...
...
@@ -37,9 +81,44 @@ Array.prototype.join = function (emoji) {
}
return
str
;
};
function
setResult
(
d
){
if
(
!
Array
.
isArray
(
d
)){
return
[]
}
d
.
forEach
(
function
(
it
){
let
obj
=
{
vod_id
:
it
.
url
||
''
,
vod_name
:
it
.
title
||
''
,
vod_remarks
:
it
.
desc
||
''
,
vod_content
:
it
.
content
||
''
,
vod_pic
:
it
.
pic_url
||
it
.
img
||
''
,
};
let
keys
=
Object
.
keys
(
it
);
if
(
keys
.
includes
(
'
tname
'
)){
obj
.
type_name
=
it
.
tname
||
''
;
}
if
(
keys
.
includes
(
'
tid
'
)){
obj
.
type_id
=
it
.
tid
||
''
;
}
if
(
keys
.
includes
(
'
year
'
)){
obj
.
vod_year
=
it
.
year
||
''
;
}
if
(
keys
.
includes
(
'
actor
'
)){
obj
.
vod_actor
=
it
.
actor
||
''
;
}
if
(
keys
.
includes
(
'
director
'
)){
obj
.
vod_director
=
it
.
director
||
''
;
}
if
(
keys
.
includes
(
'
area
'
)){
obj
.
vod_area
=
it
.
area
||
''
;
}
VODS
.
push
(
obj
);
});
return
VODS
}
// 千万不要用for in 推荐 forEach (for in 会打乱顺序)
//猫函数
function
maoss
(
jxurl
,
ref
,
key
)
{
function
maoss
(
jxurl
,
ref
,
key
)
{
eval
(
getCryptoJS
());
try
{
var
getVideoInfo
=
function
(
text
)
{
...
...
@@ -82,4 +161,4 @@ Array.prototype.join = function (emoji) {
}
catch
(
e
)
{
return
''
;
}
}
\ No newline at end of file
}
\ No newline at end of file
py/爱奇艺一级.js
0 → 100644
浏览文件 @
77c526af
js
:
let
d
=
[];
// 一级固定返回VODS变量,内置变量有 cateID,detailUrl,setResult用法跟海阔相同
if
(
cateID
===
'
16
'
){
//网络电影
input
=
input
.
replace
(
"
channel_id=16
"
,
"
channel_id=1
"
).
split
(
"
three_category_id
"
)[
0
];
input
+=
"
three_category_id=27401
"
;
// input+= "three_category_id=27401;must,地区;must,类型;must,规格;must";
}
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
;
// print(fetch_params);
json
=
JSON
.
parse
(
fetch
(
input
,
fetch_params
));
}
// print(json);
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 = "https://pcw-api.iqiyi.com/video/video/videoinfowithuser/" + data.albumId + "?agent_type=1&authcookie=&subkey=" + data.albumId + "&subscribe=1";
url
=
cateID
+
'
$
'
+
data
.
albumId
;
// d.push({
// vod_id:url,
// vod_name: data.name,
// vod_remarks: desc,
// vod_pic: data.imageUrl.replace('.jpg', '_390_520.jpg?caplist=jpg,webp'),
// });
d
.
push
({
url
:
url
,
title
:
data
.
name
,
desc
:
desc
,
pic_url
:
data
.
imageUrl
.
replace
(
'
.jpg
'
,
'
_390_520.jpg?caplist=jpg,webp
'
),
});
});
// VODS = d;
setResult
(
d
);
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录