add:comments
This commit is contained in:
parent
c2d932b75a
commit
247f24d089
35
main.py
35
main.py
@ -130,9 +130,13 @@ class BiliWebCrawler:
|
|||||||
tag_url = f'https://api.bilibili.com/x/web-interface/view/detail/tag?bvid={self.bvid}'
|
tag_url = f'https://api.bilibili.com/x/web-interface/view/detail/tag?bvid={self.bvid}'
|
||||||
tag_resp = self._safe_request(tag_url)
|
tag_resp = self._safe_request(tag_url)
|
||||||
tag_data = []
|
tag_data = []
|
||||||
if tag_resp:
|
try:
|
||||||
tag_json = tag_resp.json()
|
if tag_resp:
|
||||||
tag_data = [tag['tag_name'] for tag in tag_json.get('data', [])]
|
tag_json = tag_resp.json()
|
||||||
|
tag_data = [tag['tag_name'] for tag in tag_json.get('data', [])]
|
||||||
|
except Exception as e:
|
||||||
|
print(f"获取视频标签失败: {str(e)}")
|
||||||
|
send_notification(f"获取视频{self.bvid}标签失败: {str(e)}")
|
||||||
|
|
||||||
subtitle_data = []
|
subtitle_data = []
|
||||||
try:
|
try:
|
||||||
@ -147,17 +151,20 @@ class BiliWebCrawler:
|
|||||||
})
|
})
|
||||||
|
|
||||||
honor_data = []
|
honor_data = []
|
||||||
honors = video_data.get('honor', [])
|
try:
|
||||||
if isinstance(honors, list): # 确保是列表类型
|
honors = video_data.get('honor', [])
|
||||||
for honor in honors:
|
if isinstance(honors, list): # 确保是列表类型
|
||||||
if isinstance(honor, dict): # 检查是否为字典类型
|
for honor in honors:
|
||||||
honor_data.append({
|
if isinstance(honor, dict): # 检查是否为字典类型
|
||||||
'type': honor.get('type', 0),
|
honor_data.append({
|
||||||
'desc': honor.get('desc', '')
|
'type': honor.get('type', 0),
|
||||||
})
|
'desc': honor.get('desc', '')
|
||||||
# 如果honors是字符串则直接记录
|
})
|
||||||
elif isinstance(honors, str):
|
# 如果honors是字符串则直接记录
|
||||||
honor_data.append({'desc': honors})
|
elif isinstance(honors, str):
|
||||||
|
honor_data.append({'desc': honors})
|
||||||
|
except Exception as e:
|
||||||
|
honor_data = []
|
||||||
|
|
||||||
# 获取staff列表
|
# 获取staff列表
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user