Update bili url
This commit is contained in:
parent
3111c9d783
commit
38dd76c248
2 changed files with 18 additions and 1 deletions
|
@ -35,10 +35,26 @@ async def _(msg: Bot.MessageSession, get_detail=False):
|
|||
await get_info(msg, url, get_detail)
|
||||
|
||||
|
||||
@bili.handle(re.compile(r"(BV1[a-zA-Z0-9]{9})"),
|
||||
@bili.handle(re.compile(r"(BV[a-zA-Z0-9]{10})"),
|
||||
desc="{bilibili.help.regex.bv}")
|
||||
async def _(msg: Bot.MessageSession, get_detail=False):
|
||||
res = msg.matched_msg
|
||||
if res:
|
||||
url = f"{api_url}?bvid={res.group()}"
|
||||
await get_info(msg, url, get_detail)
|
||||
|
||||
|
||||
@bili.handle(re.compile(r"b23\.tv/(av\d{1,9}|BV[A-Za-z0-9]{10}|[A-Za-z0-9]{7})"),
|
||||
desc="{bilibili.help.regex.url}")
|
||||
async def _(msg: Bot.MessageSession, get_detail=False):
|
||||
res = msg.matched_msg
|
||||
if res:
|
||||
video = res.groups()[1]
|
||||
if video[:2] == "BV":
|
||||
url = f"{api_url}?bvid={video}"
|
||||
elif video[:2] == "av":
|
||||
url = f"{api_url}?aid={video[2:]}"
|
||||
else:
|
||||
...
|
||||
|
||||
await get_info(msg, url, get_detail)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"bilibili.help.option.i": "获取详细信息。",
|
||||
"bilibili.help.regex.av": "直接发送 AV 号获取信息。",
|
||||
"bilibili.help.regex.bv": "直接发送 BV 号获取信息,BV 必须大写。",
|
||||
"bilibili.help.regex.url": "发送 b23.tv 短连接获取信息。(WIP)",
|
||||
"bilibili.message": "标题:${title}\n类型:${tname}\nUP 主:${owner}\n日期:${time}",
|
||||
"bilibili.message.detail": "标题:${title}${pages} | 类型:${tname}\nUP 主:${owner} | 粉丝:${fans}\n观看:${view} | 弹幕:${danmaku} | 评论:${reply}\n喜欢:${like} | 投币:${coin} | 收藏:${favorite} | 分享:${share}\n日期:${time}",
|
||||
"bilibili.message.error.invalid": "发生错误:视频编号无效,请检查输入。",
|
||||
|
|
Reference in a new issue