Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于如何打开数据库文件 #91

Closed
qllokirin opened this issue Sep 30, 2024 · 1 comment
Closed

关于如何打开数据库文件 #91

qllokirin opened this issue Sep 30, 2024 · 1 comment

Comments

@qllokirin
Copy link

因为感觉回滚版本有点小麻烦,只是想看看一个群之前撤回的内容,所以想问问怎么直接打开数据文件,感谢
image

@qllokirin
Copy link
Author

摸索了一下,在此整理一下给后面有相关需求的的朋友

需求&问题:高版本ntqq重启后就看不见以前撤回的消息了,但理论上数据库中存在,所以尝试找回

方法一:重装低版本ntqq和ll和修补
低版本qq 1月18号的9.9.7.20979
1月26的LiteLoaderQQNT
1月26的修补

低版本qq来源 https://t.me/qq_updatelog/285

之后正常安装即可查看到以前的撤回信息,但是图片似乎都没了,可能是高版本qq与本项目的兼容性问题,可能没存进数据库,这个也没办法了应该

方法二:直接打开数据库,

import plyvel
import json

# 指定数据库目录路径
db_path = '{your path to LiteLoaderQQNT/data/anti_recall/qq-recalled-db}'

try:
    # 打开 LevelDB 数据库
    db = plyvel.DB(db_path, create_if_missing=False)

    # 遍历数据库中的所有键值对
    for key, value in db:
        try:
            # 解码键和值为字符串(假设它们是 UTF-8 编码的)
            key_str = key.decode('utf-8')
            value_str = value.decode('utf-8')

            # 解析 JSON 数据
            data = json.loads(value_str)

            # 检查 发送者qq是否为 "12345678"
            if data.get('msg').get('senderUin') == "12345678":
                print(f"Key: {key_str}")
                print(f"Value: {json.dumps(data, ensure_ascii=False, indent=4)}\n")

        except (UnicodeDecodeError, json.JSONDecodeError) as e:
            # 处理解码或解析错误
            print(f"无法解析键值对: {key} / {value}")
            print(f"错误: {e}\n")
            continue

except plyvel.Error as e:
    print(f"无法打开数据库: {e}")

finally:
    # 关闭数据库
    db.close()

@xh321 xh321 changed the title 请教一下如何打开数据库文件 关于如何打开数据库文件 Oct 6, 2024
@xh321 xh321 pinned this issue Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant