Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
仰淮
dr_py
提交
74856666
dr_py
项目概览
仰淮
/
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,发现更多精彩内容 >>
提交
74856666
编写于
9月 02, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化了免嗅写法的注入函数,不需要d.saveParse了
上级
8f394e95
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
34 addition
and
13 deletion
+34
-13
app.py
app.py
+1
-0
classes/cms.py
classes/cms.py
+12
-4
js/干饭影视.js
js/干饭影视.js
+2
-1
js/蓝莓影视.js
js/蓝莓影视.js
+7
-1
py/干饭.js
py/干饭.js
+6
-3
py/蓝莓.js
py/蓝莓.js
+4
-3
utils/parser.py
utils/parser.py
+2
-1
未找到文件。
app.py
浏览文件 @
74856666
...
...
@@ -216,6 +216,7 @@ def vod():
return
jsonify
(
error
.
failed
(
'爬虫规则加载失败'
))
# rule = ctx.eval('rule')
# print(type(ctx.rule.lazy()),ctx.rule.lazy().toString())
ruleDict
=
ctx
.
rule
.
to_dict
()
ruleDict
[
'id'
]
=
rule
# 把路由请求的id装到字典里,后面播放嗅探才能用
# print(ruleDict)
...
...
classes/cms.py
浏览文件 @
74856666
...
...
@@ -14,7 +14,7 @@ from utils.log import logger
from
utils.encode
import
base64Encode
,
baseDecode
,
fetch
,
post
,
request
,
getCryptoJS
,
getPreJs
,
buildUrl
,
getHome
from
utils.encode
import
verifyCode
from
utils.safePython
import
safePython
from
utils.parser
import
runPy
,
runJScode
from
utils.parser
import
runPy
,
runJScode
,
JsObjectWrapper
from
utils.htmlParser
import
jsoup
from
urllib.parse
import
urljoin
from
concurrent.futures
import
ThreadPoolExecutor
# 引入线程池
...
...
@@ -731,10 +731,13 @@ class CMS:
if
not
jxs
:
jxs
=
[]
if
self
.
lazy
:
print
(
f
'
{
play_url
}
->开始执行免嗅代码->
{
self
.
lazy
}
'
)
print
(
f
'
{
play_url
}
->开始执行免嗅代码
{
type
(
self
.
lazy
)
}
->
{
self
.
lazy
}
'
)
t1
=
time
()
try
:
if
not
str
(
self
.
lazy
).
startswith
(
'js:'
):
if
type
(
self
.
lazy
)
==
JsObjectWrapper
:
logger
.
info
(
f
'lazy非纯文本免嗅失败耗时:
{
get_interval
(
t1
)
}
毫秒,播放地址:
{
play_url
}
'
)
elif
not
str
(
self
.
lazy
).
startswith
(
'js:'
):
pycode
=
runPy
(
self
.
lazy
)
if
pycode
:
# print(pycode)
...
...
@@ -750,16 +753,19 @@ class CMS:
jscode
=
str
(
self
.
lazy
).
split
(
'js:'
)[
1
]
# jscode = f'var input={play_url};{jscode}'
# print(jscode)
headers
[
'Referer'
]
=
getHome
(
play_url
)
py_ctx
.
update
({
'input'
:
play_url
,
'fetch_params'
:{
'headers'
:
headers
,
'timeout'
:
self
.
d
.
timeout
,
'encoding'
:
self
.
d
.
encoding
},
'd'
:
self
.
d
,
'jxs'
:
jxs
,
'getParse'
:
self
.
d
.
getParse
,
'saveParse'
:
self
.
d
.
saveParse
,
'pdfh'
:
self
.
d
.
jsp
.
pdfh
,
'pdfa'
:
self
.
d
.
jsp
.
pdfa
,
'pd'
:
self
.
d
.
jsp
.
pd
,
})
ctx
=
py_ctx
# print(ctx)
t1
=
time
()
jscode
=
getPreJs
()
+
jscode
# print(jscode)
loader
,
_
=
runJScode
(
jscode
,
ctx
=
ctx
)
...
...
@@ -782,6 +788,8 @@ if __name__ == '__main__':
js_path
=
f
'js/vip影院.js'
ctx
,
js_code
=
parser
.
runJs
(
js_path
,
before
=
before
)
ruleDict
=
ctx
.
rule
.
to_dict
()
# lazy = ctx.eval('lazy')
# print(lazy)
# ruleDict['id'] = rule # 把路由请求的id装到字典里,后面播放嗅探才能用
cms
=
CMS
(
ruleDict
)
...
...
js/干饭影视.js
浏览文件 @
74856666
...
...
@@ -17,7 +17,8 @@ var rule = {
// 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);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)}}
'
,
// 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)}}',
lazy
:
'
js:cacheUrl=getParse(input);if(cacheUrl){input=cacheUrl}else{try{let html=fetch(input,fetch_params);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;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
,
// 推荐内容是否双层定位
...
...
js/蓝莓影视.js
浏览文件 @
74856666
...
...
@@ -6,5 +6,10 @@ searchUrl:'/search/**-fypage.html',
searchable
:
1
,
quickSearch
:
1
,
class_parse
:
'
.navbar-items li:gt(1):lt(8);a&&Text;a&&href;/(
\\
d+).html
'
,
lazy
:
'
js:var MY_HOME="http://lanmeiguojiang.com:5244/d/%E8%93%9D%E8%8E%93%E4%BA%91%E7%9B%98";let headers=d.headers;headers["Referer"]=input;let fetch_params={headers:headers,timeout:d.timeout,encoding:d.encoding};let html=fetch(input,fetch_params);var player=JSON.parse(html.match(/r player_.*?=(.*?)</)[1]);var jsurl=player.url;var from=player.from;if(player.encrypt=="1"){var jsurl=unescape(jsurl)}else if(player.encrypt=="2"){var jsurl=unescape(base64Decode(jsurl))}else{jsurl}if(/ddzy|duoduo/.test(from)){let mx=false;if(mx){let html=request(MY_HOME+"/pzwj.js");eval(html);var jx=MacPlayerConfig.player_list[from].parse;print("第1次多多解析:",jx);eval(fetch(jx+jsurl,fetch_params).match(/var config = {[
\\
s
\\
S]*?}/)[0]);jx=jx.replace("?url=","");eval(fetch(jx+"js/decode.js",fetch_params));jxk=fetch(jx+"js/setting.js",fetch_params).split(",");jx+="555tZ4pvzHE3BpiO838.php";print("第2次多多解析:",jx);config.tm=(new Date).getTime();config.sign="F4penExTGogdt6U8";input=getVideoInfo(JSON.parse(fetch(buildUrl(jx,config),fetch_params)).url)}}else{let jxurl="https://lanmeiguojiang.com/dd/?url="+jsurl;input=maoss(jxurl,jxurl,"A42EAC0C2B408472")}
'
,
// lazy:'js:print(fetch_params);var MY_HOME="http://lanmeiguojiang.com:5244/d/%E8%93%9D%E8%8E%93%E4%BA%91%E7%9B%98";let headers=d.headers;headers["Referer"]=input;let fetch_params={headers:headers,timeout:d.timeout,encoding:d.encoding};let html=fetch(input,fetch_params);var player=JSON.parse(html.match(/r player_.*?=(.*?)</)[1]);var jsurl=player.url;var from=player.from;if(player.encrypt=="1"){var jsurl=unescape(jsurl)}else if(player.encrypt=="2"){var jsurl=unescape(base64Decode(jsurl))}else{jsurl}if(/ddzy|duoduo/.test(from)){let mx=false;if(mx){let html=request(MY_HOME+"/pzwj.js");eval(html);var jx=MacPlayerConfig.player_list[from].parse;print("第1次多多解析:",jx);eval(fetch(jx+jsurl,fetch_params).match(/var config = {[\\s\\S]*?}/)[0]);jx=jx.replace("?url=","");eval(fetch(jx+"js/decode.js",fetch_params));jxk=fetch(jx+"js/setting.js",fetch_params).split(",");jx+="555tZ4pvzHE3BpiO838.php";print("第2次多多解析:",jx);config.tm=(new Date).getTime();config.sign="F4penExTGogdt6U8";input=getVideoInfo(JSON.parse(fetch(buildUrl(jx,config),fetch_params)).url)}}else{let jxurl="https://lanmeiguojiang.com/dd/?url="+jsurl;input=maoss(jxurl,jxurl,"A42EAC0C2B408472")}',
lazy
:
'
js:var MY_HOME="http://lanmeiguojiang.com:5244/d/%E8%93%9D%E8%8E%93%E4%BA%91%E7%9B%98";print(fetch_params);let html=fetch(input,fetch_params);var player=JSON.parse(html.match(/r player_.*?=(.*?)</)[1]);var jsurl=player.url;var from=player.from;if(player.encrypt=="1"){var jsurl=unescape(jsurl)}else if(player.encrypt=="2"){var jsurl=unescape(base64Decode(jsurl))}else{jsurl}if(/ddzy|duoduo/.test(from)){let mx=false;if(mx){let html=request(MY_HOME+"/pzwj.js");eval(html);var jx=MacPlayerConfig.player_list[from].parse;print("第1次多多解析:",jx);eval(fetch(jx+jsurl,fetch_params).match(/var config = {[
\\
s
\\
S]*?}/)[0]);jx=jx.replace("?url=","");eval(fetch(jx+"js/decode.js",fetch_params));jxk=fetch(jx+"js/setting.js",fetch_params).split(",");jx+="555tZ4pvzHE3BpiO838.php";print("第2次多多解析:",jx);config.tm=(new Date).getTime();config.sign="F4penExTGogdt6U8";input=getVideoInfo(JSON.parse(fetch(buildUrl(jx,config),fetch_params)).url)}}else{let jxurl="https://lanmeiguojiang.com/dd/?url="+jsurl;input=maoss(jxurl,jxurl,"A42EAC0C2B408472")}
'
,
// lazy:(function(input){
// console.log(typeof(pdfh))
// return input
// }),
});
\ No newline at end of file
py/干饭.js
浏览文件 @
74856666
js
:
cacheUrl
=
d
.
getParse
(
input
);
// cacheUrl = d.getParse(input);
cacheUrl
=
getParse
(
input
);
// print(cacheUrl);
if
(
cacheUrl
){
input
=
cacheUrl
;
}
else
{
try
{
// 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
});
// let html = fetch(input, {headers:d.headers,timeout:d.timeout,encoding:d.encoding});
let
html
=
fetch
(
input
,
fetch_params
);
// js = pdfh(html,'.stui-player__video script:eq(0)&&Html');
// print(js);
let
ret
=
html
.
match
(
/var player_
(
.*
?)
=
(
.*
?)
</
)[
2
];
...
...
@@ -14,7 +16,8 @@ if(cacheUrl){
if
(
url
.
length
>
10
){
real_url
=
'
https://player.buyaotou.xyz/?url=
'
+
url
;
// log('免嗅地址:'+real_url);
d
.
saveParse
(
input
,
real_url
);
// d.saveParse(input,real_url);
saveParse
(
input
,
real_url
);
input
=
real_url
;
}
}
catch
(
e
)
{
...
...
py/蓝莓.js
浏览文件 @
74856666
js
:
var
MY_HOME
=
'
http://lanmeiguojiang.com:5244/d/%E8%93%9D%E8%8E%93%E4%BA%91%E7%9B%98
'
;
let
headers
=
d
.
headers
;
headers
[
'
Referer
'
]
=
input
;
let
fetch_params
=
{
headers
:
headers
,
timeout
:
d
.
timeout
,
encoding
:
d
.
encoding
};
// let headers = d.headers;
// headers['Referer'] = input;
// let fetch_params = {headers:headers,timeout:d.timeout,encoding:d.encoding};
print
(
fetch_params
);
let
html
=
fetch
(
input
,
fetch_params
);
var
player
=
JSON
.
parse
(
html
.
match
(
/r player_.*
?
=
(
.*
?)
</
)[
1
]);
var
jsurl
=
player
.
url
;
...
...
utils/parser.py
浏览文件 @
74856666
...
...
@@ -14,6 +14,7 @@ subprocess.Popen = partial(subprocess.Popen, encoding="utf-8") # 固定写法
# 解决execjs执行js时产生的乱码报错,需要在导入该模块之前,让Popen的encoding参数锁定为utf-8
# import execjs
import
js2py
from
js2py.base
import
JsObjectWrapper
# os.environ["EXECJS_RUNTIME"] = "JScript"
# print(execjs.get().name)
...
...
@@ -155,7 +156,7 @@ def covert_demo():
print
(
loader
.
eval
(
'r = requests.get("https://www.baidu.com/");r.encoding = "utf-8";r.text'
))
# 下面是错误用法,没有loader环境没法正确eval_js,有loader用eval不需要eval_js
# print(js2py.eval_js('r = requests.get("https://www.baidu.com/");r.encoding = "utf-8";r.text'))
with
open
(
'../js/
夜空
.js'
,
encoding
=
'utf-8'
)
as
f
:
with
open
(
'../js/
蓝莓影视
.js'
,
encoding
=
'utf-8'
)
as
f
:
yk
=
f
.
read
()
print
(
yk
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录