Archived
1
0
Fork 0
This commit is contained in:
多羅狼 2023-07-02 14:57:49 +08:00 committed by GitHub
parent 40a1205102
commit 89930040b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,38 +15,38 @@ async def get_info(msg: Bot.MessageSession, url, get_detail=False):
await msg.finish(ErrorMessage(str(e)))
view = res['data']['View']
stat = view['stat']
view = res["data"]["View"]
stat = view["stat"]
pic = view['pic']
video_url = f"https://www.bilibili.com/video/{view['bvid']}"
title = view['title']
tname = view['tname']
pic = view["pic"]
video_url = f'https://www.bilibili.com/video/{view["bvid"]}'
title = view["title"]
tname = view["tname"]
timestamp = view['ctime']
timestamp = view["ctime"]
dt_object = datetime.fromtimestamp(timestamp)
time = dt_object.strftime('%Y-%m-%d %H:%M:%S')
if len(view['pages']) > 1:
pages = f" ({len(view['pages'])} P)"
if len(view["pages"]) > 1:
pages = f' ({len(view["pages"])} P)'
else:
pages = ''
stat_view = format_num(stat['view'])
stat_danmaku = format_num(stat['danmaku'])
stat_reply = format_num(stat['reply'])
stat_favorite = format_num(stat['favorite'])
stat_coin = format_num(stat['coin'])
stat_share = format_num(stat['share'])
stat_like = format_num(stat['like'])
stat_view = format_num(stat["view"])
stat_danmaku = format_num(stat["danmaku"])
stat_reply = format_num(stat["reply"])
stat_favorite = format_num(stat["favorite"])
stat_coin = format_num(stat["coin"])
stat_share = format_num(stat["share"])
stat_like = format_num(stat["like"])
owner = view['owner']['name']
fans = format_num(res['data']['Card']['card']['fans'])
owner = view["owner"]["name"]
fans = format_num(res["data"]["Card"]["card"]["fans"])
if get_detail:
output = video_url + msg.locale.t('bilibili.message', title=title, tname=tname, owner=owner, time=time)
output = video_url + msg.locale.t("bilibili.message", title=title, tname=tname, owner=owner, time=time)
else:
output = video_url + msg.locale.t('bilibili.message.detail', title=title, pages=pages, tname=tname,
output = video_url + msg.locale.t("bilibili.message.detail", title=title, pages=pages, tname=tname,
owner=owner, fans=fans, view=stat_view, danmaku=stat_danmaku, reply=stat_reply,
like=stat_like, coin=stat_coin, favorite=stat_favorite, share=stat_share)