mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 18:27:56 +08:00
🐛 Arknights 公告分类 过滤不可访问的 URL (#495)
This commit is contained in:
@@ -3,7 +3,7 @@ from functools import partial
|
||||
|
||||
from httpx import AsyncClient
|
||||
from bs4 import BeautifulSoup as bs
|
||||
from pydantic import Field, BaseModel
|
||||
from pydantic import Field, AnyUrl, BaseModel
|
||||
from nonebot.compat import type_validate_python
|
||||
|
||||
from ..post import Post
|
||||
@@ -113,7 +113,11 @@ class Arknights(NewMessage):
|
||||
title=title,
|
||||
nickname="明日方舟游戏内公告",
|
||||
images=[data.banner_image_url] if data.banner_image_url else None,
|
||||
url=data.jump_link or None,
|
||||
url=(
|
||||
url.unicode_string()
|
||||
if data.jump_link and (url := AnyUrl(data.jump_link)).scheme.startswith("http")
|
||||
else None
|
||||
),
|
||||
timestamp=data.updated_at,
|
||||
compress=True,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user