Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
季末490
dr_py
提交
67959409
dr_py
项目概览
季末490
/
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,发现更多精彩内容 >>
提交
67959409
编写于
9月 23, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优酷一二级完成
上级
7c67c76c
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
158 addition
and
5 deletion
+158
-5
base/rules.db
base/rules.db
+0
-0
controllers/cms.py
controllers/cms.py
+20
-3
js/优酷.js
js/优酷.js
+0
-0
libs/pre.js
libs/pre.js
+2
-0
py/优酷一级.js
py/优酷一级.js
+50
-0
py/优酷二级.js
py/优酷二级.js
+83
-0
py/优酷筛选.py
py/优酷筛选.py
+3
-2
未找到文件。
base/rules.db
浏览文件 @
67959409
无法预览此类型文件
controllers/cms.py
浏览文件 @
67959409
...
...
@@ -15,7 +15,7 @@ from utils.log import logger
from
utils.encode
import
base64Encode
,
baseDecode
,
fetch
,
post
,
request
,
getCryptoJS
,
getPreJs
,
buildUrl
,
getHome
from
utils.encode
import
verifyCode
,
setDetail
,
join
,
urljoin2
,
parseText
from
utils.safePython
import
safePython
from
utils.parser
import
runPy
,
runJScode
,
JsObjectWrapper
,
PyJsObject
from
utils.parser
import
runPy
,
runJScode
,
JsObjectWrapper
,
PyJsObject
,
PyJsString
from
utils.htmlParser
import
jsoup
from
urllib.parse
import
urljoin
,
quote
,
unquote
from
concurrent.futures
import
ThreadPoolExecutor
# 引入线程池
...
...
@@ -25,19 +25,33 @@ from controllers.service import storage_service
def
setItem
(
key
,
value
):
lsg
=
storage_service
()
if
isinstance
(
key
,
PyJsString
):
key
=
parseText
(
str
(
key
))
if
isinstance
(
value
,
PyJsString
):
value
=
parseText
(
str
(
value
))
return
lsg
.
setItem
(
key
,
value
)
def
getItem
(
key
,
value
=
''
):
lsg
=
storage_service
()
if
isinstance
(
key
,
PyJsString
):
key
=
parseText
(
str
(
key
))
if
isinstance
(
value
,
PyJsString
):
value
=
parseText
(
str
(
value
))
return
lsg
.
getItem
(
key
,
value
)
def
clearItem
(
key
):
lsg
=
storage_service
()
if
isinstance
(
key
,
PyJsString
):
key
=
parseText
(
str
(
key
))
return
lsg
.
clearItem
(
key
)
def
encodeUrl
(
url
):
# return base64Encode(quote(url))
# return base64Encode(url)
# print(type(url))
if
isinstance
(
url
,
PyJsString
):
# obj = obj.to_dict()
url
=
parseText
(
str
(
url
))
return
quote
(
url
)
def
stringify
(
obj
):
...
...
@@ -51,7 +65,7 @@ py_ctx = {
'log'
:
logger
.
info
,
'fetch'
:
fetch
,
'post'
:
post
,
'request'
:
request
,
'getCryptoJS'
:
getCryptoJS
,
'buildUrl'
:
buildUrl
,
'getHome'
:
getHome
,
'setDetail'
:
setDetail
,
'join'
:
join
,
'urljoin2'
:
urljoin2
,
'PC_UA'
:
PC_UA
,
'MOBILE_UA'
:
MOBILE_UA
,
'UC_UA'
:
UC_UA
,
'IOS_UA'
:
IOS_UA
,
'setItem'
:
setItem
,
'getItem'
:
getItem
,
'clearItem'
:
clearItem
,
'stringify'
:
stringify
'setItem'
:
setItem
,
'getItem'
:
getItem
,
'clearItem'
:
clearItem
,
'stringify'
:
stringify
,
'encodeUrl'
:
encodeUrl
}
# print(getCryptoJS())
...
...
@@ -117,6 +131,7 @@ class CMS:
self
.
RuleClass
=
RuleClass
self
.
PlayParse
=
PlayParse
host
=
rule
.
get
(
'host'
,
''
).
rstrip
(
'/'
)
host
=
unquote
(
host
)
timeout
=
rule
.
get
(
'timeout'
,
5000
)
homeUrl
=
rule
.
get
(
'homeUrl'
,
'/'
)
url
=
rule
.
get
(
'url'
,
''
)
...
...
@@ -673,7 +688,7 @@ class CMS:
url
=
url
.
replace
(
'fypage'
,
pg
)
if
fypage
==
1
and
self
.
test
(
'[\[\]]'
,
url
):
url
=
url
.
split
(
'['
)[
1
].
split
(
']'
)[
0
]
print
(
url
)
#
print(url)
p
=
self
.
一级
jsp
=
jsoup
(
self
.
url
)
videos
=
[]
...
...
@@ -723,6 +738,8 @@ class CMS:
try
:
r
=
requests
.
get
(
url
,
headers
=
self
.
headers
,
timeout
=
self
.
timeout
)
html
=
self
.
checkHtml
(
r
)
print
(
self
.
headers
)
print
(
html
)
if
is_json
:
html
=
self
.
dealJson
(
html
)
html
=
json
.
loads
(
html
)
...
...
js/优酷.js
浏览文件 @
67959409
此差异已折叠。
点击以展开。
libs/pre.js
浏览文件 @
67959409
...
...
@@ -221,6 +221,7 @@ function maoss(jxurl, ref, key) {
function
request
(
url
,
obj
){
// obj = obj||{'user-agent': MOBILE_UA};
print
(
'
224
'
);
let
new_obj
;
if
(
typeof
(
fetch_params
)
!==
'
undefined
'
){
new_obj
=
obj
?
Object
.
assign
(
fetch_params
,
obj
):
fetch_params
;
...
...
@@ -241,6 +242,7 @@ function request(url,obj){
}
return
html
}
print
(
'
245
'
);
return
''
}
...
...
py/优酷一级.js
0 → 100644
浏览文件 @
67959409
js
:
let
d
=
[];
MY_FL
.
type
=
MY_CATE
;
let
fl
=
stringify
(
MY_FL
);
fl
=
encodeUrl
(
fl
);
input
=
input
.
split
(
'
{
'
)[
0
]
+
fl
;
if
(
MY_PAGE
>
1
){
let
old_session
=
getItem
(
'
yk_session_
'
+
MY_CATE
,
'
{}
'
);
// print('本地访问session:'+old_session);
if
(
MY_PAGE
===
2
){
input
=
input
.
replace
(
'
optionRefresh=1
'
,
'
session=
'
+
encodeUrl
(
old_session
));
}
else
{
// input = input.replace(/session=.*?&/,'session='+encodeUrl(old_session)+'&');
input
=
input
.
replace
(
'
optionRefresh=1
'
,
'
session=
'
+
encodeUrl
(
old_session
));
}
}
let
html
=
fetch
(
input
,
fetch_params
);
// print(html);
try
{
html
=
JSON
.
parse
(
html
);
let
lists
=
html
.
data
.
filterData
.
listData
;
let
session
=
html
.
data
.
filterData
.
session
;
session
=
stringify
(
session
);
// print(session);
if
(
session
!==
getItem
(
'
yk_session_
'
+
MY_CATE
,
'
{}
'
)){
setItem
(
'
yk_session_
'
+
MY_CATE
,
session
);
}
lists
.
forEach
(
function
(
it
){
let
vid
;
if
(
it
.
videoLink
.
includes
(
'
id_
'
))
{
vid
=
it
.
videoLink
.
split
(
"
id_
"
)[
1
].
split
(
'
.html
'
)[
0
];
// vid = it.videoLink.split("id_")[1].replace('.html','');
}
else
{
vid
=
'
msearch:
'
}
d
.
push
({
title
:
it
.
title
,
img
:
it
.
img
,
desc
:
it
.
summary
,
url
:
'
https://search.youku.com/api/search?appScene=show_episode&showIds=
'
+
vid
,
content
:
it
.
subTitle
});
});
}
catch
(
e
)
{
log
(
'
一级列表解析发生错误:
'
+
e
.
message
);
}
// print(d);
setResult
(
d
)
\ No newline at end of file
py/优酷二级.js
0 → 100644
浏览文件 @
67959409
js
:
var
d
=
[];
var
vod
=
{
vod_id
:
input
};
let
html
=
request
(
input
);
// print(html);
let
json
=
JSON
.
parse
(
html
);
if
(
/keyword/
.
test
(
input
))
{
input
=
'
https://search.youku.com/api/search?appScene=show_episode&showIds=
'
+
json
.
pageComponentList
[
0
].
commonData
.
showId
;
json
=
JSON
.
parse
(
fetch
(
MY_URL
,
fetch_params
));
}
let
video_lists
=
json
.
serisesList
;
var
name
=
json
.
sourceName
;
if
(
/优酷/
.
test
(
name
)
&&
video_lists
.
length
>
0
){
//获取简介详情
let
ourl
=
'
https://v.youku.com/v_show/id_
'
+
video_lists
[
0
].
videoId
+
'
.html
'
;
let
_img
=
video_lists
[
0
].
thumbUrl
;
// log(ourl);
let
html
=
fetch
(
ourl
,{
headers
:{
'
Referer
'
:
'
https://v.youku.com/
'
,
'
User-Agent
'
:
PC_UA
}});
let
json
=
/__INITIAL_DATA__/
.
test
(
html
)?
html
.
split
(
'
window.__INITIAL_DATA__ =
'
)[
1
].
split
(
'
;
'
)[
0
]:
'
{}
'
;
if
(
json
===
'
{}
'
){
log
(
'
触发了优酷人机验证
'
);
vod
.
vod_remarks
=
ourl
;
vod
.
vod_pic
=
_img
;
vod
.
vod_name
=
video_lists
[
0
].
title
.
replace
(
/
(\d
+
)
/g
,
''
);
vod
.
vod_content
=
'
触发了优酷人机验证,本次未获取详情,但不影响播放(
'
+
ourl
+
'
)
'
;
}
else
{
try
{
json
=
JSON
.
parse
(
json
);
let
data
=
json
.
data
.
data
;
let
data_extra
=
data
.
data
.
extra
;
let
img
=
data_extra
.
showImgV
;
let
model
=
json
.
data
.
model
;
let
m
=
model
.
detail
.
data
.
nodes
[
0
].
nodes
[
0
].
nodes
[
0
].
data
;
let
_type
=
m
.
showGenre
let
_desc
=
m
.
updateInfo
||
m
.
subtitle
;
let
JJ
=
m
.
desc
;
let
_title
=
m
.
introTitle
;
// subtitle desc showImgV 是竖着的 showImg横着的
// let uptips = pdfh(html,'.title-info&&Text');
vod
.
vod_pic
=
img
;
vod
.
vod_name
=
_title
;
vod
.
vod_type
=
_type
;
vod
.
vod_remarks
=
_desc
;
vod
.
vod_content
=
JJ
;
}
catch
(
e
)
{
log
(
'
海报渲染发生错误:
'
+
e
.
message
);
vod
.
vod_remarks
=
name
;
}
}
}
if
(
!
/优酷/
.
test
(
name
)){
vod
.
vod_content
=
'
非自家播放源,暂无视频简介及海报
'
;
vod
.
vod_remarks
=
name
;
}
function
adhead
(
url
){
// let hd = 'https://v.sogou.com';
// if(!url.startsWith(hd)){
// url = hd+url
// }
return
urlencode
(
url
)
}
play_url
=
play_url
.
replace
(
'
&play_url=
'
,
'
&type=json&play_url=
'
);
video_lists
.
forEach
(
function
(
it
){
let
url
=
'
https://v.youku.com/v_show/id_
'
+
it
.
videoId
+
'
.html
'
;
if
(
it
.
thumbUrl
)
{
d
.
push
({
desc
:
it
.
showVideoStage
?
it
.
showVideoStage
.
replace
(
'
期
'
,
'
集
'
)
:
it
.
displayName
,
pic_url
:
it
.
thumbUrl
,
title
:
it
.
title
,
url
:
play_url
+
adhead
(
url
),
});
}
else
if
(
name
!==
'
优酷
'
){
d
.
push
({
title
:
(
it
.
displayName
?
it
.
displayName
:
it
.
title
),
url
:
play_url
+
adhead
(
it
.
url
),
});
}
});
vod
.
vod_play_from
=
name
;
vod
.
vod_play_url
=
d
.
map
(
function
(
it
){
return
it
.
title
+
'
$
'
+
it
.
url
;
}).
join
(
'
#
'
);
\ No newline at end of file
py/优酷筛选.py
浏览文件 @
67959409
...
...
@@ -13,8 +13,8 @@ from pprint import pprint
headers1
=
{
'user-agent'
:
'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36'
# ,'x-requested-with':'XMLHttpRequest'
,
'sec-fetch-site'
:
'same-origin'
,
'sec-fetch-mode'
:
'cors'
#
,'sec-fetch-site':'same-origin'
#
,'sec-fetch-mode':'cors'
# ,'referer':'https://www.youku.com/category/show/type_%E7%94%B5%E8%A7%86%E5%89%A7_mainArea_%E4%B8%AD%E5%9B%BD%E5%86%85%E5%9C%B0_tags_%E9%9D%92%E6%98%A5.html?spm=a2ha1.14919748_WEBTV_JINGXUAN.drawer3.27'
,
'referer'
:
'https://www.youku.com'
}
...
...
@@ -23,6 +23,7 @@ html = r.json()
cates_data
=
html
[
'data'
][
'filterData'
][
'filter'
][
'filterData'
][
0
][
'subFilter'
]
cates_data
=
list
(
map
(
lambda
x
:
x
[
'title'
],
cates_data
))
print
(
cates_data
)
exit
()
# cates = cates_data[:1]
cates
=
cates_data
urls
=
[
'https://www.youku.com/category/data?params='
+
'{"type":"'
+
cate
+
'"}&optionRefresh=1&pageNo=1'
for
cate
in
cates
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录