mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-22 10:52:18 +08:00
修复message[12]导致的群聊头像保存失败的问题
This commit is contained in:
parent
a9b37f3d0e
commit
ed38ad7728
@ -322,8 +322,8 @@ class DocxExporter(ExporterBase):
|
||||
if message[4]: # is_send
|
||||
continue
|
||||
try:
|
||||
chatroom_avatar_path = f"{origin_docx_path}/avatar/{message[12].wxid}.png"
|
||||
message[12].save_avatar(chatroom_avatar_path)
|
||||
chatroom_avatar_path = f"{origin_docx_path}/avatar/{message[13].wxid}.png"
|
||||
message[13].save_avatar(chatroom_avatar_path)
|
||||
except:
|
||||
print(message)
|
||||
pass
|
||||
|
@ -203,6 +203,7 @@ class HtmlExporter(ExporterBase):
|
||||
if video_path is None and image_path is None:
|
||||
return
|
||||
video_path = f'{Me().wx_dir}/{video_path}'
|
||||
video_path = video_path.replace('\\','/')
|
||||
if os.path.exists(video_path):
|
||||
new_path = origin_docx_path + '/video/' + os.path.basename(video_path)
|
||||
if not os.path.exists(new_path):
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +1,7 @@
|
||||
import os
|
||||
import traceback
|
||||
|
||||
from app.log import logger
|
||||
from app.person import Me
|
||||
|
||||
# 图片字节头信息,
|
||||
@ -17,19 +19,23 @@ def get_code(dat_read):
|
||||
:param file_path: dat文件路径
|
||||
:return: 如果文件为jpg/png/gif格式,则返回解密码,否则返回-1
|
||||
"""
|
||||
|
||||
head_index = 0
|
||||
while head_index < len(pic_head):
|
||||
# 使用第一个头信息字节来计算加密码
|
||||
# 第二个字节来验证解密码是否正确
|
||||
code = dat_read[0] ^ pic_head[head_index]
|
||||
idf_code = dat_read[1] ^ code
|
||||
head_index = head_index + 1
|
||||
if idf_code == pic_head[head_index]:
|
||||
return head_index, code
|
||||
head_index = head_index + 1
|
||||
print("not jpg, png, gif")
|
||||
return -1, -1
|
||||
try:
|
||||
if not dat_read:
|
||||
return -1, -1
|
||||
head_index = 0
|
||||
while head_index < len(pic_head):
|
||||
# 使用第一个头信息字节来计算加密码
|
||||
# 第二个字节来验证解密码是否正确
|
||||
code = dat_read[0] ^ pic_head[head_index]
|
||||
idf_code = dat_read[1] ^ code
|
||||
head_index = head_index + 1
|
||||
if idf_code == pic_head[head_index]:
|
||||
return head_index, code
|
||||
head_index = head_index + 1
|
||||
print("not jpg, png, gif")
|
||||
except:
|
||||
logger.error(f'image解析发生了错误:\n\n{traceback.format_exc()}')
|
||||
return -1, -1
|
||||
|
||||
|
||||
def decode_dat(file_path, out_path):
|
||||
|
Loading…
Reference in New Issue
Block a user