From 887edb91c0f2efc8d6ebd775684bacb3f6ee5c47 Mon Sep 17 00:00:00 2001 From: KimigaiiWuyi <444835641@qq.com> Date: Sat, 30 Nov 2024 04:10:37 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E7=BD=91?= =?UTF-8?q?=E9=A1=B5=E6=8E=A7=E5=88=B6=E5=8F=B0`=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E6=8E=A8=E9=80=81`=E6=8D=A2=E8=A1=8C=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E8=A7=A3=E6=9E=90=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gsuid_core/web_app.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/gsuid_core/web_app.py b/gsuid_core/web_app.py index 1f9237f..e823449 100644 --- a/gsuid_core/web_app.py +++ b/gsuid_core/web_app.py @@ -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(',')