Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shuakami committed Jul 10, 2024
0 parents commit 27206ac
Show file tree
Hide file tree
Showing 8 changed files with 371 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Shuakami

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div align="center"><img src="banner-0103.png" alt="QQ Chat Exporter Banner"># QQ Chat Exporter[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)[![Python Version](https://img.shields.io/badge/python-3.7%2B-blue)](https://www.python.org/downloads/)[![GitHub Stars](https://img.shields.io/github/stars/shuakami/qq-chat-exporter.svg)](https://github.com/shuakami/qq-chat-exporter/stargazers)[![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://github.com/shuakami/qq-chat-exporter)English | [简体中文](README_zh.md)🚀 Export your QQ chat history 🚀[Features](#features) • [Quick Start](#quick-start) • [Detailed Guide](#detailed-guide) • [FAQ](#faq) • [Contributing](#contributing) • [License](#license)</div>## FeaturesQQ Chat Exporter is an innovative tool developed to solve the difficulty of exporting chat history for QQ users. It offers the following core functionalities:- 🖥️ **Intelligent Window Recognition**: Automatically locates and focuses on the QQ chat window- 💬 **Precise Message Extraction**: Accurately identifies and copies chat message content- 👥 **User Differentiation**: Intelligently distinguishes between your messages and others'- 📊 **Structured Storage**: Saves exported messages in an easily processable JSON format- 🖱️ **Automatic Scrolling**: Simulates mouse scrolling to retrieve more historical messages- 🛡️ **Safe Operation**: Built-in protection mechanism to avoid accidental clicks on critical areas## Quick Start### Prerequisites- Python 3.7+- Windows operating system- Recommended NT QQ version 9.9.10-23873 (64-bit)### Installation Steps1. Clone the repository (or download the repository's zip file and extract it): ``` git clone https://github.com/shuakami/qq-chat-exporter.git ```2. Enter the project directory: ``` cd qq-chat-exporter ```3. Install dependencies: ``` pip install -r requirements.txt ```### Basic Usage1. Configure message colors (in `qq.py`): ```python my_message_color = (0, 153, 255) # Your message color other_message_color = (241, 252, 247) # Others' message color ```2. Run `fuck_down_test.py` to get the non-clickable area3. Replace the non-clickable area parameters in `qq.py` ```python # Non-clickable area # Please run fuck_down_test.py to get and replace the following part avoid_area = [(1248, 589), (1299, 589), (1249, 611), (1299, 613)] ```4. Run the main script: ``` python qq.py ```## Detailed Guide### 1. Environment PreparationEnsure your system meets the following requirements:- Windows operating system (Windows 10 or higher recommended)- Python 3.7 or higher version- Stable internet connection (for installing dependencies)### 2. Installation ProcessAfter cloning the repository, we need to install the necessary Python libraries. The `requirements.txt` file contains the following dependencies:```pyautogui==0.9.53 # For simulating mouse and keyboard operationsopencv-python==4.5.5.64 # For image processing and recognitionpillow==8.4.0 # For image manipulationpywin32==301 # For Windows system interactionnumpy==1.21.5 # For numerical computations```Running `pip install -r requirements.txt` will automatically install these libraries.## Configuration Details### Message Color SettingsIn the `qq.py` file, you need to set two colors:```pythonmy_message_color = (0, 153, 255) # Blueother_message_color = (241, 252, 247) # Light green```These RGB values determine how the script identifies different message bubbles. You may need to adjust these according to your QQ theme.### Non-clickable AreaRun `fuck_down_test.py` and follow the prompts. This script will help you locate sensitive areas in the QQ window to prevent the script from triggering unnecessary operations.Steps:1. Run the script2. In the QQ window, right-click on the four corners of the sensitive area, starting from the top-left3. The script will output coordinates, update these coordinates in the `avoid_area` variable in `qq.py`### 4. Running the ScriptOnce ready, run `python qq.py`. The script will automatically:- Locate the QQ window- Identify and copy messages- Save messages to the `training_data.json` file### 5. Precautions- Do not operate the computer while the script is running to avoid interfering with the automation process- If interrupted by special content (such as images, files), manually click on another area to continue, or press Ctrl+C to restart- It's recommended to use a plain or high-contrast wallpaper to improve recognition accuracy## FAQ1. **Q: What if the script can't recognize the QQ window?** A: Ensure the QQ window is active and not minimized. Try restarting both QQ and the script.2. **Q: How to solve inaccurate message color recognition?** A: Fine-tune the RGB values of `my_message_color` and `other_message_color`. You can use a screen color picker tool to get precise colors.3. **Q: How to handle a large amount of historical messages?** A: The script is designed to automatically scroll and process messages. For particularly long chat histories, you may need to run the script multiple times.4. **Q: What to do if the script suddenly stops during execution?** A: This may be due to encountering images, special chat records, or other interfering elements. Please manually click on another area of the chat window to continue, or press Ctrl+C to terminate the script and restart.5. **Q: Why do we need to run fuck_down_test.py?** A: This script helps determine the coordinates of non-clickable areas. These areas typically contain elements that might interfere with the export process. If you're unsure what this element is, please check `dist/fuck_down.png` in the repository.6. **Q: Why does the wallpaper affect script operation?** A: The script distinguishes messages by recognizing specific colors. If the wallpaper color is similar to the message bubble color, it may cause misidentification. It's recommended to use a plain wallpaper with high contrast to the message colors.7. **Q: Can I leave it unattended during execution?** A: During execution, you must watch it run. Sometimes it might click on images, chat records, or other things that interrupt the process. You need to click elsewhere to continue, or use Ctrl+C to restart.8. **Q: How to ensure all messages are correctly exported?** A: The script automatically processes visible messages but may not handle hidden content. It's recommended to manually scroll to the desired starting position before exporting, and check the output file after the script completes.9. **Q: How to use the exported JSON file?** A: The exported JSON file contains structured chat data that can be used for data analysis, backup, or import into other applications. You can use Python's json module or other JSON processing tools to read and process this data.## ContributingWe welcome and encourage community contributions! If you have any improvement suggestions or have found a bug, please:1. Fork this repository2. Create your feature branch (`git checkout -b feature/AmazingFeature`)3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)4. Push to the branch (`git push origin feature/AmazingFeature`)5. Open a Pull Request### Contribution GuidelinesTo maintain the quality and consistency of the project, please follow these guidelines:- Adhere to the [PEP 8](https://www.python.org/dev/peps/pep-0008/) coding standards- Write unit tests for new features- Update documentation to reflect your changes- Keep commit messages concise and clear## LicenseThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.## Tech Stack- [OpenCV](https://opencv.org/) - [PyAutoGUI](https://pyautogui.readthedocs.io/) ## Changelog### Version 1.0.0 (2024-7-10)- Initial release- Implemented basic QQ chat history export functionality- Added automatic scrolling and message recognition features## DisclaimerQQ Chat Exporter is an open-source tool designed to help users export their personal chat history. When using this tool, please be aware of the following:1. **Legal Use**: This tool is for personal legal use only. Users should ensure they have the right to export chat records and comply with all applicable laws and regulations.2. **Privacy Protection**: Please respect others' privacy. Do not export or share others' chat records without permission.3. **Data Security**: Exported chat records may contain sensitive information. Users are responsible for properly safeguarding and using this data.4. **Liability Disclaimer**: The developers and contributors of this project are not responsible for any direct or indirect losses caused by using this tool, including but not limited to data loss, privacy breaches, or legal disputes.5. **Unofficial Tool**: QQ Chat Exporter is not affiliated with Tencent or QQ. It is an independent third-party tool.6. **Risk Assumption**: By using this tool, you agree to assume all risks associated with its use.7. **Copyright Notice**: This tool does not store or transmit any chat content and only runs on the user's local device. Users should ensure compliance with relevant copyright laws.8. **Technical Limitations**: Due to potential QQ updates, the functionality of this tool may be affected. We do not guarantee that the tool will work in all circumstances.By using this tool, you acknowledge that you have read, understood, and agree to abide by the above disclaimer. If you do not agree to these terms, please do not use this tool.## Project Status![Project Status](https://img.shields.io/badge/status-active-brightgreen.svg)QQ Chat Exporter is currently in active development. We regularly release updates and bug fixes. Feel free to follow this project for the latest developments.---<div align="center">**Like this project? Please give us a ⭐️!**</div>
Expand Down
1 change: 1 addition & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div align="center"><img src="banner-0103.png" alt="QQ Chat Exporter Banner"># QQ Chat Exporter[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)[![Python Version](https://img.shields.io/badge/python-3.7%2B-blue)](https://www.python.org/downloads/)[![GitHub Stars](https://img.shields.io/github/stars/shuakami/qq-chat-exporter.svg)](https://github.com/shuakami/qq-chat-exporter/stargazers)[![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://github.com/shuakami/qq-chat-exporter)[English](README.md) | 简体中文🚀 导出你的QQ聊天记录 🚀[特性](#特性) • [快速开始](#快速开始) • [详细指南](#详细指南) • [常见问题](#常见问题) • [贡献](#贡献) • [许可证](#许可证)</div>## 特性QQ Chat Exporter 是为解决QQ用户难以导出聊天记录而开发的创新工具。它提供了以下核心功能:- 🖥️ **智能窗口识别**:自动定位并聚焦QQ聊天窗口- 💬 **精准消息提取**:准确识别并复制聊天消息内容- 👥 **用户区分**:智能区分自己和他人的消息- 📊 **结构化存储**:将导出的消息保存为易处理的JSON格式- 🖱️ **自动滚动**:模拟鼠标滚动,获取更多历史消息- 🛡️ **安全操作**:内置保护机制,避免误触关键区域## 快速开始### 前置条件- Python 3.7+- Windows 操作系统- 建议 NT QQ 版本 9.9.10-23873 (64位)### 安装步骤1. 克隆仓库(或者直接下载仓库打包的zip并解压): ``` git clone https://github.com/shuakami/qq-chat-exporter.git ```2. 进入项目目录: ``` cd qq-chat-exporter ```3. 安装依赖: ``` pip install -r requirements.txt ```### 基本使用1. 配置消息颜色(在 `qq.py` 中): ```python my_message_color = (0, 153, 255) # 你的消息颜色 other_message_color = (241, 252, 247) # 别人消息颜色 ```2. 运行 `fuck_down_test.py` 得到不可点击区域3. 把不可点击区域参数替换到`qq.py` ```python # 不可点击区域 # 此部分请执行fuck_down_test.py获取并覆盖下面的部分 avoid_area = [(1248, 589), (1299, 589), (1249, 611), (1299, 613)] ```4. 运行主脚本: ``` python qq.py ```## 详细指南### 1. 环境准备确保您的系统满足以下要求:- Windows 操作系统(推荐 Windows 10 或更高版本)- Python 3.7 或更高版本- 稳定的网络连接(用于安装依赖)### 2. 安装过程克隆仓库后,我们需要安装必要的Python库。`requirements.txt` 文件包含了以下依赖:```pyautogui==0.9.53 # 用于模拟鼠标和键盘操作opencv-python==4.5.5.64 # 用于图像处理和识别pillow==8.4.0 # 用于图像操作pywin32==301 # 用于Windows系统交互numpy==1.21.5 # 用于数值计算```运行 `pip install -r requirements.txt` 会自动安装这些库。## 配置详解### 消息颜色设置在 `qq.py` 文件中,您需要设置两种颜色:```pythonmy_message_color = (0, 153, 255) # 蓝色other_message_color = (241, 252, 247) # 浅绿色```这些RGB值决定了脚本如何识别不同的消息气泡。您可能需要根据您的QQ主题进行调整。### 不可点击区域运行 `fuck_down_test.py` 并按提示操作。这个脚本会帮助您定位QQ窗口中的敏感区域,防止脚本误触发不必要的操作。操作步骤:1. 运行脚本2. 在QQ窗口中,从左上角开始,依次右键点击敏感区域的四个角落3. 脚本会输出坐标,将这些坐标更新到 `qq.py` 中的 `avoid_area` 变量### 4. 运行脚本准备就绪后,运行 `python qq.py`。脚本会自动:- 定位QQ窗口- 识别并复制消息- 将消息保存到 `training_data.json` 文件### 5. 注意事项- 运行过程中请勿操作电脑,以免干扰自动化流程- 如遇特殊内容(如图片、文件)导致中断,可手动点击其他区域继续,或按 Ctrl+C 重新开始- 建议使用纯色或与消息颜色反差较大的壁纸,以提高识别准确率## 常见问题1. **Q: 脚本无法识别QQ窗口怎么办?** A: 确保QQ窗口处于活动状态且未最小化。尝试重新启动QQ和脚本。2. **Q: 消息颜色识别不准确怎么解决?** A: 微调 `my_message_color` 和 `other_message_color` 的RGB值。可以使用屏幕取色工具获取精确颜色。3. **Q: 如何处理大量历史消息?** A: 脚本设计为自动滚动并处理消息。对于特别长的聊天记录,可能需要多次运行脚本。4. **Q: 执行过程中脚本突然停止怎么办?** A: 这可能是因为遇到了图片、特殊聊天记录等干扰项。请手动点击聊天窗口的其他区域继续,或按 Ctrl+C 终止脚本并重新开始。5. **Q: 为什么要执行 fuck_down_test.py?** A: 这个脚本帮助确定不可点击区域的坐标。这些区域通常包含可能干扰导出过程的元素。如果你不知道这个元素是什么,请看仓库内的`dist/fuck_down.png` 6. **Q: 壁纸为什么会影响脚本运行?** A: 脚本通过识别特定颜色来区分消息。如果壁纸颜色与消息气泡颜色相近,可能会导致误识别。建议使用与消息颜色反差较大的纯色壁纸。7. **Q: 在执行过程中可以放手不管吗?** A: 在执行过程中,你必须看着他执行。因为有时候他会点图片、聊天记录等等这种会打断进程的东西。你需要点别的地方继续,或者Ctrl+C重开。8. **Q: 如何确保所有消息都被正确导出?** A: 脚本会自动处理可见的消息,但可能无法处理被隐藏的内容。建议在开始导出前,手动滚动到想要开始的位置,并在脚本完成后检查输出文件。9. **Q: 导出的 JSON 文件如何使用?** A: 导出的 JSON 文件包含结构化的聊天数据,可以用于数据分析、备份或导入到其他应用程序。您可以使用 Python 的 json 模块或其他 JSON 处理工具来读取和处理这些数据。## 贡献我们欢迎并鼓励社区贡献!如果您有任何改进意见或发现了bug,请:1. Fork 本仓库2. 创建您的特性分支 (`git checkout -b feature/AmazingFeature`)3. 提交您的更改 (`git commit -m 'Add some AmazingFeature'`)4. 推送到分支 (`git push origin feature/AmazingFeature`)5. 开启一个 Pull Request### 贡献指南为了维护项目的质量和一致性,请遵循以下准则:- 遵守 [PEP 8](https://www.python.org/dev/peps/pep-0008/) 编码规范- 为新功能编写单元测试- 更新文档以反映您的更改- 保持提交信息简洁明了## 许可证本项目采用 MIT 许可证。查看 [LICENSE](LICENSE) 文件以获取更多信息。## 技术栈- [OpenCV](https://opencv.org/) - [PyAutoGUI](https://pyautogui.readthedocs.io/) ## 更新日志### 版本 1.0.0 (2024-7-10)- 初始版本发布- 实现基本的QQ聊天记录导出功能- 添加自动滚动和消息识别功能## 免责声明QQ Chat Exporter 是一个开源工具,旨在帮助用户导出个人聊天记录。使用本工具时,请注意以下事项:1. **合法使用**:本工具仅供个人合法使用。用户应确保拥有导出聊天记录的权利,并遵守所有适用的法律法规。2. **隐私保护**:请尊重他人隐私,不要在未经许可的情况下导出或分享他人的聊天记录。3. **数据安全**:导出的聊天记录可能包含敏感信息。用户有责任妥善保管和使用这些数据。4. **免责声明**:本项目开发者和贡献者不对使用本工具导致的任何直接或间接损失负责,包括但不限于数据丢失、隐私泄露或法律纠纷。5. **非官方工具**:QQ Chat Exporter 不隶属于腾讯公司或 QQ,是一个独立的第三方工具。6. **风险承担**:使用本工具即表示您同意自行承担使用过程中的所有风险。7. **版权声明**:本工具不会存储或传输任何聊天内容,仅在用户本地设备上运行。用户应确保遵守相关版权法。8. **技术限制**:由于 QQ 可能进行更新,本工具的功能可能会受到影响。我们不保证工具在所有情况下都能正常工作。使用本工具即表示您已阅读、理解并同意遵守以上免责声明。如果您不同意这些条款,请不要使用本工具。## 项目状态![Project Status](https://img.shields.io/badge/status-active-brightgreen.svg)QQ Chat Exporter 目前处于积极开发阶段。我们定期发布更新和bug修复。欢迎关注本项目以获取最新动态。---<div align="center">**喜欢这个项目?请给我们一个 ⭐️!**</div>
Expand Down
Binary file added banner-0103.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 27206ac

Please sign in to comment.