Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wchjxyzj
dr_py
提交
4aea5b06
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,发现更多精彩内容 >>
提交
4aea5b06
编写于
9月 29, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
完善drpy模板的urljoin功能和pd
上级
3b9f6692
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
193 addition
and
16 deletion
+193
-16
libs/URI.min.js
libs/URI.min.js
+94
-0
txt/muban/drpy模板.js
txt/muban/drpy模板.js
+40
-16
txt/muban/原生js.js
txt/muban/原生js.js
+59
-0
未找到文件。
libs/URI.min.js
0 → 100644
浏览文件 @
4aea5b06
此差异已折叠。
点击以展开。
txt/muban/drpy模板.js
浏览文件 @
4aea5b06
// 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,{
// var rule =
Object.assign(模板.首图2,{
// host: 'https://www.zbkk.net',
// });
...
...
@@ -114,9 +116,26 @@ function clearItem(k){
* @returns {*}
*/
function
urljoin
(
fromPath
,
nowPath
)
{
return
fromPath
+
nowPath
let
new_uri
=
Uri
(
nowPath
,
fromPath
);
new_uri
=
new_uri
.
toString
();
// console.log(new_uri);
// return fromPath + nowPath
return
new_uri
}
/**
* 重写pd方法-增加自动urljoin
* @param html
* @param parse
* @returns {*}
*/
function
pd
(
html
,
parse
){
let
ret
=
pdfh
(
html
,
parse
);
if
(
typeof
(
MY_URL
)
===
'
undefined
'
||!
MY_URL
){
var
MY_URL
=
''
;
}
return
urljoin
(
MY_URL
,
ret
)
}
/*** js自封装的方法 ***/
...
...
@@ -317,8 +336,9 @@ function homeVodParse(homeVodObj){
return
'
{}
'
}
let
d
=
[];
console
.
log
(
homeVodObj
.
homeUrl
);
let
html
=
getHtml
(
homeVodObj
.
homeUrl
);
MY_URL
=
homeVodObj
.
homeUrl
;
console
.
log
(
MY_URL
);
let
html
=
getHtml
(
MY_URL
);
try
{
console
.
log
(
'
double:
'
+
homeVodObj
.
double
);
if
(
homeVodObj
.
double
){
...
...
@@ -417,9 +437,10 @@ function categoryParse(cateObj) {
}
let
d
=
[];
let
url
=
cateObj
.
url
.
replaceAll
(
'
fyclass
'
,
cateObj
.
tid
).
replaceAll
(
'
fypage
'
,
cateObj
.
pg
);
console
.
log
(
url
);
MY_URL
=
url
;
console
.
log
(
MY_URL
);
try
{
let
html
=
getHtml
(
url
);
let
html
=
getHtml
(
MY_URL
);
if
(
html
)
{
let
list
=
pdfa
(
html
,
p
[
0
]);
list
.
forEach
(
it
=>
{
...
...
@@ -457,15 +478,16 @@ function searchParse(searchObj) {
}
let
d
=
[];
let
url
=
searchObj
.
searchUrl
.
replaceAll
(
'
**
'
,
searchObj
.
wd
).
replaceAll
(
'
fypage
'
,
searchObj
.
pg
);
console
.
log
(
url
);
MY_URL
=
url
;
console
.
log
(
MY_URL
);
try
{
let
html
=
getHtml
(
url
);
let
html
=
getHtml
(
MY_URL
);
if
(
html
)
{
if
(
/系统安全验证|输入验证码/
.
test
(
html
)){
let
cookie
=
verifyCode
(
url
);
let
cookie
=
verifyCode
(
MY_URL
);
setItem
(
RULE_CK
,
cookie
);
// obj.headers['Cookie'] = cookie;
html
=
getHtml
(
url
);
html
=
getHtml
(
MY_URL
);
}
if
(
!
html
.
includes
(
searchObj
.
wd
)){
console
.
log
(
'
搜索结果源码未包含关键字,疑似搜索失败,正为您打印结果源码
'
);
...
...
@@ -521,16 +543,17 @@ function detailParse(detailObj){
let
fyclass
=
detailObj
.
fyclass
;
let
tab_exclude
=
detailObj
.
tab_exclude
;
let
html
=
detailObj
.
html
||
''
;
console
.
log
(
url
);
MY_URL
=
url
;
console
.
log
(
MY_URL
);
if
(
p
===
'
*
'
){
vod
.
vod_play_from
=
'
道长在线
'
;
vod
.
vod_remarks
=
detailUrl
;
vod
.
vod_actor
=
'
没有二级,只有一级链接直接嗅探播放
'
;
vod
.
vod_content
=
url
;
vod
.
vod_play_url
=
'
嗅探播放$
'
+
url
;
vod
.
vod_content
=
MY_URL
;
vod
.
vod_play_url
=
'
嗅探播放$
'
+
MY_URL
;
}
else
if
(
p
&&
typeof
(
p
)
===
'
object
'
){
if
(
!
html
){
html
=
getHtml
(
url
);
html
=
getHtml
(
MY_URL
);
}
if
(
p
.
title
){
let
p1
=
p
.
title
.
split
(
'
;
'
);
...
...
@@ -628,9 +651,11 @@ console.log(JSON.stringify(vod));
* @returns {string}
*/
function
playParse
(
playObj
){
MY_URL
=
playObj
.
url
;
input
=
MY_URL
;
let
common_play
=
{
parse
:
1
,
url
:
playObj
.
url
url
:
MY_URL
};
let
lazy_play
;
if
(
!
rule
.
play_parse
||!
rule
.
lazy
){
...
...
@@ -756,7 +781,6 @@ function detail(vod_url) {
* @returns {string}
*/
function
play
(
flag
,
id
,
flags
)
{
id
=
id
.
startsWith
(
'
http
'
)?
id
:
urljoin
(
rule
.
host
,
id
);
let
playObj
=
{
url
:
id
,
flag
:
flag
,
...
...
txt/muban/原生js.js
0 → 100644
浏览文件 @
4aea5b06
// import URI from './uri.min.js';
// import URI from './uri.min.js';
// var URI = require('./uri.min.js');
// npm install urijs
var
URI
=
require
(
'
urijs
'
);
var
uri
=
new
URI
(
"
/relative/path
"
);
// let c = URI.resolve('http://example.com/one', '/two');
// let d = URI.resolve('http://example.com/one', 'http://www.baidu.com');
// console.log(c);
// console.log(d);
var
uri2
=
URI
(
"
../foobar.html
"
,
"
http://example.org/hello/world.html
"
);
console
.
log
(
uri2
.
toString
())
uri2
=
URI
(
'
http://www.baidu.com
'
,
'
http://example.com/one
'
);
console
.
log
(
uri2
.
toString
())
uri2
=
URI
(
''
,
'
http://example.com/one
'
);
console
.
log
(
uri2
.
toString
())
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
}
console
.
log
(
urljoin
(
'
http://example.com/one
'
,
'
/detail/1.html
'
));
console
.
log
(
urljoin
(
'
http://example.com/one/path/
'
,
'
detail/1.html
'
));
console
.
log
(
urljoin
(
'
http://example.com/one
'
,
'
http://www.baidu.com
'
));
console
.
log
(
urljoin
(
'
https://example.com/one
'
,
'
//path/1.png
'
));
// make path relative
var
relUri
=
uri
.
relativeTo
(
"
/relative/sub/foo/sub/file
"
);
// returns a new URI instance
// relUri == "../../../path"
// absolute URLs are passed through unchanged
let
a
=
URI
(
"
http://example.org/world.html
"
).
relativeTo
(
"
http://google.com/baz
"
);
console
.
log
(
a
.
toString
())
// -> "http://example.org/world.html"
// absolute URLs relative to absolute URLs
// may resolve the protocol
URI
(
"
http://example.org/world.html
"
)
.
clone
()
.
authority
(
""
)
.
relativeTo
(
"
http://google.com/baz
"
);
// -> "//google.com/world.html"
// equal URLs are relative by empty string
URI
(
"
http://www.example.com:8080/dir/file
"
)
.
relativeTo
(
'
http://www.example.com:8080/dir/file
'
);
// -> ""
// relative on fragment and query string as well
URI
(
"
http://www.example.com:8080/dir/file?foo=bar#abcd
"
)
.
relativeTo
(
'
http://www.example.com:8080/dir/file
'
);
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录