Skip to content

Commit

Permalink
fix 无法导出html
Browse files Browse the repository at this point in the history
  • Loading branch information
xaoyaoo committed Feb 28, 2024
1 parent 5c23ff8 commit 356646b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pywxdump/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from pywxdump import analyzer, read_img_dat, read_audio, get_wechat_db, get_core_db
from pywxdump.analyzer.export_chat import get_contact, get_room_user_list
from pywxdump.api.rjson import ReJson, RqJson
from pywxdump.api.utils import read_session, save_session, error9999,gen_base64
from pywxdump.api.utils import read_session, save_session, error9999, gen_base64
from pywxdump import read_info, VERSION_LIST, batch_decrypt, BiasAddr, merge_db, decrypt_merge, merge_real_time_db
import pywxdump

Expand Down Expand Up @@ -544,11 +544,11 @@ def export():
savePath = msg_list[i]["content"]["src"]
MsgSvrID = savePath.split("_")[-1].replace(".wav", "")
if not savePath:
return ReJson(1002)
continue
media_path = read_session(g.sf, "media_path")
wave_data = read_audio(MsgSvrID, is_wave=True, DB_PATH=media_path)
if not wave_data:
return ReJson(1001)
continue
# 判断savePath路径的文件夹是否存在
savePath = os.path.join(outpath, savePath)
if not os.path.exists(os.path.dirname(savePath)):
Expand Down Expand Up @@ -580,7 +580,8 @@ def export():
json.dump(save_data, f, ensure_ascii=False)

json_base64 = gen_base64(os.path.join(save_json_path, "msg_user.json"))
html = js.replace('"./data/msg_user.json"', f'"{json_base64}"')
html = html.replace('"./data/msg_user.json"', f'"{json_base64}"')

with open(os.path.join(outpath, "index.html"), 'w', encoding='utf-8') as f:
f.write(html)
return ReJson(0, outpath)
Expand Down

0 comments on commit 356646b

Please sign in to comment.