Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
夏至溪檐
dr_py
提交
cc8f7c05
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,发现更多精彩内容 >>
提交
cc8f7c05
编写于
9月 16, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
尝试增加豆瓣
上级
64acf990
变更
8
展开全部
显示空白变更内容
内联
并排
Showing
8 changed file
with
202 addition
and
29 deletion
+202
-29
controllers/cms.py
controllers/cms.py
+13
-3
js/drpy.js
js/drpy.js
+6
-7
libs/pre.js
libs/pre.js
+17
-1
py/drpy一级.js
py/drpy一级.js
+77
-12
py/drpy推荐.js
py/drpy推荐.js
+48
-0
py/豆瓣测试.py
py/豆瓣测试.py
+17
-0
utils/encode.py
utils/encode.py
+23
-5
utils/parser.py
utils/parser.py
+1
-1
未找到文件。
controllers/cms.py
浏览文件 @
cc8f7c05
...
@@ -15,7 +15,7 @@ from utils.log import logger
...
@@ -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
base64Encode
,
baseDecode
,
fetch
,
post
,
request
,
getCryptoJS
,
getPreJs
,
buildUrl
,
getHome
from
utils.encode
import
verifyCode
,
setDetail
,
join
,
urljoin2
,
parseText
from
utils.encode
import
verifyCode
,
setDetail
,
join
,
urljoin2
,
parseText
from
utils.safePython
import
safePython
from
utils.safePython
import
safePython
from
utils.parser
import
runPy
,
runJScode
,
JsObjectWrapper
from
utils.parser
import
runPy
,
runJScode
,
JsObjectWrapper
,
PyJsObject
from
utils.htmlParser
import
jsoup
from
utils.htmlParser
import
jsoup
from
urllib.parse
import
urljoin
,
quote
,
unquote
from
urllib.parse
import
urljoin
,
quote
,
unquote
from
concurrent.futures
import
ThreadPoolExecutor
# 引入线程池
from
concurrent.futures
import
ThreadPoolExecutor
# 引入线程池
...
@@ -40,12 +40,18 @@ def encodeUrl(url):
...
@@ -40,12 +40,18 @@ def encodeUrl(url):
# return base64Encode(url)
# return base64Encode(url)
return
quote
(
url
)
return
quote
(
url
)
def
stringify
(
obj
):
if
isinstance
(
obj
,
PyJsObject
):
# obj = obj.to_dict()
obj
=
parseText
(
str
(
obj
))
return
json
.
dumps
(
obj
,
separators
=
(
','
,
':'
),
ensure_ascii
=
False
)
py_ctx
=
{
py_ctx
=
{
'requests'
:
requests
,
'print'
:
print
,
'base64Encode'
:
base64Encode
,
'baseDecode'
:
baseDecode
,
'requests'
:
requests
,
'print'
:
print
,
'base64Encode'
:
base64Encode
,
'baseDecode'
:
baseDecode
,
'log'
:
logger
.
info
,
'fetch'
:
fetch
,
'post'
:
post
,
'request'
:
request
,
'getCryptoJS'
:
getCryptoJS
,
'log'
:
logger
.
info
,
'fetch'
:
fetch
,
'post'
:
post
,
'request'
:
request
,
'getCryptoJS'
:
getCryptoJS
,
'buildUrl'
:
buildUrl
,
'getHome'
:
getHome
,
'setDetail'
:
setDetail
,
'join'
:
join
,
'urljoin2'
:
urljoin2
,
'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
,
'PC_UA'
:
PC_UA
,
'MOBILE_UA'
:
MOBILE_UA
,
'UC_UA'
:
UC_UA
,
'IOS_UA'
:
IOS_UA
,
'setItem'
:
setItem
,
'getItem'
:
getItem
,
'clearItem'
:
clearItem
'setItem'
:
setItem
,
'getItem'
:
getItem
,
'clearItem'
:
clearItem
,
'stringify'
:
stringify
}
}
# print(getCryptoJS())
# print(getCryptoJS())
...
@@ -780,7 +786,11 @@ class CMS:
...
@@ -780,7 +786,11 @@ class CMS:
print
(
vod
)
print
(
vod
)
return
vod
return
vod
if
not
isinstance
(
p
,
dict
)
and
not
isinstance
(
p
,
str
)
and
not
str
(
p
).
startswith
(
'js:'
):
if
not
p
:
return
vod
if
not
isinstance
(
p
,
dict
)
and
not
isinstance
(
p
,
str
):
return
vod
if
isinstance
(
p
,
str
)
and
not
str
(
p
).
startswith
(
'js:'
):
return
vod
return
vod
jsp
=
jsoup
(
self
.
url
)
jsp
=
jsoup
(
self
.
url
)
...
...
js/drpy.js
浏览文件 @
cc8f7c05
此差异已折叠。
点击以展开。
libs/pre.js
浏览文件 @
cc8f7c05
...
@@ -77,6 +77,21 @@ Object.prototype.myValues=function(obj){
...
@@ -77,6 +77,21 @@ Object.prototype.myValues=function(obj){
}
}
return
res
;
return
res
;
}
}
if
(
typeof
Object
.
prototype
.
values
!=
'
function
'
)
{
Object
.
prototype
.
values
=
function
(
obj
){
if
(
obj
==
null
)
{
throw
new
TypeError
(
"
Cannot convert undefined or null to object
"
);
}
var
res
=
[]
for
(
var
k
in
obj
){
if
(
obj
.
hasOwnProperty
(
k
)){
//需判断是否是本身的属性
res
.
push
(
obj
[
k
]);
}
}
return
res
;
}
}
Array
.
prototype
.
join
=
function
(
emoji
)
{
Array
.
prototype
.
join
=
function
(
emoji
)
{
// emoji = emoji||',';
// emoji = emoji||',';
emoji
=
emoji
||
''
;
emoji
=
emoji
||
''
;
...
@@ -93,6 +108,7 @@ Array.prototype.join = function (emoji) {
...
@@ -93,6 +108,7 @@ Array.prototype.join = function (emoji) {
}
}
return
str
;
return
str
;
};
};
Array
.
prototype
.
append
=
Array
.
prototype
.
push
;
function
是否正版
(
vipUrl
){
function
是否正版
(
vipUrl
){
let
flag
=
new
RegExp
(
'
qq
\
.com|iqiyi
\
.com|youku
\
.com|mgtv
\
.com|bilibili
\
.com|sohu
\
.com|ixigua
\
.com|pptv
\
.com|miguvideo
\
.com|le
\
.com|1905
\
.com|fun
\
.tv
'
);
let
flag
=
new
RegExp
(
'
qq
\
.com|iqiyi
\
.com|youku
\
.com|mgtv
\
.com|bilibili
\
.com|sohu
\
.com|ixigua
\
.com|pptv
\
.com|miguvideo
\
.com|le
\
.com|1905
\
.com|fun
\
.tv
'
);
return
flag
.
test
(
vipUrl
);
return
flag
.
test
(
vipUrl
);
...
@@ -145,7 +161,7 @@ function setResult(d){
...
@@ -145,7 +161,7 @@ function setResult(d){
return
VODS
return
VODS
}
}
function
setResult2
(
res
){
function
setResult2
(
res
){
VODS
=
res
.
list
;
VODS
=
res
.
list
||
[]
;
return
VODS
return
VODS
}
}
function
setHomeResult
(
res
){
function
setHomeResult
(
res
){
...
...
py/drpy一级.js
浏览文件 @
cc8f7c05
js
:
js
:
print
(
input
);
//
print(input);
print
(
MY_CATE
);
//
print(MY_CATE);
print
(
MY_PAGE
);
//
print(MY_PAGE);
print
(
MY_FL
);
//
print(MY_FL);
let
d
=
[];
let
d
=
[];
let
douban
=
input
.
split
(
'
douban=
'
)[
1
].
split
(
'
&
'
)[
0
];
let
douban_api_host
=
'
https://frodo.douban.com/api/v2
'
;
let
douban_api_host
=
'
https://frodo.douban.com/api/v2
'
;
let
miniapp_apikey
=
'
0ac44ae016490db2204ce0a042db2916
'
;
let
miniapp_apikey
=
'
0ac44ae016490db2204ce0a042db2916
'
;
const
count
=
30
;
const
count
=
30
;
...
@@ -30,7 +30,7 @@ function miniapp_request(path, query){
...
@@ -30,7 +30,7 @@ function miniapp_request(path, query){
return
JSON
.
parse
(
html
);
return
JSON
.
parse
(
html
);
}
}
catch
(
e
){
catch
(
e
){
print
(
e
.
message
);
print
(
'
发生了错误:
'
+
e
.
message
);
return
{}
return
{}
}
}
}
}
...
@@ -39,6 +39,7 @@ function cate_filter(d,douban){
...
@@ -39,6 +39,7 @@ function cate_filter(d,douban){
douban
=
douban
||
''
;
douban
=
douban
||
''
;
try
{
try
{
if
(
MY_CATE
===
'
interests
'
){
if
(
MY_CATE
===
'
interests
'
){
if
(
douban
){
let
status
=
MY_FL
.
status
||
"
mark
"
;
let
status
=
MY_FL
.
status
||
"
mark
"
;
let
subtype_tag
=
MY_FL
.
subtype_tag
||
""
;
let
subtype_tag
=
MY_FL
.
subtype_tag
||
""
;
let
year_tag
=
MY_FL
.
year_tag
||
"
全部
"
;
let
year_tag
=
MY_FL
.
year_tag
||
"
全部
"
;
...
@@ -51,20 +52,84 @@ function cate_filter(d,douban){
...
@@ -51,20 +52,84 @@ function cate_filter(d,douban){
"
start
"
:
(
MY_PAGE
-
1
)
*
count
,
"
start
"
:
(
MY_PAGE
-
1
)
*
count
,
"
count
"
:
count
"
count
"
:
count
});
});
print
(
res
);
// print(res);
}
else
{
return
{}
}
}
else
if
(
MY_CATE
===
"
hot_gaia
"
){
}
else
if
(
MY_CATE
===
"
hot_gaia
"
){
let
sort
=
MY_FL
.
sort
||
"
recommend
"
;
let
sort
=
MY_FL
.
sort
||
"
recommend
"
;
let
area
=
MY_FL
.
area
||
"
全部
"
;
let
area
=
MY_FL
.
area
||
"
全部
"
;
let
path
=
'
/movie/
'
+
MY_CATE
;
let
path
=
'
/movie/
'
+
MY_CATE
;
res
=
miniapp_request
(
path
,
{
let
res
=
miniapp_request
(
path
,
{
"
area
"
:
area
,
"
area
"
:
area
,
"
sort
"
:
sort
,
"
sort
"
:
sort
,
"
start
"
:
(
MY_PAGE
-
1
)
*
count
,
"
start
"
:
(
MY_PAGE
-
1
)
*
count
,
"
count
"
:
count
"
count
"
:
count
});
});
print
(
res
);
// print(res);
}
else
if
(
MY_CATE
===
"
tv_hot
"
||
MY_CATE
===
"
show_hot
"
){
let
stype
=
MY_FL
.
type
||
MY_CATE
;
let
path
=
"
/subject_collection/
"
+
stype
+
"
/items
"
let
res
=
miniapp_request
(
path
,
{
"
start
"
:
(
MY_PAGE
-
1
)
*
count
,
"
count
"
:
count
});
// print(res);
}
else
if
(
MY_CATE
.
startsWith
(
"
rank_list
"
)){
let
id
=
MY_CATE
===
"
rank_list_movie
"
?
"
movie_real_time_hotest
"
:
"
tv_real_time_hotest
"
;
id
=
MY_FL
.
榜单
||
id
;
let
path
=
"
/subject_collection/
"
+
id
+
"
/items
"
;
let
res
=
miniapp_request
(
path
,
{
"
start
"
:
(
MY_PAGE
-
1
)
*
count
,
"
count
"
:
count
});
// print(res);
}
else
{
let
path
=
"
/
"
+
MY_CATE
+
"
/recommend
"
;
let
selected_categories
;
if
(
Object
.
keys
(
MY_FL
).
length
>
0
){
let
sort
=
MY_FL
.
sort
||
"
T
"
;
let
tags
=
Object
.
Values
(
MY_FL
).
join
(
'
,
'
);
if
(
MY_CATE
===
"
movie
"
){
selected_categories
=
{
"
类型
"
:
MY_FL
.
类型
||
''
,
"
地区
"
:
MY_FL
.
地区
||
''
}
}
else
{
selected_categories
=
{
"
类型
"
:
MY_FL
.
类型
||
""
,
"
形式
"
:
MY_FL
.
类型
?
MY_FL
.
类型
+
'
地区
'
:
''
,
"
地区
"
:
MY_FL
.
地区
||
""
}
}
}
else
{
let
sort
=
"
T
"
;
let
tags
=
""
;
if
(
MY_CATE
===
"
movie
"
){
selected_categories
=
{
"
类型
"
:
""
,
"
地区
"
:
""
};
}
else
{
selected_categories
=
{
"
类型
"
:
""
,
"
形式
"
:
""
,
"
地区
"
:
""
}
}
}
let
params
=
{
"
tags
"
:
tags
,
"
sort
"
:
sort
,
"
refresh
"
:
0
,
"
selected_categories
"
:
stringify
(
selected_categories
),
"
start
"
:
(
MY_PAGE
-
1
)
*
count
,
"
count
"
:
count
}
// print(params);
let
res
=
miniapp_request
(
path
,
params
)
}
}
let
result
=
{
let
result
=
{
"
page
"
:
MY_PAGE
,
"
page
"
:
MY_PAGE
,
"
pagecount
"
:
Math
.
ceil
(
res
.
total
/
count
),
"
pagecount
"
:
Math
.
ceil
(
res
.
total
/
count
),
...
@@ -72,7 +137,7 @@ function cate_filter(d,douban){
...
@@ -72,7 +137,7 @@ function cate_filter(d,douban){
"
total
"
:
res
.
total
"
total
"
:
res
.
total
}
}
let
items
=
[];
let
items
=
[];
if
(
/rank_list|tv_hot|show_hot/
.
test
(
MY_CATE
))
{
if
(
/
^
rank_list|tv_hot|show_hot/
.
test
(
MY_CATE
))
{
items
=
res
[
'
subject_collection_items
'
]
items
=
res
[
'
subject_collection_items
'
]
}
}
else
if
(
MY_CATE
===
'
interests
'
){
else
if
(
MY_CATE
===
'
interests
'
){
...
@@ -93,7 +158,7 @@ function cate_filter(d,douban){
...
@@ -93,7 +158,7 @@ function cate_filter(d,douban){
let
honor_str
=
honor
.
map
(
function
(
it
){
return
it
.
title
}).
join
(
'
|
'
);
let
honor_str
=
honor
.
map
(
function
(
it
){
return
it
.
title
}).
join
(
'
|
'
);
let
vod_obj
=
{
let
vod_obj
=
{
// "vod_id": f'msearch:{item.get("type", "")}__{item.get("id", "")}',
// "vod_id": f'msearch:{item.get("type", "")}__{item.get("id", "")}',
"
vod_id
"
:
item
.
type
+
'
$
'
+
item
.
id
,
//
"vod_id": item.type+'$'+item.id,
"
vod_name
"
:
title
!==
"
未知电影
"
?
title
:
"
暂不支持展示
"
,
"
vod_name
"
:
title
!==
"
未知电影
"
?
title
:
"
暂不支持展示
"
,
"
vod_pic
"
:
item
.
pic
.
normal
,
"
vod_pic
"
:
item
.
pic
.
normal
,
"
vod_remarks
"
:
rat_str
+
"
"
+
honor_str
"
vod_remarks
"
:
rat_str
+
"
"
+
honor_str
...
...
py/drpy推荐.js
0 → 100644
浏览文件 @
cc8f7c05
js
:
let
d
=
[];
let
douban_api_host
=
'
https://frodo.douban.com/api/v2
'
;
let
miniapp_apikey
=
'
0ac44ae016490db2204ce0a042db2916
'
;
const
count
=
30
;
function
miniapp_request
(
path
,
query
){
try
{
let
url
=
douban_api_host
+
path
;
query
.
apikey
=
miniapp_apikey
;
fetch_params
.
headers
=
oheaders
;
url
=
buildUrl
(
url
,
query
);
let
html
=
fetch
(
url
,
fetch_params
);
return
JSON
.
parse
(
html
);
}
catch
(
e
){
print
(
'
发生了错误:
'
+
e
.
message
);
return
{}
}
}
function
subject_real_time_hotest
(){
try
{
let
res
=
miniapp_request
(
"
/subject_collection/subject_real_time_hotest/items
"
,
{});
let
lists
=
[];
let
arr
=
res
.
subject_collection_items
||
[];
arr
.
forEach
(
function
(
item
){
if
(
item
.
type
===
'
movie
'
||
item
.
type
===
'
tv
'
){
let
rating
=
item
.
rating
?
item
.
rating
.
value
:
"
暂无评分
"
;
let
honnor
=
(
item
.
honor_infos
||
[]).
map
(
function
(
it
){
return
it
.
title
}).
join
(
'
|
'
);
lists
.
append
({
// "vod_id": "",
"
vod_id
"
:
TYPE
+
"
$1
"
,
"
vod_name
"
:
item
.
title
||
""
,
"
vod_pic
"
:
item
.
pic
.
normal
,
"
vod_remarks
"
:
rating
+
"
"
+
honnor
})
}
});
return
lists
}
catch
(
e
)
{
print
(
'
发生了错误:
'
+
e
.
message
);
return
[]
}
}
VODS
=
subject_real_time_hotest
();
print
(
VODS
);
\ No newline at end of file
py/豆瓣测试.py
0 → 100644
浏览文件 @
cc8f7c05
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : 豆瓣测试.py
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Date : 2022/9/16
import
json
selected_categories
=
{
"类型"
:
""
,
"形式"
:
""
,
"地区"
:
""
}
print
(
selected_categories
)
b
=
json
.
dumps
(
selected_categories
,
separators
=
(
','
,
':'
),
ensure_ascii
=
False
)
print
(
b
)
\ No newline at end of file
utils/encode.py
浏览文件 @
cc8f7c05
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
# Date : 2022/8/29
# Date : 2022/8/29
import
base64
import
base64
from
urllib.parse
import
urljoin
from
urllib.parse
import
urljoin
,
quote
,
unquote
from
js2py.base
import
PyJsString
from
js2py.base
import
PyJsString
import
requests
,
warnings
import
requests
,
warnings
# 关闭警告
# 关闭警告
...
@@ -225,19 +225,37 @@ def request(url,obj):
...
@@ -225,19 +225,37 @@ def request(url,obj):
return
base_request
(
url
,
obj
)
return
base_request
(
url
,
obj
)
def
redx
(
text
):
"""
修正js2py交互的字符串自动加前后引号问题
:param text:
:return:
"""
# return text.replace("'", "").replace('"', "")
text
=
str
(
text
)
if
text
.
startswith
(
"'"
)
and
text
.
endswith
(
"'"
):
text
=
text
[
1
:
-
1
]
return
text
def
buildUrl
(
url
,
obj
=
None
):
def
buildUrl
(
url
,
obj
=
None
):
url
=
str
(
url
).
replace
(
"'"
,
""
)
# url = str(url).replace("'", "")
url
=
redx
(
url
)
if
not
obj
:
if
not
obj
:
obj
=
{}
obj
=
{}
new_obj
=
{}
new_obj
=
{}
for
i
in
obj
:
for
i
in
obj
:
new_obj
[
str
(
i
).
replace
(
"'"
,
""
)]
=
str
(
obj
[
i
]).
replace
(
"'"
,
""
)
# new_obj[str(i).replace("'", "")] = str(obj[i]).replace("'", "")
new_obj
[
redx
(
i
)]
=
redx
(
obj
[
i
])
if
str
(
url
).
find
(
'?'
)
<
0
:
if
str
(
url
).
find
(
'?'
)
<
0
:
url
=
str
(
url
)
+
'?'
url
=
str
(
url
)
+
'?'
prs
=
'&'
.
join
([
f
'
{
i
}
=
{
obj
[
i
]
}
'
for
i
in
obj
])
param_list
=
[
f
'
{
i
}
=
{
new_obj
[
i
]
}
'
for
i
in
new_obj
]
# print(param_list)
prs
=
'&'
.
join
(
param_list
)
if
len
(
new_obj
)
>
0
and
not
str
(
url
).
endswith
(
'?'
):
if
len
(
new_obj
)
>
0
and
not
str
(
url
).
endswith
(
'?'
):
url
+=
'&'
url
+=
'&'
url
=
(
url
+
prs
).
replace
(
'"'
,
''
).
replace
(
"'"
,
''
)
# url = (url + prs).replace('"','').replace("'",'')
url
=
url
+
prs
# print(url)
# print(url)
return
url
return
url
...
...
utils/parser.py
浏览文件 @
cc8f7c05
...
@@ -14,7 +14,7 @@ subprocess.Popen = partial(subprocess.Popen, encoding="utf-8") # 固定写法
...
@@ -14,7 +14,7 @@ subprocess.Popen = partial(subprocess.Popen, encoding="utf-8") # 固定写法
# 解决execjs执行js时产生的乱码报错,需要在导入该模块之前,让Popen的encoding参数锁定为utf-8
# 解决execjs执行js时产生的乱码报错,需要在导入该模块之前,让Popen的encoding参数锁定为utf-8
# import execjs
# import execjs
import
js2py
import
js2py
from
js2py.base
import
JsObjectWrapper
,
PyJsString
from
js2py.base
import
JsObjectWrapper
,
PyJsString
,
PyJsObject
# os.environ["EXECJS_RUNTIME"] = "JScript"
# os.environ["EXECJS_RUNTIME"] = "JScript"
# print(execjs.get().name)
# print(execjs.get().name)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录