mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-23 03:22:17 +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
|
if message[4]: # is_send
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
chatroom_avatar_path = f"{origin_docx_path}/avatar/{message[12].wxid}.png"
|
chatroom_avatar_path = f"{origin_docx_path}/avatar/{message[13].wxid}.png"
|
||||||
message[12].save_avatar(chatroom_avatar_path)
|
message[13].save_avatar(chatroom_avatar_path)
|
||||||
except:
|
except:
|
||||||
print(message)
|
print(message)
|
||||||
pass
|
pass
|
||||||
|
@ -203,6 +203,7 @@ class HtmlExporter(ExporterBase):
|
|||||||
if video_path is None and image_path is None:
|
if video_path is None and image_path is None:
|
||||||
return
|
return
|
||||||
video_path = f'{Me().wx_dir}/{video_path}'
|
video_path = f'{Me().wx_dir}/{video_path}'
|
||||||
|
video_path = video_path.replace('\\','/')
|
||||||
if os.path.exists(video_path):
|
if os.path.exists(video_path):
|
||||||
new_path = origin_docx_path + '/video/' + os.path.basename(video_path)
|
new_path = origin_docx_path + '/video/' + os.path.basename(video_path)
|
||||||
if not os.path.exists(new_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 os
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
from app.log import logger
|
||||||
from app.person import Me
|
from app.person import Me
|
||||||
|
|
||||||
# 图片字节头信息,
|
# 图片字节头信息,
|
||||||
@ -17,19 +19,23 @@ def get_code(dat_read):
|
|||||||
:param file_path: dat文件路径
|
:param file_path: dat文件路径
|
||||||
:return: 如果文件为jpg/png/gif格式,则返回解密码,否则返回-1
|
:return: 如果文件为jpg/png/gif格式,则返回解密码,否则返回-1
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
head_index = 0
|
if not dat_read:
|
||||||
while head_index < len(pic_head):
|
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
|
code = dat_read[0] ^ pic_head[head_index]
|
||||||
if idf_code == pic_head[head_index]:
|
idf_code = dat_read[1] ^ code
|
||||||
return head_index, code
|
head_index = head_index + 1
|
||||||
head_index = head_index + 1
|
if idf_code == pic_head[head_index]:
|
||||||
print("not jpg, png, gif")
|
return head_index, code
|
||||||
return -1, -1
|
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):
|
def decode_dat(file_path, out_path):
|
||||||
|
Loading…
Reference in New Issue
Block a user