Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wchjxyzj
dr_py
提交
e4e67e83
D
dr_py
项目概览
wchjxyzj
/
dr_py
与 Fork 源项目一致
Fork自
晚风拂柳颜 / dr_py
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dr_py
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e4e67e83
编写于
9月 29, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
基本实现drpy模板能用
上级
4aea5b06
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
59 addition
and
24 deletion
+59
-24
txt/muban/drpy模板.js
txt/muban/drpy模板.js
+59
-24
未找到文件。
txt/muban/drpy模板.js
浏览文件 @
e4e67e83
//
import ch from './cheerio.min.js';
import
Uri
from
'
./uri.min.js
'
;
import
ch
from
'
./cheerio.min.js
'
;
//
import Uri from './uri.min.js';
// var URI = require('urijs');
// import 模板 from 'https://gitcode.net/qq_32394351/dr_py/-/raw/master/js/模板.js'
// var rule = Object.assign(模板.首图2,{
...
...
@@ -60,7 +60,8 @@ const IOS_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWe
const
RULE_CK
=
'
cookie
'
;
// 源cookie的key值
const
KEY
=
typeof
(
key
)
!==
'
undefined
'
&&
key
?
key
:
'
drpy_
'
+
rule
.
title
;
// 源的唯一标识
const
CATE_EXCLUDE
=
'
首页|留言|APP|下载|资讯|新闻|动态
'
;
const
TAB_EXCLUDE
=
'
猜你|喜欢|APP|下载|剧情
'
;
const
TAB_EXCLUDE
=
'
猜你|喜欢|APP|下载|剧情|热播
'
;
var
MY_URL
;
// 全局注入变量,pd函数需要
/** 处理一下 rule规则关键字段没传递的情况 **/
rule
.
cate_exclude
=
(
rule
.
cate_exclude
||
''
)
+
CATE_EXCLUDE
;
...
...
@@ -89,6 +90,7 @@ function verifyCode(url){
*/
function
setItem
(
k
,
v
){
local
.
set
(
KEY
,
k
,
v
);
console
.
log
(
`规则
${
KEY
}
设置
${
k
}
=>
${
v
}
`
)
}
/**
...
...
@@ -116,24 +118,45 @@ function clearItem(k){
* @returns {*}
*/
function
urljoin
(
fromPath
,
nowPath
)
{
let
new_uri
=
Uri
(
nowPath
,
fromPath
);
new_uri
=
new_uri
.
toString
();
// console.log(new_uri);
// return fromPath + nowPath
return
new_uri
fromPath
=
fromPath
||
''
;
nowPath
=
nowPath
||
''
;
try
{
// import Uri from './uri.min.js';
// var Uri = require('./uri.min.js');
// eval(request('https://cdn.bootcdn.net/ajax/libs/URI.js/1.19.11/URI.min.js'));
// let new_uri = URI(nowPath, fromPath);
let
new_uri
=
Uri
(
nowPath
,
fromPath
);
new_uri
=
new_uri
.
toString
();
// console.log(new_uri);
// return fromPath + nowPath
return
new_uri
}
catch
(
e
)
{
console
.
log
(
'
urljoin发生错误:
'
+
e
.
message
);
if
(
nowPath
.
startsWith
(
'
http
'
)){
return
nowPath
}
if
(
nowPath
.
startsWith
(
'
/
'
)){
return
getHome
(
fromPath
)
+
nowPath
}
return
fromPath
+
nowPath
}
}
/**
* 重写pd方法-增加自动urljoin
* 重写pd方法-增加自动urljoin
(没法重写,改个名继续骗)
* @param html
* @param parse
* @param uri
* @returns {*}
*/
function
p
d
(
html
,
parse
){
function
p
D
(
html
,
parse
,
uri
){
let
ret
=
pdfh
(
html
,
parse
);
if
(
typeof
(
MY_URL
)
===
'
undefined
'
||!
MY_URL
){
var
MY_URL
=
''
;
if
(
typeof
(
uri
)
===
'
undefined
'
||!
uri
){
uri
=
''
;
}
// MY_URL = getItem('MY_URL',MY_URL);
console
.
log
(
`规则
${
KEY
}
打印MY_URL:
${
MY_URL
}
,uri:
${
uri
}
`
);
return
urljoin
(
MY_URL
,
ret
)
}
...
...
@@ -337,6 +360,7 @@ function homeVodParse(homeVodObj){
}
let
d
=
[];
MY_URL
=
homeVodObj
.
homeUrl
;
// setItem('MY_URL',MY_URL);
console
.
log
(
MY_URL
);
let
html
=
getHtml
(
MY_URL
);
try
{
...
...
@@ -355,12 +379,12 @@ function homeVodParse(homeVodObj){
let
title
=
pdfh
(
item2
,
p
[
2
]);
let
img
=
''
;
try
{
img
=
p
d
(
item2
,
p
[
3
])
img
=
p
D
(
item2
,
p
[
3
])
}
catch
(
e
)
{}
let
desc
=
pdfh
(
item2
,
p
[
4
]);
let
links
=
[];
for
(
let
p5
of
p
[
5
].
split
(
'
+
'
)){
let
link
=
!
homeVodObj
.
detailUrl
?
p
d
(
item2
,
p5
):
pdfh
(
item2
,
p5
);
let
link
=
!
homeVodObj
.
detailUrl
?
p
D
(
item2
,
p5
,
MY_URL
):
pdfh
(
item2
,
p5
);
links
.
push
(
link
);
}
let
vod
=
{
...
...
@@ -389,14 +413,14 @@ function homeVodParse(homeVodObj){
let
title
=
pdfh
(
item
,
p
[
1
]);
let
img
=
''
;
try
{
img
=
p
d
(
item
,
p
[
2
]
);
img
=
p
D
(
item
,
p
[
2
],
MY_URL
);
}
catch
(
e
)
{
}
let
desc
=
pdfh
(
item
,
p
[
3
]);
let
links
=
[];
for
(
let
p5
of
p
[
4
].
split
(
'
+
'
)){
let
link
=
!
homeVodObj
.
detailUrl
?
p
d
(
item
,
p5
):
pdfh
(
item
,
p5
);
let
link
=
!
homeVodObj
.
detailUrl
?
p
D
(
item
,
p5
,
MY_URL
):
pdfh
(
item
,
p5
);
links
.
push
(
link
);
}
let
vod
=
{
...
...
@@ -438,6 +462,7 @@ function categoryParse(cateObj) {
let
d
=
[];
let
url
=
cateObj
.
url
.
replaceAll
(
'
fyclass
'
,
cateObj
.
tid
).
replaceAll
(
'
fypage
'
,
cateObj
.
pg
);
MY_URL
=
url
;
// setItem('MY_URL',MY_URL);
console
.
log
(
MY_URL
);
try
{
let
html
=
getHtml
(
MY_URL
);
...
...
@@ -445,9 +470,9 @@ function categoryParse(cateObj) {
let
list
=
pdfa
(
html
,
p
[
0
]);
list
.
forEach
(
it
=>
{
d
.
push
({
'
vod_id
'
:
p
d
(
it
,
p
[
4
]
),
'
vod_id
'
:
p
D
(
it
,
p
[
4
],
MY_URL
),
'
vod_name
'
:
pdfh
(
it
,
p
[
1
]),
'
vod_pic
'
:
p
d
(
it
,
p
[
2
]
),
'
vod_pic
'
:
p
D
(
it
,
p
[
2
],
MY_URL
),
'
vod_remarks
'
:
pdfh
(
it
,
p
[
3
]),
});
});
...
...
@@ -479,6 +504,7 @@ function searchParse(searchObj) {
let
d
=
[];
let
url
=
searchObj
.
searchUrl
.
replaceAll
(
'
**
'
,
searchObj
.
wd
).
replaceAll
(
'
fypage
'
,
searchObj
.
pg
);
MY_URL
=
url
;
// setItem('MY_URL',MY_URL);
console
.
log
(
MY_URL
);
try
{
let
html
=
getHtml
(
MY_URL
);
...
...
@@ -496,9 +522,9 @@ function searchParse(searchObj) {
let
list
=
pdfa
(
html
,
p
[
0
]);
list
.
forEach
(
it
=>
{
let
ob
=
{
'
vod_id
'
:
p
d
(
it
,
p
[
4
]
),
'
vod_id
'
:
p
D
(
it
,
p
[
4
],
MY_URL
),
'
vod_name
'
:
pdfh
(
it
,
p
[
1
]),
'
vod_pic
'
:
p
d
(
it
,
p
[
2
]
),
'
vod_pic
'
:
p
D
(
it
,
p
[
2
],
MY_URL
),
'
vod_remarks
'
:
pdfh
(
it
,
p
[
3
]),
};
if
(
p
.
length
>
5
&&
p
[
5
])
{
...
...
@@ -544,6 +570,7 @@ function detailParse(detailObj){
let
tab_exclude
=
detailObj
.
tab_exclude
;
let
html
=
detailObj
.
html
||
''
;
MY_URL
=
url
;
// setItem('MY_URL',MY_URL);
console
.
log
(
MY_URL
);
if
(
p
===
'
*
'
){
vod
.
vod_play_from
=
'
道长在线
'
;
...
...
@@ -584,7 +611,7 @@ function detailParse(detailObj){
if
(
p
.
img
){
try
{
let
p1
=
p
.
img
.
split
(
'
;
'
);
vod
.
vod_pic
=
p
d
(
html
,
p1
[
0
]
);
vod
.
vod_pic
=
p
D
(
html
,
p1
[
0
],
MY_URL
);
}
catch
(
e
)
{}
}
...
...
@@ -626,12 +653,20 @@ console.log(3);
let
p1
=
p
.
lists
.
replaceAll
(
'
#idv
'
,
tab_name
).
replaceAll
(
'
#id
'
,
i
);
tab_ext
=
tab_ext
.
replaceAll
(
'
#idv
'
,
tab_name
).
replaceAll
(
'
#id
'
,
i
);
console
.
log
(
p1
);
let
vodList
=
pdfa
(
html
,
p1
);
console
.
log
(
645
);
console
.
log
(
html
);
let
vodList
=
[];
try
{
vodList
=
pdfa
(
html
,
p1
)
}
catch
(
e
)
{
console
.
log
(
e
.
message
)
}
console
.
log
(
647
);
console
.
log
(
'
len(vodList):
'
+
vodList
.
length
);
let
new_vod_list
=
[];
let
tabName
=
tab_ext
?
pdfh
(
html
,
tab_ext
):
tab_name
;
vodList
.
forEach
(
it
=>
{
new_vod_list
.
push
(
tabName
+
'
$
'
+
p
d
(
it
,
'
a&&href
'
));
new_vod_list
.
push
(
tabName
+
'
$
'
+
p
D
(
it
,
'
a&&href
'
,
MY_URL
));
});
let
vlist
=
new_vod_list
.
join
(
'
#
'
);
vod_tab_list
.
push
(
vlist
);
...
...
@@ -652,7 +687,7 @@ console.log(JSON.stringify(vod));
*/
function
playParse
(
playObj
){
MY_URL
=
playObj
.
url
;
input
=
MY_URL
;
var
input
=
MY_URL
;
let
common_play
=
{
parse
:
1
,
url
:
MY_URL
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录