Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
muziyicn
dr_py
提交
50c2412b
dr_py
项目概览
muziyicn
/
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,发现更多精彩内容 >>
提交
50c2412b
编写于
9月 22, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复自定义配置drivers错误
上级
d476d2d4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
266 addition
and
1 deletion
+266
-1
txt/py/py_alist.py
txt/py/py_alist.py
+261
-0
utils/files.py
utils/files.py
+5
-1
未找到文件。
txt/py/py_alist.py
0 → 100644
浏览文件 @
50c2412b
# coding=utf-8
# !/usr/bin/python
import
sys
sys
.
path
.
append
(
'..'
)
from
base.spider
import
Spider
import
json
import
re
import
difflib
class
Spider
(
Spider
):
# 元类 默认的元类 type
def
getName
(
self
):
return
"Alist"
def
init
(
self
,
extend
=
""
):
print
(
"============{0}============"
.
format
(
extend
))
pass
def
isVideoFormat
(
self
,
url
):
pass
def
manualVideoCheck
(
self
):
pass
def
homeContent
(
self
,
filter
):
result
=
{}
cateManual
=
{
"七米蓝"
:
"https://al.chirmyram.com"
,
"资源小站"
:
"https://960303.xyz"
}
classes
=
[]
for
k
in
cateManual
:
classes
.
append
({
'type_name'
:
k
,
"type_flag"
:
"1"
,
'type_id'
:
cateManual
[
k
]
})
result
[
'class'
]
=
classes
if
(
filter
):
result
[
'filters'
]
=
self
.
config
[
'filter'
]
return
result
def
homeVideoContent
(
self
):
result
=
{
'list'
:
[]
}
return
result
ver
=
''
baseurl
=
''
def
getVersion
(
self
,
gtid
):
param
=
{
"path"
:
'/'
}
if
gtid
.
count
(
'/'
)
==
2
:
gtid
=
gtid
+
'/'
baseurl
=
re
.
findall
(
r
"http.*://.*?/"
,
gtid
)[
0
]
ver
=
self
.
fetch
(
baseurl
+
'api/public/settings'
,
param
)
vjo
=
json
.
loads
(
ver
.
text
)[
'data'
]
if
type
(
vjo
)
is
dict
:
ver
=
3
else
:
ver
=
2
self
.
ver
=
ver
self
.
baseurl
=
baseurl
def
categoryContent
(
self
,
tid
,
pg
,
filter
,
extend
):
result
=
{}
if
self
.
ver
==
''
or
self
.
baseurl
==
''
:
self
.
getVersion
(
tid
)
ver
=
self
.
ver
baseurl
=
self
.
baseurl
if
tid
.
count
(
'/'
)
==
2
:
tid
=
tid
+
'/'
pat
=
tid
.
replace
(
baseurl
,
""
)
param
=
{
"path"
:
'/'
+
pat
}
if
ver
==
2
:
rsp
=
self
.
postJson
(
baseurl
+
'api/public/path'
,
param
)
jo
=
json
.
loads
(
rsp
.
text
)
vodList
=
jo
[
'data'
][
'files'
]
elif
ver
==
3
:
rsp
=
self
.
postJson
(
baseurl
+
'api/fs/list'
,
param
)
jo
=
json
.
loads
(
rsp
.
text
)
vodList
=
jo
[
'data'
][
'content'
]
videos
=
[]
for
vod
in
vodList
:
if
ver
==
2
:
img
=
vod
[
'thumbnail'
]
elif
ver
==
3
:
img
=
vod
[
'thumb'
]
if
len
(
img
)
==
0
:
if
vod
[
'type'
]
==
1
:
img
=
"http://img1.3png.com/281e284a670865a71d91515866552b5f172b.png"
if
pat
!=
''
:
aid
=
pat
+
'/'
else
:
aid
=
pat
if
vod
[
'type'
]
==
1
:
tag
=
"folder"
remark
=
"文件夹"
else
:
vname
=
re
.
findall
(
r
"(.*)\."
,
vod
[
'name'
])[
0
]
vtpye
=
vod
[
'name'
].
replace
(
vname
,
""
)
if
vtpye
==
'.mkv'
or
vtpye
==
'.mp4'
:
vstr
=
re
.
findall
(
r
"\'name\': \'(.*?)\'"
,
str
(
vodList
))
if
len
(
vstr
)
==
2
:
suball
=
vstr
else
:
suball
=
difflib
.
get_close_matches
(
vname
,
vstr
,
len
(
vodList
),
cutoff
=
0.8
)
for
sub
in
suball
:
stype1
=
sub
.
endswith
(
".ass"
)
stype2
=
sub
.
endswith
(
".srt"
)
if
stype1
is
True
or
stype2
is
True
:
subt
=
'@@@'
+
aid
+
sub
size
=
vod
[
'size'
]
if
size
>
1024
*
1024
*
1024
*
1024.0
:
fs
=
"TB"
sz
=
round
(
size
/
(
1024
*
1024
*
1024
*
1024.0
),
2
)
elif
size
>
1024
*
1024
*
1024.0
:
fs
=
"GB"
sz
=
round
(
size
/
(
1024
*
1024
*
1024.0
),
2
)
elif
size
>
1024
*
1024.0
:
fs
=
"MB"
sz
=
round
(
size
/
(
1024
*
1024.0
),
2
)
elif
size
>
1024.0
:
fs
=
"KB"
sz
=
round
(
size
/
(
1024.0
),
2
)
tag
=
"file"
remark
=
str
(
sz
)
+
fs
ifsubt
=
'subt'
in
locals
().
keys
()
if
ifsubt
is
False
:
aid
=
baseurl
+
aid
+
vod
[
'name'
]
else
:
aid
=
baseurl
+
aid
+
vod
[
'name'
]
+
subt
videos
.
append
({
"vod_id"
:
aid
,
"vod_name"
:
vod
[
'name'
],
"vod_pic"
:
img
,
"vod_tag"
:
tag
,
"vod_remarks"
:
remark
})
result
[
'list'
]
=
videos
result
[
'page'
]
=
1
result
[
'pagecount'
]
=
1
result
[
'limit'
]
=
999
result
[
'total'
]
=
999999
return
result
def
detailContent
(
self
,
array
):
id
=
array
[
0
]
ifsub
=
'@@@'
in
id
if
ifsub
is
True
:
ids
=
id
.
split
(
'@@@'
)
vurl
=
ids
[
0
]
else
:
vurl
=
id
if
self
.
ver
==
''
or
self
.
baseurl
==
''
:
self
.
getVersion
(
vurl
)
ver
=
self
.
ver
baseurl
=
self
.
baseurl
if
ifsub
is
True
:
ids
=
id
.
split
(
'@@@'
)
fileName
=
ids
[
0
].
replace
(
baseurl
,
""
)
else
:
fileName
=
id
.
replace
(
baseurl
,
""
)
param
=
{
"path"
:
'/'
+
fileName
,
"password"
:
""
,
"page_num"
:
1
,
"page_size"
:
100
}
if
ver
==
2
:
rsp
=
self
.
postJson
(
baseurl
+
'api/public/path'
,
param
)
jo
=
json
.
loads
(
rsp
.
text
)
vodList
=
jo
[
'data'
][
'files'
][
0
]
if
ifsub
is
True
:
sparam
=
{
"path"
:
'/'
+
ids
[
1
],
"password"
:
""
,
"page_num"
:
1
,
"page_size"
:
100
}
srsp
=
self
.
postJson
(
baseurl
+
'api/public/path'
,
sparam
)
sjo
=
json
.
loads
(
srsp
.
text
)
sList
=
sjo
[
'data'
][
'files'
][
0
]
sub
=
'@@@'
+
sList
[
'url'
]
elif
ver
==
3
:
rsp
=
self
.
postJson
(
baseurl
+
'api/fs/get'
,
param
)
jo
=
json
.
loads
(
rsp
.
text
)
vodList
=
jo
[
'data'
]
if
ifsub
is
True
:
sparam
=
{
"path"
:
'/'
+
ids
[
1
],
"password"
:
""
,
"page_num"
:
1
,
"page_size"
:
100
}
srsp
=
self
.
postJson
(
baseurl
+
'api/fs/get'
,
sparam
)
sjo
=
json
.
loads
(
srsp
.
text
)
sList
=
sjo
[
'data'
]
sub
=
'@@@'
+
sList
[
'raw_url'
]
if
ver
==
2
:
url
=
vodList
[
'url'
]
pic
=
vodList
[
'thumbnail'
]
elif
ver
==
3
:
url
=
vodList
[
'raw_url'
]
pic
=
vodList
[
'thumb'
]
if
ifsub
is
True
:
purl
=
url
+
sub
else
:
purl
=
url
vId
=
fileName
name
=
vodList
[
'name'
]
tag
=
"file"
if
vodList
[
'type'
]
==
1
:
tag
=
"folder"
vod
=
{
"vod_id"
:
vId
,
"vod_name"
:
name
,
"vod_pic"
:
pic
,
"vod_tag"
:
tag
,
"vod_play_from"
:
"播放"
,
"vod_play_url"
:
name
+
'$'
+
purl
}
result
=
{
'list'
:
[
vod
]
}
return
result
def
searchContent
(
self
,
key
,
quick
):
result
=
{
'list'
:
[]
}
return
result
def
playerContent
(
self
,
flag
,
id
,
vipFlags
):
result
=
{}
ifsub
=
'@@@'
in
id
if
ifsub
is
True
:
ids
=
id
.
split
(
'@@@'
)
url
=
ids
[
0
]
result
[
'subt'
]
=
ids
[
1
]
else
:
url
=
id
result
[
"parse"
]
=
0
result
[
"playUrl"
]
=
''
result
[
"url"
]
=
url
return
result
config
=
{
"player"
:
{},
"filter"
:
{}
}
header
=
{}
def
localProxy
(
self
,
param
):
return
[
200
,
"video/MP2T"
,
action
,
""
]
\ No newline at end of file
utils/files.py
浏览文件 @
50c2412b
...
@@ -87,7 +87,11 @@ def custom_merge(original:dict,custom:dict):
...
@@ -87,7 +87,11 @@ def custom_merge(original:dict,custom:dict):
original
.
update
(
updateObj
)
original
.
update
(
updateObj
)
for
key
in
extend_obj
.
keys
():
for
key
in
extend_obj
.
keys
():
original
[
key
].
extend
(
extend_obj
[
key
])
if
original
.
get
(
'key'
)
and
isinstance
(
original
[
key
],
list
):
original
[
key
].
extend
(
extend_obj
[
key
])
else
:
original
[
key
]
=
extend_obj
[
key
]
return
original
return
original
def
getCustonDict
(
host
,
ali_token
=
''
):
def
getCustonDict
(
host
,
ali_token
=
''
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录