Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mine929
dr_py
提交
1095955d
dr_py
项目概览
mine929
/
dr_py
与 Fork 源项目一致
Fork自
晚风拂柳颜 / dr_py
通知
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,发现更多精彩内容 >>
提交
1095955d
编写于
8月 29, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
我又可以了,js免嗅肝出来了
上级
55b1ec5a
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
87 addition
and
24 deletion
+87
-24
classes/cms.py
classes/cms.py
+15
-6
js/干饭影视.js
js/干饭影视.js
+2
-1
models/rules.db
models/rules.db
+0
-0
py/干饭.js
py/干饭.js
+12
-17
readme.md
readme.md
+1
-0
utils/encode.py
utils/encode.py
+57
-0
未找到文件。
classes/cms.py
浏览文件 @
1095955d
...
...
@@ -11,6 +11,7 @@ from utils.web import *
from
models
import
*
from
utils.config
import
config
from
utils.log
import
logger
from
utils.encode
import
base64Encode
,
baseDecode
,
fetch
,
post
from
utils.safePython
import
safePython
from
utils.parser
import
runPy
,
runJScode
from
utils.htmlParser
import
jsoup
...
...
@@ -19,6 +20,11 @@ from concurrent.futures import ThreadPoolExecutor # 引入线程池
from
flask
import
url_for
,
redirect
from
easydict
import
EasyDict
as
edict
py_ctx
=
{
'requests'
:
requests
,
'print'
:
print
,
'base64Encode'
:
base64Encode
,
'baseDecode'
:
baseDecode
,
'log'
:
logger
.
info
,
'fetch'
:
fetch
,
'post'
:
post
}
class
CMS
:
def
__init__
(
self
,
rule
,
db
=
None
,
RuleClass
=
None
,
PlayParse
=
None
,
new_conf
=
None
):
if
new_conf
is
None
:
...
...
@@ -223,7 +229,7 @@ class CMS:
logger
.
info
(
f
"
{
name
}
使用缓存播放地址:
{
real_url
}
"
)
return
real_url
else
:
return
[]
return
''
def
saveParse
(
self
,
play_url
,
real_url
):
if
not
self
.
db
:
...
...
@@ -632,11 +638,14 @@ class CMS:
jscode
=
str
(
self
.
lazy
).
split
(
'js:'
)[
1
]
# jscode = f'var input={play_url};{jscode}'
# print(jscode)
loader
,
_
=
runJScode
(
jscode
,
ctx
=
{
'input'
:
play_url
,
'requests'
:
requests
,
'print'
:
print
,
'd'
:
self
.
d
,
'log'
:
logger
.
info
,
'pdfh'
:
self
.
d
.
jsp
.
pdfh
,
'pdfa'
:
self
.
d
.
jsp
.
pdfa
,
'pd'
:
self
.
d
.
jsp
.
pd
,
})
py_ctx
.
update
({
'input'
:
play_url
,
'd'
:
self
.
d
,
'pdfh'
:
self
.
d
.
jsp
.
pdfh
,
'pdfa'
:
self
.
d
.
jsp
.
pdfa
,
'pd'
:
self
.
d
.
jsp
.
pd
,
})
ctx
=
py_ctx
loader
,
_
=
runJScode
(
jscode
,
ctx
=
ctx
)
# print(loader.toString())
play_url
=
loader
.
eval
(
'input'
)
print
(
'play_url:'
,
play_url
)
...
...
js/干饭影视.js
浏览文件 @
1095955d
...
...
@@ -13,7 +13,8 @@ var rule = {
play_parse
:
true
,
// lazy:'干饭',
// lazy:'@js:cacheUrl = d.getParse(input);print(cacheUrl);input=cacheUrl',
lazy
:
'
js:cacheUrl = d.getParse(input);print(cacheUrl);input=cacheUrl
'
,
// lazy:'js:cacheUrl = d.getParse(input);print(cacheUrl);input=cacheUrl',
lazy
:
'
js:cacheUrl=d.getParse(input);if(cacheUrl){input=cacheUrl}else{try{let html=fetch(input,{headers:d.headers,timeout:d.timeout,encoding:d.encoding});let ret=html.match(/var player_(.*?)=(.*?)</)[2];let url=JSON.parse(ret).url;if(url.length>10){real_url="https://player.buyaotou.xyz/?url="+url;d.saveParse(input,real_url);input=real_url}}catch(e){print("网络请求发生错误:"+e.message)}}
'
,
limit
:
5
,
推荐
:
'
ul.stui-vodlist.clearfix;li;a&&title;.lazyload&&data-original;;a&&href
'
,
double
:
true
,
// 推荐内容是否双层定位
...
...
models/rules.db
浏览文件 @
1095955d
无法预览此类型文件
py/干饭.js
浏览文件 @
1095955d
js
:
cacheUrl
=
d
.
getParse
(
input
);
print
(
cacheUrl
);
//
print(cacheUrl);
if
(
cacheUrl
){
input
=
cacheUrl
;
}
else
{
try
{
r
=
requests
.
get
(
input
,
headers
=
d
.
headers
,
timeout
=
d
.
timeout
);
r
.
encoding
=
d
.
encoding
;
html
=
r
.
text
;
// let html = fetch([input, {headers:d.headers,timeout:d.timeout,encoding:d.encoding}]);
let
html
=
fetch
(
input
,
{
headers
:
d
.
headers
,
timeout
:
d
.
timeout
,
encoding
:
d
.
encoding
});
// js = pdfh(html,'.stui-player__video script:eq(0)&&Html');
// print(js);
let
ret
=
html
.
match
(
/var player_
(
.*
?)
=
(
.*
?)
</
)[
2
];
let
url
=
JSON
.
parse
(
ret
).
url
;
if
(
/
\.
m3u8|
\.
mp4/
.
test
(
url
)){
input
=
url
}
else
if
(
!
/http/
.
test
(
url
)
&&!
/
\/
/
.
test
(
url
)){
try
{
url
=
unescape
(
base64Decode
(
url
));
if
(
/http/
.
test
(
url
)){
input
=
url
}
}
catch
(
e
)
{
print
(
'
解码url发生错误:
'
+
e
.
message
);
}
if
(
url
.
length
>
10
){
real_url
=
'
https://player.buyaotou.xyz/?url=
'
+
url
;
d
.
saveParse
(
input
,
real_url
);
input
=
real_url
;
}
}
catch
(
e
)
{
print
(
'
发生错误:
'
+
e
.
message
);
print
(
'
网络请求
发生错误:
'
+
e
.
message
);
}
}
}
\ No newline at end of file
readme.md
浏览文件 @
1095955d
...
...
@@ -3,6 +3,7 @@
###### 2022/08/29
-
[X] 1.更换js引擎,速度更快性能更好
-
[X] 2.新版js支持与python互动,后期可能支持js免嗅(lazy:'@js:xxx')
-
[X] 3.支持了js免嗅和常用的fetch,post方法
###### 2022/08/28
-
[X] 1.增加linux进程启动,命令 supervisord -c manager.conf
-
[X] 2.转移文本文件到txt目录
...
...
utils/encode.py
0 → 100644
浏览文件 @
1095955d
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : encode.py
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Date : 2022/8/29
import
base64
import
requests
def
base64Encode
(
text
):
return
base64
.
b64encode
(
text
.
encode
(
"utf8"
)).
decode
(
"utf-8"
)
#base64编码
def
baseDecode
(
text
):
return
base64
.
b64decode
(
text
).
decode
(
"utf-8"
)
#base64解码
def
base_request
(
url
,
obj
,
method
=
'get'
):
url
=
str
(
url
).
replace
(
"'"
,
""
)
encoding
=
obj
.
get
(
'encoding'
)
or
'utf-8'
encoding
=
str
(
encoding
).
replace
(
"'"
,
""
)
# print(type(url),url)
# headers = dict(obj.get('headers')) if obj.get('headers') else {}
# headers = obj.get('headers').to_dict() if obj.get('headers') else {}
headers
=
obj
.
get
(
'headers'
)
if
obj
.
get
(
'headers'
)
else
{}
new_headers
=
{}
# print(type(headers),headers)
for
i
in
headers
:
new_headers
[
str
(
i
).
replace
(
"'"
,
""
)]
=
str
(
headers
[
i
]).
replace
(
"'"
,
""
)
# print(type(new_headers), new_headers)
timeout
=
float
(
obj
.
get
(
'timeout'
).
to_int
())
if
obj
.
get
(
'timeout'
)
else
None
# print(type(timeout), timeout)
body
=
obj
.
get
(
'body'
)
if
obj
.
get
(
'body'
)
else
{}
new_body
=
{}
for
i
in
body
:
new_body
[
str
(
i
).
replace
(
"'"
,
""
)]
=
str
(
body
[
i
]).
replace
(
"'"
,
""
)
# print(type(new_body), new_body)
try
:
# r = requests.get(url, headers=headers, params=body, timeout=timeout)
if
method
.
lower
()
==
'get'
:
r
=
requests
.
get
(
url
,
headers
=
new_headers
,
params
=
new_body
,
timeout
=
timeout
)
else
:
r
=
requests
.
post
(
url
,
headers
=
new_headers
,
data
=
new_body
,
timeout
=
timeout
)
# r = requests.get(url, timeout=timeout)
# r = requests.get(url)
# print(encoding)
r
.
encoding
=
encoding
# print(f'源码:{r.text}')
return
r
.
text
except
Exception
as
e
:
print
(
f
'
{
method
}
请求发生错误:
{
e
}
'
)
return
''
def
fetch
(
url
,
obj
):
return
base_request
(
url
,
obj
)
def
post
(
url
,
obj
):
return
base_request
(
url
,
obj
,
'post'
)
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录