Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
落寞的温暖
dr_py
提交
51972a35
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,发现更多精彩内容 >>
提交
51972a35
编写于
11月 27, 2022
作者:
H
hjdhnx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新了几个bl规则
上级
67534033
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
53 addition
and
41 deletion
+53
-41
txt/lives/达人专用源.txt
txt/lives/达人专用源.txt
+0
-0
txt/py/py_bilibili.py
txt/py/py_bilibili.py
+31
-26
txt/py/py_bilimy.py
txt/py/py_bilimy.py
+6
-5
txt/py/py_biliys.py
txt/py/py_biliys.py
+10
-5
txt/py/py_bilizb.py
txt/py/py_bilizb.py
+6
-5
未找到文件。
txt/lives/达人专用源.txt
0 → 100644
浏览文件 @
51972a35
此差异已折叠。
点击以展开。
txt/py/py_bilibili.py
浏览文件 @
51972a35
...
@@ -44,7 +44,6 @@ class Spider(Spider):
...
@@ -44,7 +44,6 @@ class Spider(Spider):
"每周必看"
:
"每周必看"
,
"每周必看"
:
"每周必看"
,
"入站必刷"
:
"入站必刷"
,
"入站必刷"
:
"入站必刷"
,
"频道"
:
"频道"
,
"频道"
:
"频道"
,
# ————————以下可自定义关键字,结果以搜索方式展示————————
}
}
classes
=
[]
classes
=
[]
for
k
in
cateManual
:
for
k
in
cateManual
:
...
@@ -57,13 +56,14 @@ class Spider(Spider):
...
@@ -57,13 +56,14 @@ class Spider(Spider):
result
[
'filters'
]
=
self
.
config
[
'filter'
]
result
[
'filters'
]
=
self
.
config
[
'filter'
]
return
result
return
result
# 用户cookies
cookies
=
''
cookies
=
''
userid
=
''
userid
=
''
csrf
=
''
def
getCookie
(
self
):
def
getCookie
(
self
):
import
requests
import
http.cookies
import
http.cookies
# ----
----↓↓↓↓↓↓↓------在下方双引号内填写-------↓↓↓↓↓↓↓----
----
# ----
↓↓↓↓↓↓↓----在下方raw_cookie_line后的双引号内填写----↓↓↓↓↓↓↓
----
raw_cookie_line
=
""
raw_cookie_line
=
""
simple_cookie
=
http
.
cookies
.
SimpleCookie
(
raw_cookie_line
)
simple_cookie
=
http
.
cookies
.
SimpleCookie
(
raw_cookie_line
)
cookie_jar
=
requests
.
cookies
.
RequestsCookieJar
()
cookie_jar
=
requests
.
cookies
.
RequestsCookieJar
()
...
@@ -75,6 +75,7 @@ class Spider(Spider):
...
@@ -75,6 +75,7 @@ class Spider(Spider):
if
res
[
"code"
]
==
0
:
if
res
[
"code"
]
==
0
:
self
.
cookies
=
rsp
.
cookies
self
.
cookies
=
rsp
.
cookies
self
.
userid
=
res
[
"data"
].
get
(
'mid'
)
self
.
userid
=
res
[
"data"
].
get
(
'mid'
)
self
.
csrf
=
rsp
.
cookies
[
'bili_jct'
]
return
cookie_jar
return
cookie_jar
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -106,6 +107,10 @@ class Spider(Spider):
...
@@ -106,6 +107,10 @@ class Spider(Spider):
def
manualVideoCheck
(
self
):
def
manualVideoCheck
(
self
):
pass
pass
def
post_history
(
self
,
aid
,
cid
):
url
=
'http://api.bilibili.com/x/v2/history/report?aid={0}&cid={1}&csrf={2}'
.
format
(
aid
,
cid
,
self
.
csrf
)
requests
.
post
(
url
=
url
,
cookies
=
self
.
cookies
)
# 将超过10000的数字换成成以万和亿为单位
# 将超过10000的数字换成成以万和亿为单位
def
zh
(
self
,
num
):
def
zh
(
self
,
num
):
if
int
(
num
)
>=
100000000
:
if
int
(
num
)
>=
100000000
:
...
@@ -159,13 +164,12 @@ class Spider(Spider):
...
@@ -159,13 +164,12 @@ class Spider(Spider):
jo
=
json
.
loads
(
content
)
jo
=
json
.
loads
(
content
)
if
jo
[
'code'
]
==
0
:
if
jo
[
'code'
]
==
0
:
videos
=
[]
videos
=
[]
vodList
=
jo
[
'data'
][
'list'
]
vodList
=
jo
[
'data'
][
'list'
]
[
0
:
50
]
for
vod
in
vodList
:
for
vod
in
vodList
:
aid
=
str
(
vod
[
'aid'
]).
strip
()
aid
=
str
(
vod
[
'aid'
]).
strip
()
title
=
vod
[
'title'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
title
=
vod
[
'title'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
img
=
vod
[
'pic'
].
strip
()
img
=
vod
[
'pic'
].
strip
()
# view = "▶" + self.zh(vod['stat']['view']) + ' 🕓' # 标签上加入播放量
remark
=
"观看:"
+
self
.
zh
(
vod
[
'stat'
][
'view'
])
+
" "
+
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
remark
=
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
videos
.
append
({
videos
.
append
({
"vod_id"
:
aid
,
"vod_id"
:
aid
,
"vod_name"
:
title
,
"vod_name"
:
title
,
...
@@ -218,18 +222,18 @@ class Spider(Spider):
...
@@ -218,18 +222,18 @@ class Spider(Spider):
def
get_hot
(
self
,
pg
):
def
get_hot
(
self
,
pg
):
result
=
{}
result
=
{}
url
=
'https://api.bilibili.com/x/web-interface/popular?ps=
2
0&pn={0}'
.
format
(
pg
)
url
=
'https://api.bilibili.com/x/web-interface/popular?ps=
1
0&pn={0}'
.
format
(
pg
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
content
=
rsp
.
text
content
=
rsp
.
text
jo
=
json
.
loads
(
content
)
jo
=
json
.
loads
(
content
)
if
jo
[
'code'
]
==
0
:
if
jo
[
'code'
]
==
0
:
videos
=
[]
videos
=
[]
vodList
=
jo
[
'data'
][
'list'
]
vodList
=
jo
[
'data'
][
'list'
]
[
0
:
50
]
for
vod
in
vodList
:
for
vod
in
vodList
:
aid
=
str
(
vod
[
'aid'
]).
strip
()
aid
=
str
(
vod
[
'aid'
]).
strip
()
title
=
vod
[
'title'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
title
=
vod
[
'title'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
img
=
vod
[
'pic'
].
strip
()
img
=
vod
[
'pic'
].
strip
()
remark
=
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
remark
=
"观看:"
+
self
.
zh
(
vod
[
'stat'
][
'view'
])
+
" "
+
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
videos
.
append
({
videos
.
append
({
"vod_id"
:
aid
,
"vod_id"
:
aid
,
"vod_name"
:
title
,
"vod_name"
:
title
,
...
@@ -245,7 +249,7 @@ class Spider(Spider):
...
@@ -245,7 +249,7 @@ class Spider(Spider):
def
get_rcmd
(
self
,
pg
):
def
get_rcmd
(
self
,
pg
):
result
=
{}
result
=
{}
url
=
'https://api.bilibili.com/x/web-interface/index/top/feed/rcmd?y_num={0}&fresh_type=3&feed_version=SEO_VIDEO&fresh_idx_1h=1&fetch_row=1&fresh_idx=1&brush=0&homepage_ver=1&ps=
2
0'
.
format
(
url
=
'https://api.bilibili.com/x/web-interface/index/top/feed/rcmd?y_num={0}&fresh_type=3&feed_version=SEO_VIDEO&fresh_idx_1h=1&fetch_row=1&fresh_idx=1&brush=0&homepage_ver=1&ps=
1
0'
.
format
(
pg
)
pg
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
content
=
rsp
.
text
content
=
rsp
.
text
...
@@ -258,7 +262,7 @@ class Spider(Spider):
...
@@ -258,7 +262,7 @@ class Spider(Spider):
aid
=
str
(
vod
[
'id'
]).
strip
()
aid
=
str
(
vod
[
'id'
]).
strip
()
title
=
vod
[
'title'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
title
=
vod
[
'title'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
img
=
vod
[
'pic'
].
strip
()
img
=
vod
[
'pic'
].
strip
()
remark
=
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
remark
=
"观看:"
+
self
.
zh
(
vod
[
'stat'
][
'view'
])
+
" "
+
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
videos
.
append
({
videos
.
append
({
"vod_id"
:
aid
,
"vod_id"
:
aid
,
"vod_name"
:
title
,
"vod_name"
:
title
,
...
@@ -280,12 +284,12 @@ class Spider(Spider):
...
@@ -280,12 +284,12 @@ class Spider(Spider):
jo
=
json
.
loads
(
content
)
jo
=
json
.
loads
(
content
)
if
jo
[
'code'
]
==
0
:
if
jo
[
'code'
]
==
0
:
videos
=
[]
videos
=
[]
vodList
=
jo
[
'data'
][
'list'
]
vodList
=
jo
[
'data'
][
'list'
]
[
0
:
50
]
for
vod
in
vodList
:
for
vod
in
vodList
:
aid
=
str
(
vod
[
'aid'
]).
strip
()
aid
=
str
(
vod
[
'aid'
]).
strip
()
title
=
vod
[
'title'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
title
=
vod
[
'title'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
img
=
vod
[
'pic'
].
strip
()
img
=
vod
[
'pic'
].
strip
()
remark
=
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
remark
=
"观看:"
+
self
.
zh
(
vod
[
'stat'
][
'view'
])
+
" "
+
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
videos
.
append
({
videos
.
append
({
"vod_id"
:
aid
,
"vod_id"
:
aid
,
"vod_name"
:
title
,
"vod_name"
:
title
,
...
@@ -301,7 +305,7 @@ class Spider(Spider):
...
@@ -301,7 +305,7 @@ class Spider(Spider):
def
get_history
(
self
,
pg
):
def
get_history
(
self
,
pg
):
result
=
{}
result
=
{}
url
=
'https://api.bilibili.com/x/v2/history?pn=%s'
%
pg
url
=
'https://api.bilibili.com/x/v2/history?pn=%s
&ps=10
'
%
pg
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
content
=
rsp
.
text
content
=
rsp
.
text
jo
=
json
.
loads
(
content
)
# 解析api接口,转化成json数据对象
jo
=
json
.
loads
(
content
)
# 解析api接口,转化成json数据对象
...
@@ -355,7 +359,7 @@ class Spider(Spider):
...
@@ -355,7 +359,7 @@ class Spider(Spider):
def
get_fav_detail
(
self
,
pg
,
mlid
,
order
):
def
get_fav_detail
(
self
,
pg
,
mlid
,
order
):
result
=
{}
result
=
{}
url
=
'https://api.bilibili.com/x/v3/fav/resource/list?media_id=%s&order=%s&pn=%s&ps=
2
0&platform=web&type=0'
%
(
mlid
,
order
,
pg
)
url
=
'https://api.bilibili.com/x/v3/fav/resource/list?media_id=%s&order=%s&pn=%s&ps=
1
0&platform=web&type=0'
%
(
mlid
,
order
,
pg
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
content
=
rsp
.
text
content
=
rsp
.
text
jo
=
json
.
loads
(
content
)
jo
=
json
.
loads
(
content
)
...
@@ -371,7 +375,7 @@ class Spider(Spider):
...
@@ -371,7 +375,7 @@ class Spider(Spider):
title
=
vod
[
'title'
].
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
).
replace
(
"""
,
title
=
vod
[
'title'
].
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
).
replace
(
"""
,
'"'
)
'"'
)
img
=
vod
[
'cover'
].
strip
()
img
=
vod
[
'cover'
].
strip
()
remark
=
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
remark
=
"观看:"
+
self
.
zh
(
vod
[
'cnt_info'
][
'play'
])
+
" "
+
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
videos
.
append
({
videos
.
append
({
"vod_id"
:
aid
,
"vod_id"
:
aid
,
"vod_name"
:
title
,
"vod_name"
:
title
,
...
@@ -394,12 +398,12 @@ class Spider(Spider):
...
@@ -394,12 +398,12 @@ class Spider(Spider):
jo
=
json
.
loads
(
content
)
jo
=
json
.
loads
(
content
)
if
jo
[
'code'
]
==
0
:
if
jo
[
'code'
]
==
0
:
videos
=
[]
videos
=
[]
vodList
=
jo
[
'data'
][
'list'
]
vodList
=
jo
[
'data'
][
'list'
]
[
0
:
50
]
for
vod
in
vodList
:
for
vod
in
vodList
:
aid
=
str
(
vod
[
'aid'
]).
strip
()
aid
=
str
(
vod
[
'aid'
]).
strip
()
title
=
vod
[
'title'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
title
=
vod
[
'title'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
img
=
vod
[
'pic'
].
strip
()
img
=
vod
[
'pic'
].
strip
()
remark
=
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
remark
=
"观看:"
+
self
.
zh
(
vod
[
'stat'
][
'view'
])
+
" "
+
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
videos
.
append
({
videos
.
append
({
"vod_id"
:
aid
,
"vod_id"
:
aid
,
"vod_name"
:
title
,
"vod_name"
:
title
,
...
@@ -431,7 +435,7 @@ class Spider(Spider):
...
@@ -431,7 +435,7 @@ class Spider(Spider):
aid
=
str
(
vod
[
'aid'
]).
strip
()
aid
=
str
(
vod
[
'aid'
]).
strip
()
title
=
vod
[
'title'
].
strip
()
title
=
vod
[
'title'
].
strip
()
img
=
vod
[
'pic'
].
strip
()
img
=
vod
[
'pic'
].
strip
()
remark
=
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
remark
=
"观看:"
+
self
.
zh
(
vod
[
'stat'
][
'view'
])
+
" "
+
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
videos
.
append
({
videos
.
append
({
"vod_id"
:
aid
,
"vod_id"
:
aid
,
"vod_name"
:
title
,
"vod_name"
:
title
,
...
@@ -458,7 +462,7 @@ class Spider(Spider):
...
@@ -458,7 +462,7 @@ class Spider(Spider):
aid
=
str
(
vod
[
'aid'
]).
strip
()
aid
=
str
(
vod
[
'aid'
]).
strip
()
title
=
vod
[
'title'
].
strip
()
title
=
vod
[
'title'
].
strip
()
img
=
vod
[
'pic'
].
strip
()
img
=
vod
[
'pic'
].
strip
()
remark
=
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
remark
=
"观看:"
+
self
.
zh
(
vod
[
'stat'
][
'view'
])
+
" "
+
str
(
self
.
second_to_time
(
vod
[
'duration'
])).
strip
()
videos
.
append
({
videos
.
append
({
"vod_id"
:
aid
,
"vod_id"
:
aid
,
"vod_name"
:
title
,
"vod_name"
:
title
,
...
@@ -512,7 +516,7 @@ class Spider(Spider):
...
@@ -512,7 +516,7 @@ class Spider(Spider):
def
get_channel
(
self
,
pg
,
cid
,
extend
,
order
,
duration_diff
):
def
get_channel
(
self
,
pg
,
cid
,
extend
,
order
,
duration_diff
):
result
=
{}
result
=
{}
url
=
'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&page={1}&duration={2}&order={3}'
.
format
(
url
=
'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&page={1}&duration={2}&order={3}
&page_size=10
'
.
format
(
cid
,
pg
,
duration_diff
,
order
)
cid
,
pg
,
duration_diff
,
order
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
content
=
rsp
.
text
content
=
rsp
.
text
...
@@ -524,7 +528,7 @@ class Spider(Spider):
...
@@ -524,7 +528,7 @@ class Spider(Spider):
aid
=
str
(
vod
[
'aid'
]).
strip
()
aid
=
str
(
vod
[
'aid'
]).
strip
()
title
=
vod
[
'title'
].
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
).
replace
(
"""
,
'"'
)
title
=
vod
[
'title'
].
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
).
replace
(
"""
,
'"'
)
img
=
'https:'
+
vod
[
'pic'
].
strip
()
img
=
'https:'
+
vod
[
'pic'
].
strip
()
remark
=
str
(
self
.
second_to_time
(
self
.
str2sec
(
vod
[
'duration'
]))).
strip
()
remark
=
"观看:"
+
self
.
zh
(
vod
[
'play'
])
+
" "
+
str
(
self
.
second_to_time
(
self
.
str2sec
(
vod
[
'duration'
]))).
strip
()
videos
.
append
({
videos
.
append
({
"vod_id"
:
aid
,
"vod_id"
:
aid
,
"vod_name"
:
title
,
"vod_name"
:
title
,
...
@@ -585,7 +589,7 @@ class Spider(Spider):
...
@@ -585,7 +589,7 @@ class Spider(Spider):
order
=
'totalrank'
order
=
'totalrank'
if
'order'
in
extend
:
if
'order'
in
extend
:
order
=
extend
[
'order'
]
order
=
extend
[
'order'
]
url
=
'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&page={1}&duration={2}&order={3}'
.
format
(
url
=
'https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword={0}&page={1}&duration={2}&order={3}
&page_size=10
'
.
format
(
tid
,
pg
,
duration_diff
,
order
)
tid
,
pg
,
duration_diff
,
order
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
content
=
rsp
.
text
content
=
rsp
.
text
...
@@ -599,7 +603,7 @@ class Spider(Spider):
...
@@ -599,7 +603,7 @@ class Spider(Spider):
'"'
)
'"'
)
img
=
'https:'
+
vod
[
'pic'
].
strip
()
img
=
'https:'
+
vod
[
'pic'
].
strip
()
# remark = str(vod['duration']).strip()
# remark = str(vod['duration']).strip()
remark
=
str
(
self
.
second_to_time
(
self
.
str2sec
(
vod
[
'duration'
]))).
strip
()
remark
=
"观看:"
+
self
.
zh
(
vod
[
'play'
])
+
" "
+
str
(
self
.
second_to_time
(
self
.
str2sec
(
vod
[
'duration'
]))).
strip
()
videos
.
append
({
videos
.
append
({
"vod_id"
:
aid
,
"vod_id"
:
aid
,
"vod_name"
:
title
,
"vod_name"
:
title
,
...
@@ -634,7 +638,7 @@ class Spider(Spider):
...
@@ -634,7 +638,7 @@ class Spider(Spider):
remark
=
str
(
jo
[
'duration'
]).
strip
()
remark
=
str
(
jo
[
'duration'
]).
strip
()
vod
=
{
vod
=
{
"vod_id"
:
aid
,
"vod_id"
:
aid
,
"vod_name"
:
'['
+
jo
[
'owner'
][
'name'
]
+
"]"
+
title
,
"vod_name"
:
'['
+
jo
[
'owner'
][
'name'
]
+
"]"
+
title
,
"vod_pic"
:
pic
,
"vod_pic"
:
pic
,
"type_name"
:
typeName
,
"type_name"
:
typeName
,
"vod_year"
:
date
,
"vod_year"
:
date
,
...
@@ -676,7 +680,7 @@ class Spider(Spider):
...
@@ -676,7 +680,7 @@ class Spider(Spider):
vodList
=
jo
[
'data'
][
'result'
]
vodList
=
jo
[
'data'
][
'result'
]
for
vod
in
vodList
:
for
vod
in
vodList
:
aid
=
str
(
vod
[
'aid'
]).
strip
()
aid
=
str
(
vod
[
'aid'
]).
strip
()
title
=
'['
+
key
+
']'
+
vod
[
'title'
].
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
).
replace
(
"""
,
'"'
)
title
=
vod
[
'title'
].
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
).
replace
(
"""
,
'"'
)
+
'['
+
key
+
']'
img
=
'https:'
+
vod
[
'pic'
].
strip
()
img
=
'https:'
+
vod
[
'pic'
].
strip
()
remark
=
str
(
self
.
second_to_time
(
self
.
str2sec
(
vod
[
'duration'
]))).
strip
()
remark
=
str
(
self
.
second_to_time
(
self
.
str2sec
(
vod
[
'duration'
]))).
strip
()
videos
.
append
({
videos
.
append
({
...
@@ -698,6 +702,7 @@ class Spider(Spider):
...
@@ -698,6 +702,7 @@ class Spider(Spider):
url
=
'https://api.bilibili.com:443/x/player/playurl?avid={0}&cid={1}&qn=116'
.
format
(
ids
[
0
],
ids
[
1
])
url
=
'https://api.bilibili.com:443/x/player/playurl?avid={0}&cid={1}&qn=116'
.
format
(
ids
[
0
],
ids
[
1
])
if
len
(
self
.
cookies
)
<=
0
:
if
len
(
self
.
cookies
)
<=
0
:
self
.
getCookie
()
self
.
getCookie
()
self
.
post_history
(
ids
[
0
],
ids
[
1
])
# 回传播放历史记录
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
jRoot
=
json
.
loads
(
rsp
.
text
)
jRoot
=
json
.
loads
(
rsp
.
text
)
jo
=
jRoot
[
'data'
]
jo
=
jRoot
[
'data'
]
...
...
txt/py/py_bilimy.py
浏览文件 @
51972a35
...
@@ -42,7 +42,8 @@ class Spider(Spider):
...
@@ -42,7 +42,8 @@ class Spider(Spider):
"猫咪"
:
"喵星人"
,
"猫咪"
:
"喵星人"
,
"请自定义关键词"
:
"美女"
,
"请自定义关键词"
:
"美女"
,
# ————————以下可自定义UP主,冒号后须填写UID————————
# ————————以下可自定义UP主,冒号后须填写UID————————
"虫哥说电影"
:
"29296192"
,
"徐云流浪中国"
:
"697166795"
,
# "虫哥说电影": "29296192",
}
}
classes
=
[]
classes
=
[]
...
@@ -83,8 +84,8 @@ class Spider(Spider):
...
@@ -83,8 +84,8 @@ class Spider(Spider):
def
get_up_videos
(
self
,
tid
,
pg
):
def
get_up_videos
(
self
,
tid
,
pg
):
result
=
{}
result
=
{}
url
=
'https://api.bilibili.com/x/space/arc/search?mid={0}&pn={1}&ps=
2
0'
.
format
(
tid
,
pg
)
url
=
'https://api.bilibili.com/x/space/arc/search?mid={0}&pn={1}&ps=
1
0'
.
format
(
tid
,
pg
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
rsp
=
self
.
fetch
(
url
,
headers
=
self
.
header
,
cookies
=
self
.
cookies
)
content
=
rsp
.
text
content
=
rsp
.
text
jo
=
json
.
loads
(
content
)
jo
=
json
.
loads
(
content
)
if
jo
[
'code'
]
==
0
:
if
jo
[
'code'
]
==
0
:
...
@@ -94,7 +95,7 @@ class Spider(Spider):
...
@@ -94,7 +95,7 @@ class Spider(Spider):
aid
=
str
(
vod
[
'aid'
]).
strip
()
aid
=
str
(
vod
[
'aid'
]).
strip
()
title
=
vod
[
'title'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
title
=
vod
[
'title'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
img
=
vod
[
'pic'
].
strip
()
img
=
vod
[
'pic'
].
strip
()
remark
=
str
(
vod
[
'length'
]).
strip
()
remark
=
"观看:"
+
self
.
bilibili
.
zh
(
vod
[
'play'
])
+
" "
+
str
(
vod
[
'length'
]).
strip
()
videos
.
append
({
videos
.
append
({
"vod_id"
:
aid
,
"vod_id"
:
aid
,
"vod_name"
:
title
,
"vod_name"
:
title
,
...
@@ -176,7 +177,7 @@ class Spider(Spider):
...
@@ -176,7 +177,7 @@ class Spider(Spider):
if
len
(
self
.
cookies
)
<=
0
:
if
len
(
self
.
cookies
)
<=
0
:
self
.
getCookie
()
self
.
getCookie
()
url
=
'https://api.bilibili.com/x/web-interface/search/type?search_type=bili_user&keyword={0}'
.
format
(
key
)
url
=
'https://api.bilibili.com/x/web-interface/search/type?search_type=bili_user&keyword={0}'
.
format
(
key
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
rsp
=
self
.
fetch
(
url
,
headers
=
self
.
header
,
cookies
=
self
.
cookies
)
content
=
rsp
.
text
content
=
rsp
.
text
jo
=
json
.
loads
(
content
)
jo
=
json
.
loads
(
content
)
videos
=
[]
videos
=
[]
...
...
txt/py/py_biliys.py
浏览文件 @
51972a35
...
@@ -29,6 +29,7 @@ class Spider(Spider):
...
@@ -29,6 +29,7 @@ class Spider(Spider):
def
manualVideoCheck
(
self
):
def
manualVideoCheck
(
self
):
pass
pass
# 主页
def
homeContent
(
self
,
filter
):
def
homeContent
(
self
,
filter
):
result
=
{}
result
=
{}
cateManual
=
{
cateManual
=
{
...
@@ -42,6 +43,9 @@ class Spider(Spider):
...
@@ -42,6 +43,9 @@ class Spider(Spider):
"追番"
:
"追番"
,
"追番"
:
"追番"
,
"追剧"
:
"追剧"
,
"追剧"
:
"追剧"
,
"时间表"
:
"时间表"
,
"时间表"
:
"时间表"
,
# ————————以下可自定义关键字,结果以影视类搜索展示————————
# "喜羊羊": "喜羊羊"
}
}
classes
=
[]
classes
=
[]
for
k
in
cateManual
:
for
k
in
cateManual
:
...
@@ -170,7 +174,7 @@ class Spider(Spider):
...
@@ -170,7 +174,7 @@ class Spider(Spider):
result
=
{}
result
=
{}
if
len
(
self
.
cookies
)
<=
0
:
if
len
(
self
.
cookies
)
<=
0
:
self
.
getCookie
()
self
.
getCookie
()
url
=
'https://api.bilibili.com/pgc/season/index/result?order={2}&pagesize=
2
0&type=1&season_type={0}&page={1}&season_status={3}'
.
format
(
tid
,
pg
,
order
,
season_status
)
url
=
'https://api.bilibili.com/pgc/season/index/result?order={2}&pagesize=
1
0&type=1&season_type={0}&page={1}&season_status={3}'
.
format
(
tid
,
pg
,
order
,
season_status
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
content
=
rsp
.
text
content
=
rsp
.
text
jo
=
json
.
loads
(
content
)
jo
=
json
.
loads
(
content
)
...
@@ -246,7 +250,7 @@ class Spider(Spider):
...
@@ -246,7 +250,7 @@ class Spider(Spider):
elif
tid
in
{
"2"
,
"3"
,
"4"
,
"5"
,
"7"
}:
elif
tid
in
{
"2"
,
"3"
,
"4"
,
"5"
,
"7"
}:
return
self
.
get_rank2
(
tid
=
tid
)
return
self
.
get_rank2
(
tid
=
tid
)
elif
tid
==
"全部"
:
elif
tid
==
"全部"
:
tid
=
'1'
tid
=
'1'
# 全部界面默认展示最多播放的番剧
order
=
'2'
order
=
'2'
season_status
=
'-1'
season_status
=
'-1'
if
'tid'
in
extend
:
if
'tid'
in
extend
:
...
@@ -309,10 +313,10 @@ class Spider(Spider):
...
@@ -309,10 +313,10 @@ class Spider(Spider):
ja
=
jo
[
'episodes'
]
ja
=
jo
[
'episodes'
]
playUrl
=
''
playUrl
=
''
for
tmpJo
in
ja
:
for
tmpJo
in
ja
:
eid
=
tmpJo
[
'
id'
]
aid
=
tmpJo
[
'a
id'
]
cid
=
tmpJo
[
'cid'
]
cid
=
tmpJo
[
'cid'
]
part
=
tmpJo
[
'title'
].
replace
(
"#"
,
"-"
)
part
=
tmpJo
[
'title'
].
replace
(
"#"
,
"-"
)
playUrl
=
playUrl
+
'{0}${1}_{2}#'
.
format
(
part
,
e
id
,
cid
)
playUrl
=
playUrl
+
'{0}${1}_{2}#'
.
format
(
part
,
a
id
,
cid
)
vod
[
'vod_play_from'
]
=
'B站'
vod
[
'vod_play_from'
]
=
'B站'
vod
[
'vod_play_url'
]
=
playUrl
vod
[
'vod_play_url'
]
=
playUrl
...
@@ -369,9 +373,10 @@ class Spider(Spider):
...
@@ -369,9 +373,10 @@ class Spider(Spider):
"Referer"
:
"https://www.bilibili.com"
,
"Referer"
:
"https://www.bilibili.com"
,
"User-Agent"
:
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
"User-Agent"
:
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
}
}
url
=
'https://api.bilibili.com/pgc/player/web/playurl?qn=116&
ep_
id={0}&cid={1}'
.
format
(
ids
[
0
],
ids
[
1
])
url
=
'https://api.bilibili.com/pgc/player/web/playurl?qn=116&
a
id={0}&cid={1}'
.
format
(
ids
[
0
],
ids
[
1
])
if
len
(
self
.
cookies
)
<=
0
:
if
len
(
self
.
cookies
)
<=
0
:
self
.
getCookie
()
self
.
getCookie
()
self
.
bilibili
.
post_history
(
ids
[
0
],
ids
[
1
])
# 回传播放历史记录
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
,
headers
=
header
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
,
headers
=
header
)
jRoot
=
json
.
loads
(
rsp
.
text
)
jRoot
=
json
.
loads
(
rsp
.
text
)
if
jRoot
[
'message'
]
!=
'success'
:
if
jRoot
[
'message'
]
!=
'success'
:
...
...
txt/py/py_bilizb.py
浏览文件 @
51972a35
...
@@ -18,6 +18,7 @@ class Spider(Spider):
...
@@ -18,6 +18,7 @@ class Spider(Spider):
def
getName
(
self
):
def
getName
(
self
):
return
"哔哩直播"
return
"哔哩直播"
# 主页
def
homeContent
(
self
,
filter
):
def
homeContent
(
self
,
filter
):
result
=
{}
result
=
{}
cateManual
=
{
cateManual
=
{
...
@@ -88,7 +89,7 @@ class Spider(Spider):
...
@@ -88,7 +89,7 @@ class Spider(Spider):
if
jo
[
'code'
]
==
0
:
if
jo
[
'code'
]
==
0
:
return
jo
[
'data'
][
"info"
][
"uname"
]
return
jo
[
'data'
][
"info"
][
"uname"
]
def
homeVideoContent
(
self
):
def
homeVideoContent
(
self
,
):
return
self
.
get_hot
(
1
)
return
self
.
get_hot
(
1
)
def
get_recommend
(
self
,
pg
):
def
get_recommend
(
self
,
pg
):
...
@@ -120,7 +121,7 @@ class Spider(Spider):
...
@@ -120,7 +121,7 @@ class Spider(Spider):
def
get_hot
(
self
,
pg
):
def
get_hot
(
self
,
pg
):
result
=
{}
result
=
{}
url
=
'https://api.live.bilibili.com/room/v1/room/get_user_recommend?page=%s'
%
pg
url
=
'https://api.live.bilibili.com/room/v1/room/get_user_recommend?page=%s
&page_size=20
'
%
pg
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
content
=
rsp
.
text
content
=
rsp
.
text
jo
=
json
.
loads
(
content
)
jo
=
json
.
loads
(
content
)
...
@@ -201,7 +202,7 @@ class Spider(Spider):
...
@@ -201,7 +202,7 @@ class Spider(Spider):
def
get_history
(
self
):
def
get_history
(
self
):
result
=
{}
result
=
{}
url
=
'https://api.bilibili.com/x/web-interface/history/cursor?ps=
3
0&type=live'
url
=
'https://api.bilibili.com/x/web-interface/history/cursor?ps=
1
0&type=live'
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
rsp
=
self
.
fetch
(
url
,
cookies
=
self
.
cookies
)
content
=
rsp
.
text
content
=
rsp
.
text
jo
=
json
.
loads
(
content
)
jo
=
json
.
loads
(
content
)
...
@@ -302,7 +303,7 @@ class Spider(Spider):
...
@@ -302,7 +303,7 @@ class Spider(Spider):
vodList
=
jo
[
'data'
][
'result'
][
'live_room'
]
vodList
=
jo
[
'data'
][
'result'
][
'live_room'
]
for
vod
in
vodList
:
for
vod
in
vodList
:
aid
=
str
(
vod
[
'roomid'
]).
strip
()
aid
=
str
(
vod
[
'roomid'
]).
strip
()
title
=
vod
[
'title'
].
strip
(
)
+
"⇦"
+
key
title
=
"直播间:"
+
vod
[
'title'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
+
"⇦"
+
key
img
=
'https:'
+
vod
[
'user_cover'
].
strip
()
img
=
'https:'
+
vod
[
'user_cover'
].
strip
()
remark
=
vod
[
'watched_show'
][
'text_small'
].
strip
()
+
" "
+
vod
[
'uname'
].
strip
()
remark
=
vod
[
'watched_show'
][
'text_small'
].
strip
()
+
" "
+
vod
[
'uname'
].
strip
()
videos1
.
append
({
videos1
.
append
({
...
@@ -316,7 +317,7 @@ class Spider(Spider):
...
@@ -316,7 +317,7 @@ class Spider(Spider):
vodList
=
jo
[
'data'
][
'result'
][
'live_user'
]
vodList
=
jo
[
'data'
][
'result'
][
'live_user'
]
for
vod
in
vodList
:
for
vod
in
vodList
:
aid
=
str
(
vod
[
'roomid'
]).
strip
()
aid
=
str
(
vod
[
'roomid'
]).
strip
()
title
=
vod
[
'uname'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
+
"
⇦"
+
key
title
=
"直播间:"
+
vod
[
'uname'
].
strip
().
replace
(
"<em class=
\"
keyword
\"
>"
,
""
).
replace
(
"</em>"
,
""
)
+
"
⇦"
+
key
img
=
'https:'
+
vod
[
'uface'
].
strip
()
img
=
'https:'
+
vod
[
'uface'
].
strip
()
remark
=
str
(
vod
[
'live_status'
]).
replace
(
"0"
,
"未开播"
).
replace
(
"1"
,
""
)
+
" 关注:"
+
self
.
zh
(
vod
[
'attentions'
])
remark
=
str
(
vod
[
'live_status'
]).
replace
(
"0"
,
"未开播"
).
replace
(
"1"
,
""
)
+
" 关注:"
+
self
.
zh
(
vod
[
'attentions'
])
videos2
.
append
({
videos2
.
append
({
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录