add:comments
This commit is contained in:
parent
c2d932b75a
commit
247f24d089
7
main.py
7
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 = []
|
||||||
|
try:
|
||||||
if tag_resp:
|
if tag_resp:
|
||||||
tag_json = tag_resp.json()
|
tag_json = tag_resp.json()
|
||||||
tag_data = [tag['tag_name'] for tag in tag_json.get('data', [])]
|
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,6 +151,7 @@ class BiliWebCrawler:
|
|||||||
})
|
})
|
||||||
|
|
||||||
honor_data = []
|
honor_data = []
|
||||||
|
try:
|
||||||
honors = video_data.get('honor', [])
|
honors = video_data.get('honor', [])
|
||||||
if isinstance(honors, list): # 确保是列表类型
|
if isinstance(honors, list): # 确保是列表类型
|
||||||
for honor in honors:
|
for honor in honors:
|
||||||
@ -158,6 +163,8 @@ class BiliWebCrawler:
|
|||||||
# 如果honors是字符串则直接记录
|
# 如果honors是字符串则直接记录
|
||||||
elif isinstance(honors, str):
|
elif isinstance(honors, str):
|
||||||
honor_data.append({'desc': honors})
|
honor_data.append({'desc': honors})
|
||||||
|
except Exception as e:
|
||||||
|
honor_data = []
|
||||||
|
|
||||||
# 获取staff列表
|
# 获取staff列表
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user