Skip to content

Commit

Permalink
fix: #13
Browse files Browse the repository at this point in the history
  • Loading branch information
yzqzss committed Jan 21, 2024
1 parent 075ad4c commit cf0f28b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions biliarchiver/archive_bvid.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def delete_cache(reason: str = ""):
cor3 = download_bilibili_video_detail(
d.client, bvid, f"{video_extrapath}/{file_basename}.info.json"
)
# 下载视频评论。有些视频关闭了评论会获取不到。
cor4 = download_bilibili_video_replies(
d.client, video_info.bvid, video_info.aid,
f"{video_extrapath}/{file_basename}.replies.json"
Expand Down Expand Up @@ -334,6 +335,16 @@ async def download_bilibili_video_detail(client, bvid, filepath):


async def download_bilibili_video_replies(client, bvid, aid, filepath):
for i in range(2):
try:
await _download_bilibili_video_replies(client, bvid, aid, filepath)
return True
except Exception as e:
print(e, "retrying...")

print(_("{} 的视频回复获取失败").format(bvid))

async def _download_bilibili_video_replies(client, bvid, aid, filepath):
""" 仅下载第一页,20 个热评 """
if os.path.exists(filepath):
print(_("{} 的视频回复已存在").format(bvid))
Expand Down

0 comments on commit cf0f28b

Please sign in to comment.