ljc545w / ComWeChatRobot

PC微信机器人,实现获取通讯录,发送文本、图片、文件等消息,封装COM接口供Python、C#调用
1.64k stars 451 forks source link

Python 聊天记录怎么导出,导出的MicroMsg.db并没有包含聊天记录 #149

Closed monkeycc closed 2 years ago

monkeycc commented 2 years ago

我确定我已经查看了 (标注[ ][x])


我要申请 (标注[ ][x])


Python 聊天记录怎么导出

def test_BackupDb(instance):
    try:
        dbs = instance.GetDbHandles()
        dbname = 'MicroMsg.db'
        handle = dbs.get(dbname).get('Handle')
        rc = instance.BackupSQLiteDB(handle, 'D:\\ComWeChatRobot-master\\Python\\com\\{}'.format(dbname))
        print(rc)
    except Exception as e:
        print(e)

导出的MicroMsg.db并没有包含聊天记录

ljc545w commented 2 years ago

MSGx.db,x是一个数字

monkeycc commented 2 years ago

微信数据目录 \Msg\MicroMsg.db \Msg\Multi\MSG0.db

我发现应该是要写MSG0.db dbname = 'MSG0.db'

但是python导出的时候 报错

        dbname = 'MicroMsg.db'
        handle = dbs.get(dbname).get('Handle')

'NoneType' object has no attribute 'get'

发现

        tables_tuple = self.robot.CGetDbHandles(self.pid)
        tables = [dict(i) for i in tables_tuple]
        print("tables",tables)

tables [{'dbname': 'MicroMsg.db', 只有MicroMsg.db

ljc545w commented 2 years ago

稍等,晚点发布

ljc545w commented 2 years ago

150