mirror of
https://github.com/Genshin-bots/gsuid_core.git
synced 2025-06-03 22:19:47 +08:00
🐛 修复网页控制台批量推送
换行无法正确解析的错误
This commit is contained in:
parent
90ba2fd54c
commit
887edb91c0
@ -315,22 +315,22 @@ async def _update_plugins(request: Request, data: Dict):
|
||||
async def _batch_push(request: Request, data: Dict):
|
||||
send_msg = data['push_text']
|
||||
soup = BeautifulSoup(send_msg, 'lxml')
|
||||
stag = soup.p
|
||||
|
||||
msg: List[Message] = []
|
||||
if stag:
|
||||
text = stag.get_text(strip=True)
|
||||
msg.append(MessageSegment.text(text))
|
||||
text_list: List[Tag] = list(soup.find_all('p'))
|
||||
for text in text_list:
|
||||
msg.append(MessageSegment.text(str(text)[3:-4]))
|
||||
|
||||
img_tag: List[Tag] = list(soup.find_all('img'))
|
||||
for img in img_tag:
|
||||
src: str = img.get('src') # type: ignore
|
||||
width: str = img.get('width') # type: ignore
|
||||
height: str = img.get('height') # type: ignore
|
||||
img_tag: List[Tag] = list(soup.find_all('img'))
|
||||
for img in img_tag:
|
||||
src: str = img.get('src') # type: ignore
|
||||
width: str = img.get('width') # type: ignore
|
||||
height: str = img.get('height') # type: ignore
|
||||
|
||||
base64_data = 'base64://' + src.split(',')[-1]
|
||||
base64_data = 'base64://' + src.split(',')[-1]
|
||||
|
||||
msg.append(MessageSegment.image(base64_data))
|
||||
msg.append(MessageSegment.image_size((int(width), int(height))))
|
||||
msg.append(MessageSegment.image(base64_data))
|
||||
msg.append(MessageSegment.image_size((int(width), int(height))))
|
||||
|
||||
send_target: List[str] = data['push_tag'].split(',')
|
||||
push_bots: List[str] = data['push_bot'].split(',')
|
||||
|
Loading…
x
Reference in New Issue
Block a user