|
@@ -891,15 +891,21 @@ async def handle_image_group_async(request: Request,token_id,app_id, wxid,msg_da |
|
|
msg_content=msg_data["Content"]["string"] |
|
|
msg_content=msg_data["Content"]["string"] |
|
|
callback_to_user=msg_data["FromUserName"]["string"] |
|
|
callback_to_user=msg_data["FromUserName"]["string"] |
|
|
|
|
|
|
|
|
aeskey = re.search(r'aeskey="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
cdnthumburl = re.search(r'cdnthumburl="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
md5 = re.search(r'md5="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
cdnthumblength = re.search(r'cdnthumblength="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
cdnthumbheight = re.search(r'cdnthumbheight="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
cdnthumbwidth = re.search(r'cdnthumbwidth="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
length = re.search(r'length="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
|
|
|
|
|
|
img_xml=f'<?xml version=\"1.0\"?>\n<msg>\n\t<img aeskey=\"{aeskey}\" encryver=\"1\" cdnthumbaeskey=\"{aeskey}\" cdnthumburl=\"{cdnthumburl}\" cdnthumblength=\"{cdnthumblength}\" cdnthumbheight=\"{cdnthumbheight}\" cdnthumbwidth=\"{cdnthumbwidth}\" cdnmidheight=\"0\" cdnmidwidth=\"0\" cdnhdheight=\"0\" cdnhdwidth=\"0\" cdnmidimgurl=\"{cdnthumburl}\" length=\"{length}\" md5=\"{md5}\" />\n\t<platform_signature></platform_signature>\n\t<imgdatahash></imgdatahash>\n</msg>' |
|
|
|
|
|
|
|
|
# aeskey = re.search(r'aeskey="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
# cdnthumburl = re.search(r'cdnthumburl="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
# md5 = re.search(r'md5="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
# cdnthumblength = re.search(r'cdnthumblength="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
# cdnthumbheight = re.search(r'cdnthumbheight="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
# cdnthumbwidth = re.search(r'cdnthumbwidth="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
# length = re.search(r'length="([^"]+)"', msg_content).group(1) |
|
|
|
|
|
|
|
|
|
|
|
# img_xml=f'<?xml version=\"1.0\"?>\n<msg>\n\t<img aeskey=\"{aeskey}\" encryver=\"1\" cdnthumbaeskey=\"{aeskey}\" cdnthumburl=\"{cdnthumburl}\" cdnthumblength=\"{cdnthumblength}\" cdnthumbheight=\"{cdnthumbheight}\" cdnthumbwidth=\"{cdnthumbwidth}\" cdnmidheight=\"0\" cdnmidwidth=\"0\" cdnhdheight=\"0\" cdnhdwidth=\"0\" cdnmidimgurl=\"{cdnthumburl}\" length=\"{length}\" md5=\"{md5}\" />\n\t<platform_signature></platform_signature>\n\t<imgdatahash></imgdatahash>\n</msg>' |
|
|
|
|
|
xml_match = re.search(r'<\?xml.*</msg>', msg_content, re.DOTALL) |
|
|
|
|
|
if not xml_match: |
|
|
|
|
|
logger.info(f'找不到图片地址') |
|
|
|
|
|
return |
|
|
|
|
|
img_xml=xml_match.group(0) |
|
|
|
|
|
|
|
|
wx_img_url= await request.app.state.gewe_service.download_image_msg_async(token_id,app_id,img_xml) |
|
|
wx_img_url= await request.app.state.gewe_service.download_image_msg_async(token_id,app_id,img_xml) |
|
|
if not wx_img_url: |
|
|
if not wx_img_url: |
|
|
logger.warning(f'{wxid} 下载 {callback_to_user} 图片失败') |
|
|
logger.warning(f'{wxid} 下载 {callback_to_user} 图片失败') |
|
|