首次提交
22
.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
||||
|
||||
name: 打包发布
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
pyinstaller-build:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Create Executable
|
||||
uses: sayyid5416/pyinstaller@v1
|
||||
with:
|
||||
python_ver: '3.11'
|
||||
requirements: 'requirements.txt'
|
||||
spec: 'main.spec'
|
||||
upload_exe_with_name: 'wechat_moments'
|
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
.idea/
|
||||
log/
|
||||
build/
|
||||
dist/
|
||||
output/
|
||||
app/DataBase/Msg
|
201
LICENSE
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [技术爬爬虾(B站 抖音 Youtube同名)]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
101
README.md
Normal file
@ -0,0 +1,101 @@
|
||||
# <center>WechatMoments</center>
|
||||
|
||||
# 微信朋友圈导出工具
|
||||
|
||||
# 一、项目介绍
|
||||
|
||||
## 1. 项目简介
|
||||
|
||||
* [WechatMoments](https://github.com/tech-shrimp/WechatMoments)是一款运行在Windows上的,备份导出朋友圈为html的工具
|
||||
* 作者:[技术爬爬虾](https://space.bilibili.com/316183842)(B站 抖音 Youtube同名)更多有趣实用项目请关注
|
||||
* 开源许可: Apache License
|
||||
* 分发,宣传,二次开发等请注明原作者
|
||||
|
||||
## 2. 使用说明
|
||||
|
||||
* (1) 安装[Windows版微信](https://pc.weixin.qq.com/)
|
||||
* (2) 登陆微信,登陆成功后**重启微信**,并再次登陆
|
||||
* (3) 在release下载压缩包wechat_moments.zip
|
||||
* (4) 解压文件夹(路径不要包含中文)
|
||||
* (5) 管理员身份运行wechat_moments.exe,并按提示操作
|
||||
* (6) 如发生异常,重启微信,重启软件
|
||||
|
||||
# 二. 详细介绍
|
||||
|
||||
## 1. 核心功能
|
||||
|
||||
* 导出微信朋友圈数据为HTML
|
||||
* 可以下载图片/视频离线查看,永久保存
|
||||
* 可以根据联系人,朋友圈时间进行过滤导出
|
||||
* 强依赖微信Windows客户端,只提供windows版本
|
||||
* 只测试过python3.11+Win10/Win11,其他环境随缘
|
||||
|
||||
## 2. 已知问题
|
||||
|
||||
* 视频下载不稳定
|
||||
* HTML页面比较原始
|
||||
* 音乐等朋友圈不支持
|
||||
|
||||
## 3. 常见问题与解决方法
|
||||
* 问题:为什么导出的数据不全?
|
||||
* 回答:软件只能导出在电脑微信浏览过的朋友圈记录,未浏览过的无法导出。
|
||||
|
||||
* 问题:怎么在电脑微信浏览朋友圈?
|
||||
* 回答:软件提供了两种自动浏览朋友圈的方法,第一种浏览全部,缺点是最多只能刷到前100天。第二种浏览单个朋友,没有时间限制。
|
||||
|
||||
* 问题:浏览单个朋友的功能不能用!
|
||||
* 回答:自动化操作依赖pyautogui, 识图成功率与电脑的分辨率,缩放比例有很大关系。可以手动操作,或替换截图提高成功率。详见文档
|
||||
|
||||
|
||||
## 4. 更新计划
|
||||
|
||||
* 导出点赞,评论等
|
||||
* HTML网页功能增强,过滤排序等功能
|
||||
* 其他导出格式(Word, PDF等)
|
||||
* 佛系开发随缘更新
|
||||
|
||||
## 5. 问题反馈
|
||||
|
||||
* 请直接提issue,或发送邮箱techshrimp@163.com
|
||||
* 请附上日志与软件截图,日志地址log\xxxx-xx-xx-output.log
|
||||
|
||||
## 6. 二次开发
|
||||
|
||||
* Python环境: Python3.11
|
||||
* 安装依赖: pip install requirements.txt
|
||||
* 启动: python main.py
|
||||
* 编译为可执行文件: 使用Github Action(.github/workflows/main.yml)
|
||||
* 微信数据库解密见项目:[https://github.com/xaoyaoo/PyWxDump](https://github.com/xaoyaoo/PyWxDump)
|
||||
|
||||
|
||||
# 三、免责声明
|
||||
|
||||
### 1. 使用目的
|
||||
|
||||
* 本项目仅供学习交流使用,本项目无收费项目,不用于盈利,**请勿用于非法用途**,否则后果自负。
|
||||
* 本项目只能导出**自己有权查看**的朋友圈数据,无其他越权功能。
|
||||
* 用户理解并同意,任何违反法律法规、侵犯他人合法权益的行为,均与本项目及其开发者无关,后果由用户自行承担。
|
||||
* 禁止利用本项目的相关技术从事非法测试或渗透,禁止利用本项目的相关代码或相关技术从事任何非法工作
|
||||
|
||||
### 2. 使用期限
|
||||
|
||||
* 您应该在下载保存,编译使用本项目的24小时内,删除本项目的源代码和(编译出的)程序;超出此期限的任何使用行为,一概与本项目及其开发者无关。
|
||||
|
||||
### 3. 操作规范
|
||||
|
||||
* 本项目仅允许在授权情况下对朋友圈进行备份与查看,严禁用于非法目的,否则自行承担所有相关责任;用户如因违反此规定而引发的任何法律责任,将由用户自行承担,与本项目及其开发者无关。
|
||||
* 严禁用于窃取他人隐私,否则自行承担所有相关责任。
|
||||
|
||||
### 4. 免责声明接受
|
||||
|
||||
* 下载、保存、进一步浏览源代码或者下载安装、编译使用本程序,表示你同意本警告,并承诺遵守它;
|
||||
|
||||
# 四、致谢
|
||||
|
||||
* PC微信工具:[https://github.com/xaoyaoo/PyWxDump](https://github.com/xaoyaoo/PyWxDump)
|
||||
* 留痕(聊天导出工具):[https://github.com/LC044/WeChatMsg](https://github.com/LC044/WeChatMsg)
|
||||
|
||||
# 五、捐赠
|
||||
|
||||
如有帮助,请帮忙给B站视频点赞充电
|
||||
[技术爬爬虾](https://space.bilibili.com/316183842)
|
21
app/DataBase/__init__.py
Normal file
@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : __init__.py.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2023/1/5 0:10
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
||||
from .micro_msg import MicroMsg
|
||||
from .misc import Misc
|
||||
from .msg import Msg
|
||||
from .sns import Sns
|
||||
|
||||
misc_db = Misc()
|
||||
msg_db = Msg()
|
||||
micro_msg_db = MicroMsg()
|
||||
sns_db = Sns()
|
||||
|
||||
|
||||
__all__ = ['misc_db', 'micro_msg_db', 'msg_db', "sns_db"]
|
137
app/DataBase/micro_msg.py
Normal file
@ -0,0 +1,137 @@
|
||||
import os.path
|
||||
import sqlite3
|
||||
import threading
|
||||
|
||||
lock = threading.Lock()
|
||||
db_path = "./app/Database/Msg/MicroMsg.db"
|
||||
|
||||
|
||||
def singleton(cls):
|
||||
_instance = {}
|
||||
|
||||
def inner():
|
||||
if cls not in _instance:
|
||||
_instance[cls] = cls()
|
||||
return _instance[cls]
|
||||
|
||||
return inner
|
||||
|
||||
|
||||
def is_database_exist():
|
||||
return os.path.exists(db_path)
|
||||
|
||||
@singleton
|
||||
class MicroMsg:
|
||||
def __init__(self):
|
||||
self.DB = None
|
||||
self.cursor = None
|
||||
self.open_flag = False
|
||||
self.init_database()
|
||||
|
||||
def init_database(self):
|
||||
if not self.open_flag:
|
||||
if os.path.exists(db_path):
|
||||
self.DB = sqlite3.connect(db_path, check_same_thread=False)
|
||||
# '''创建游标'''
|
||||
self.cursor = self.DB.cursor()
|
||||
self.open_flag = True
|
||||
if lock.locked():
|
||||
lock.release()
|
||||
|
||||
def get_contact(self):
|
||||
if not self.open_flag:
|
||||
return None
|
||||
try:
|
||||
lock.acquire(True)
|
||||
sql = '''SELECT UserName, Alias, Type, Remark, NickName, PYInitial, RemarkPYInitial, ContactHeadImgUrl.smallHeadImgUrl, ContactHeadImgUrl.bigHeadImgUrl,ExTraBuf,COALESCE(ContactLabel.LabelName, 'None') AS labelName
|
||||
FROM Contact
|
||||
INNER JOIN ContactHeadImgUrl ON Contact.UserName = ContactHeadImgUrl.usrName
|
||||
LEFT JOIN ContactLabel ON Contact.LabelIDList = ContactLabel.LabelId
|
||||
WHERE (Type!=4 AND VerifyFlag=0)
|
||||
AND NickName != ''
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN RemarkPYInitial = '' THEN PYInitial
|
||||
ELSE RemarkPYInitial
|
||||
END ASC
|
||||
'''
|
||||
self.cursor.execute(sql)
|
||||
result = self.cursor.fetchall()
|
||||
except sqlite3.OperationalError:
|
||||
# 解决ContactLabel表不存在的问题
|
||||
# lock.acquire(True)
|
||||
sql = '''
|
||||
SELECT UserName, Alias, Type, Remark, NickName, PYInitial, RemarkPYInitial, ContactHeadImgUrl.smallHeadImgUrl, ContactHeadImgUrl.bigHeadImgUrl,ExTraBuf,"None"
|
||||
FROM Contact
|
||||
INNER JOIN ContactHeadImgUrl ON Contact.UserName = ContactHeadImgUrl.usrName
|
||||
WHERE (Type!=4 AND VerifyFlag=0)
|
||||
AND NickName != ''
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN RemarkPYInitial = '' THEN PYInitial
|
||||
ELSE RemarkPYInitial
|
||||
END ASC
|
||||
'''
|
||||
self.cursor.execute(sql)
|
||||
result = self.cursor.fetchall()
|
||||
finally:
|
||||
lock.release()
|
||||
from app.DataBase import msg_db
|
||||
return msg_db.get_contact(result)
|
||||
|
||||
def get_contact_by_username(self, username: object) -> object:
|
||||
if not self.open_flag:
|
||||
return None
|
||||
try:
|
||||
lock.acquire(True)
|
||||
sql = '''
|
||||
SELECT UserName, Alias, Type, Remark, NickName, PYInitial, RemarkPYInitial, ContactHeadImgUrl.smallHeadImgUrl, ContactHeadImgUrl.bigHeadImgUrl,ExTraBuf,ContactLabel.LabelName
|
||||
FROM Contact
|
||||
INNER JOIN ContactHeadImgUrl ON Contact.UserName = ContactHeadImgUrl.usrName
|
||||
LEFT JOIN ContactLabel ON Contact.LabelIDList = ContactLabel.LabelId
|
||||
WHERE UserName = ?
|
||||
'''
|
||||
self.cursor.execute(sql, [username])
|
||||
result = self.cursor.fetchone()
|
||||
except sqlite3.OperationalError:
|
||||
# 解决ContactLabel表不存在的问题
|
||||
# lock.acquire(True)
|
||||
sql = '''
|
||||
SELECT UserName, Alias, Type, Remark, NickName, PYInitial, RemarkPYInitial, ContactHeadImgUrl.smallHeadImgUrl, ContactHeadImgUrl.bigHeadImgUrl,ExTraBuf,"None"
|
||||
FROM Contact
|
||||
INNER JOIN ContactHeadImgUrl ON Contact.UserName = ContactHeadImgUrl.usrName
|
||||
WHERE UserName = ?
|
||||
'''
|
||||
self.cursor.execute(sql, [username])
|
||||
result = self.cursor.fetchone()
|
||||
finally:
|
||||
lock.release()
|
||||
|
||||
return result
|
||||
|
||||
def get_chatroom_info(self, chatroomname):
|
||||
'''
|
||||
获取群聊信息
|
||||
'''
|
||||
if not self.open_flag:
|
||||
return None
|
||||
try:
|
||||
lock.acquire(True)
|
||||
sql = '''SELECT ChatRoomName, RoomData FROM ChatRoom WHERE ChatRoomName = ?'''
|
||||
self.cursor.execute(sql, [chatroomname])
|
||||
result = self.cursor.fetchone()
|
||||
finally:
|
||||
lock.release()
|
||||
return result
|
||||
|
||||
def close(self):
|
||||
if self.open_flag:
|
||||
try:
|
||||
lock.acquire(True)
|
||||
self.open_flag = False
|
||||
self.DB.close()
|
||||
finally:
|
||||
lock.release()
|
||||
|
||||
def __del__(self):
|
||||
self.close()
|
74
app/DataBase/misc.py
Normal file
@ -0,0 +1,74 @@
|
||||
import os.path
|
||||
import sqlite3
|
||||
import threading
|
||||
|
||||
lock = threading.Lock()
|
||||
DB = None
|
||||
cursor = None
|
||||
db_path = "./app/Database/Msg/Misc.db"
|
||||
|
||||
|
||||
# db_path = './Msg/Misc.db'
|
||||
|
||||
|
||||
def singleton(cls):
|
||||
_instance = {}
|
||||
|
||||
def inner():
|
||||
if cls not in _instance:
|
||||
_instance[cls] = cls()
|
||||
return _instance[cls]
|
||||
|
||||
return inner
|
||||
|
||||
|
||||
@singleton
|
||||
class Misc:
|
||||
def __init__(self):
|
||||
self.DB = None
|
||||
self.cursor = None
|
||||
self.open_flag = False
|
||||
self.init_database()
|
||||
|
||||
def init_database(self):
|
||||
if not self.open_flag:
|
||||
if os.path.exists(db_path):
|
||||
self.DB = sqlite3.connect(db_path, check_same_thread=False)
|
||||
# '''创建游标'''
|
||||
self.cursor = self.DB.cursor()
|
||||
self.open_flag = True
|
||||
if lock.locked():
|
||||
lock.release()
|
||||
|
||||
def get_avatar_buffer(self, userName):
|
||||
if not self.open_flag:
|
||||
return None
|
||||
sql = '''
|
||||
select smallHeadBuf
|
||||
from ContactHeadImg1
|
||||
where usrName=?;
|
||||
'''
|
||||
if not self.open_flag:
|
||||
self.init_database()
|
||||
try:
|
||||
lock.acquire(True)
|
||||
self.cursor.execute(sql, [userName])
|
||||
result = self.cursor.fetchall()
|
||||
if result:
|
||||
return result[0][0]
|
||||
finally:
|
||||
lock.release()
|
||||
return None
|
||||
|
||||
def close(self):
|
||||
if self.open_flag:
|
||||
try:
|
||||
lock.acquire(True)
|
||||
self.open_flag = False
|
||||
self.DB.close()
|
||||
finally:
|
||||
lock.release()
|
||||
|
||||
def __del__(self):
|
||||
self.close()
|
||||
|
100
app/DataBase/msg.py
Normal file
@ -0,0 +1,100 @@
|
||||
import os.path
|
||||
import random
|
||||
import sqlite3
|
||||
import threading
|
||||
import traceback
|
||||
db_path = "./app/Database/Msg/MSG.db"
|
||||
lock = threading.Lock()
|
||||
|
||||
|
||||
def is_database_exist():
|
||||
return os.path.exists(db_path)
|
||||
|
||||
|
||||
def singleton(cls):
|
||||
_instance = {}
|
||||
|
||||
def inner():
|
||||
if cls not in _instance:
|
||||
_instance[cls] = cls()
|
||||
return _instance[cls]
|
||||
|
||||
return inner
|
||||
@singleton
|
||||
class Msg:
|
||||
def __init__(self):
|
||||
self.DB = None
|
||||
self.cursor = None
|
||||
self.open_flag = False
|
||||
self.init_database()
|
||||
|
||||
def init_database(self, path=None):
|
||||
global db_path
|
||||
if not self.open_flag:
|
||||
if path:
|
||||
db_path = path
|
||||
if os.path.exists(db_path):
|
||||
self.DB = sqlite3.connect(db_path, check_same_thread=False)
|
||||
# '''创建游标'''
|
||||
self.cursor = self.DB.cursor()
|
||||
self.open_flag = True
|
||||
if lock.locked():
|
||||
lock.release()
|
||||
|
||||
def get_contact(self, contacts):
|
||||
"""这里查了一遍聊天记录,根据聊天记录最后一条按时间
|
||||
对联系人进行排序
|
||||
"""
|
||||
if not self.open_flag:
|
||||
return None
|
||||
try:
|
||||
lock.acquire(True)
|
||||
sql = '''select StrTalker, MAX(CreateTime) from MSG group by StrTalker'''
|
||||
self.cursor.execute(sql)
|
||||
res = self.cursor.fetchall()
|
||||
finally:
|
||||
lock.release()
|
||||
res = {StrTalker: CreateTime for StrTalker, CreateTime in res}
|
||||
contacts = [list(cur_contact) for cur_contact in contacts]
|
||||
for i, cur_contact in enumerate(contacts):
|
||||
if cur_contact[0] in res:
|
||||
contacts[i].append(res[cur_contact[0]])
|
||||
else:
|
||||
contacts[i].append(0)
|
||||
contacts.sort(key=lambda cur_contact: cur_contact[-1], reverse=True)
|
||||
return contacts
|
||||
|
||||
def get_messages_calendar(self, username_):
|
||||
sql = '''
|
||||
SELECT strftime('%Y-%m-%d',CreateTime,'unixepoch','localtime') as days
|
||||
from (
|
||||
SELECT MsgSvrID, CreateTime
|
||||
FROM MSG
|
||||
WHERE StrTalker = ?
|
||||
ORDER BY CreateTime
|
||||
)
|
||||
group by days
|
||||
'''
|
||||
if not self.open_flag:
|
||||
print('数据库未就绪')
|
||||
return None
|
||||
try:
|
||||
lock.acquire(True)
|
||||
self.cursor.execute(sql, [username_])
|
||||
result = self.cursor.fetchall()
|
||||
finally:
|
||||
lock.release()
|
||||
return [date[0] for date in result]
|
||||
|
||||
def close(self):
|
||||
if self.open_flag:
|
||||
try:
|
||||
lock.acquire(True)
|
||||
self.open_flag = False
|
||||
self.DB.close()
|
||||
finally:
|
||||
lock.release()
|
||||
|
||||
def __del__(self):
|
||||
self.close()
|
||||
|
90
app/DataBase/sns.py
Normal file
@ -0,0 +1,90 @@
|
||||
import os.path
|
||||
import random
|
||||
import sqlite3
|
||||
import threading
|
||||
import traceback
|
||||
from typing import Optional
|
||||
|
||||
db_path = "./app/Database/Msg/Sns.db"
|
||||
lock = threading.Lock()
|
||||
|
||||
|
||||
def is_database_exist():
|
||||
return os.path.exists(db_path)
|
||||
|
||||
|
||||
def singleton(cls):
|
||||
_instance = {}
|
||||
|
||||
def inner():
|
||||
if cls not in _instance:
|
||||
_instance[cls] = cls()
|
||||
return _instance[cls]
|
||||
|
||||
return inner
|
||||
|
||||
@singleton
|
||||
class Sns:
|
||||
def __init__(self):
|
||||
self.DB = None
|
||||
self.cursor = None
|
||||
self.open_flag = False
|
||||
self.init_database()
|
||||
|
||||
def init_database(self, path=None):
|
||||
global db_path
|
||||
if not self.open_flag:
|
||||
if path:
|
||||
db_path = path
|
||||
if os.path.exists(db_path):
|
||||
self.DB = sqlite3.connect(db_path, check_same_thread=False)
|
||||
# '''创建游标'''
|
||||
self.cursor = self.DB.cursor()
|
||||
self.open_flag = True
|
||||
if lock.locked():
|
||||
lock.release()
|
||||
|
||||
def get_messages_in_time(self, start_time, end_time):
|
||||
if not self.open_flag:
|
||||
return None
|
||||
try:
|
||||
lock.acquire(True)
|
||||
sql = '''select UserName, Content from FeedsV20 where CreateTime>=?
|
||||
and CreateTime<=? order by CreateTime desc'''
|
||||
self.cursor.execute(sql, [start_time, end_time])
|
||||
res = self.cursor.fetchall()
|
||||
finally:
|
||||
lock.release()
|
||||
|
||||
return res
|
||||
|
||||
def get_cover_url(self) -> Optional[str]:
|
||||
if not self.open_flag:
|
||||
return None
|
||||
try:
|
||||
lock.acquire(True)
|
||||
sql = '''select StrValue from SnsConfigV20 where Key="6" '''
|
||||
self.cursor.execute(sql)
|
||||
result = self.cursor.fetchall()
|
||||
if result:
|
||||
return result[0][0]
|
||||
finally:
|
||||
lock.release()
|
||||
return None
|
||||
|
||||
|
||||
def close(self):
|
||||
if self.open_flag:
|
||||
try:
|
||||
lock.acquire(True)
|
||||
self.open_flag = False
|
||||
self.DB.close()
|
||||
finally:
|
||||
lock.release()
|
||||
|
||||
def __del__(self):
|
||||
self.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
103
decrypter/db_decrypt.py
Normal file
@ -0,0 +1,103 @@
|
||||
import os
|
||||
import sqlite3
|
||||
import tkinter
|
||||
import traceback
|
||||
|
||||
from pywxdump import decrypt
|
||||
from log import LOG
|
||||
|
||||
|
||||
class DatabaseDecrypter:
|
||||
|
||||
def __init__(self, gui: 'Gui', db_path, key):
|
||||
self.db_path = db_path
|
||||
self.key = key
|
||||
self.gui = gui
|
||||
# 指定需要解密的数据库
|
||||
self.db_list = ["MicroMsg.db", "Misc.db", "MSG.db", "Sns.db"]
|
||||
self.db_list.extend([f"MSG{i}.db" for i in range(0, 50)])
|
||||
|
||||
def merge_databases(self, source_paths, target_path):
|
||||
# 创建目标数据库连接
|
||||
target_conn = sqlite3.connect(target_path)
|
||||
target_cursor = target_conn.cursor()
|
||||
try:
|
||||
# 开始事务
|
||||
target_conn.execute("BEGIN;")
|
||||
for i, source_path in enumerate(source_paths):
|
||||
if not os.path.exists(source_path):
|
||||
continue
|
||||
db = sqlite3.connect(source_path)
|
||||
db.text_factory = str
|
||||
cursor = db.cursor()
|
||||
try:
|
||||
sql = '''
|
||||
SELECT TalkerId,MsgsvrID,Type,SubType,IsSender,CreateTime,Sequence,StrTalker,StrContent,DisplayContent,BytesExtra,CompressContent
|
||||
FROM MSG;
|
||||
'''
|
||||
cursor.execute(sql)
|
||||
result = cursor.fetchall()
|
||||
# 附加源数据库
|
||||
target_cursor.executemany(
|
||||
"INSERT INTO MSG "
|
||||
"(TalkerId,MsgsvrID,Type,SubType,IsSender,CreateTime,Sequence,StrTalker,StrContent,DisplayContent,"
|
||||
"BytesExtra,CompressContent)"
|
||||
"VALUES(?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
result)
|
||||
except:
|
||||
LOG.error(f'{source_path}数据库合并错误:\n{traceback.format_exc()}')
|
||||
cursor.close()
|
||||
db.close()
|
||||
# 提交事务
|
||||
target_conn.execute("COMMIT;")
|
||||
|
||||
except Exception as e:
|
||||
# 发生异常时回滚事务
|
||||
target_conn.execute("ROLLBACK;")
|
||||
raise e
|
||||
|
||||
finally:
|
||||
# 关闭目标数据库连接
|
||||
target_conn.close()
|
||||
|
||||
def decrypt(self):
|
||||
|
||||
output_dir = 'app/DataBase/Msg'
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
tasks = []
|
||||
if os.path.exists(self.db_path):
|
||||
for root, dirs, files in os.walk(self.db_path):
|
||||
for file in files:
|
||||
if '.db' == file[-3:] and file in self.db_list:
|
||||
in_path = os.path.join(root, file)
|
||||
output_path = os.path.join(output_dir, file)
|
||||
tasks.append([self.key, in_path, output_path])
|
||||
for i, task in enumerate(tasks):
|
||||
flag, result = decrypt(*task)
|
||||
if not flag:
|
||||
LOG.error(result)
|
||||
progress = round((i+1) / len(tasks) * 100)
|
||||
self.gui.update_decrypt_progressbar(progress)
|
||||
|
||||
target_database = "app/DataBase/Msg/MSG.db"
|
||||
# 源数据库文件列表
|
||||
source_databases = [f"app/DataBase/Msg/MSG{i}.db" for i in range(0, 50)]
|
||||
import shutil
|
||||
if os.path.exists(target_database):
|
||||
os.remove(target_database)
|
||||
try:
|
||||
shutil.copy2("app/DataBase/Msg/MSG0.db", target_database) # 使用一个数据库文件作为模板
|
||||
except FileNotFoundError:
|
||||
LOG.error(traceback.format_exc())
|
||||
# 合并数据库
|
||||
try:
|
||||
self.merge_databases(source_databases, target_database)
|
||||
except FileNotFoundError:
|
||||
LOG.error(traceback.format_exc())
|
||||
LOG.error("数据库不存在\n请检查微信版本是否为最新")
|
||||
|
||||
# 解密完成 放开下一步按钮
|
||||
self.gui.decrypt_note_text.set("复制成功,请点击下一步")
|
||||
self.gui.next_step_button.config(state=tkinter.NORMAL)
|
||||
|
||||
|
130
decrypter/video_decrypt.py
Normal file
@ -0,0 +1,130 @@
|
||||
import hashlib
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import traceback
|
||||
from datetime import date
|
||||
from pathlib import Path
|
||||
import filetype
|
||||
|
||||
import log
|
||||
|
||||
|
||||
class VideoDecrypter:
|
||||
|
||||
def __init__(self, gui: 'Gui', file_path):
|
||||
self.file_path = file_path
|
||||
self.gui = gui
|
||||
self.sns_cache_path = file_path + "/FileStorage/Sns/Cache"
|
||||
|
||||
@staticmethod
|
||||
def get_ffmpeg_path():
|
||||
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
||||
# 这是到_internal文件夹
|
||||
resource_dir = getattr(sys, '_MEIPASS', os.path.abspath(os.path.dirname(__file__)))
|
||||
# 获取_internal上一级再拼接
|
||||
return os.path.join(os.path.dirname(resource_dir), 'resource', 'ffmpeg.exe')
|
||||
else:
|
||||
return os.path.join(os.getcwd(), 'resource', 'ffmpeg.exe')
|
||||
|
||||
@staticmethod
|
||||
def get_ffprobe_path():
|
||||
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
||||
# 这是到_internal文件夹
|
||||
resource_dir = getattr(sys, '_MEIPASS')
|
||||
# 获取_internal上一级文件夹再拼接
|
||||
return os.path.join(os.path.dirname(resource_dir), 'resource', 'ffprobe.exe')
|
||||
else:
|
||||
return os.path.join(os.getcwd(), 'resource', 'ffprobe.exe')
|
||||
|
||||
@staticmethod
|
||||
def get_output_path(dir_name, md5, duration):
|
||||
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
||||
# 这是到_internal文件夹
|
||||
resource_dir = getattr(sys, '_MEIPASS')
|
||||
# 获取_internal上一级文件夹再拼接
|
||||
return os.path.join(resource_dir, 'output', dir_name, 'videos', f'{md5}_{duration}.mp4')
|
||||
else:
|
||||
return os.path.join(os.getcwd(), 'output', dir_name, 'videos', f'{md5}_{duration}.mp4')
|
||||
|
||||
@staticmethod
|
||||
def calculate_md5(file_path):
|
||||
with open(file_path, "rb") as f:
|
||||
file_content = f.read()
|
||||
return hashlib.md5(file_content).hexdigest()
|
||||
|
||||
@staticmethod
|
||||
def get_all_month_between_dates(start_date, end_date) -> list[str]:
|
||||
result = []
|
||||
current_date = start_date
|
||||
while current_date <= end_date:
|
||||
# 打印当前日期的年份和月份
|
||||
result.append(current_date.strftime("%Y-%m"))
|
||||
year = current_date.year + (current_date.month // 12)
|
||||
month = current_date.month % 12 + 1
|
||||
# 更新current_date到下个月的第一天
|
||||
current_date = date(year, month, 1)
|
||||
return result
|
||||
|
||||
def get_video_duration(self, video_path) ->float:
|
||||
"""获取视频时长"""
|
||||
ffprobe_path = self.get_ffprobe_path()
|
||||
if not os.path.exists(ffprobe_path):
|
||||
log.LOG.error("Wrong ffprobe path:"+ffprobe_path)
|
||||
return 0
|
||||
ffprobe_cmd = f'"{ffprobe_path}" -i "{video_path}" -show_entries format=duration -v quiet -of csv="p=0"'
|
||||
p = subprocess.Popen(
|
||||
ffprobe_cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
shell=True)
|
||||
print(ffprobe_cmd)
|
||||
out, err = p.communicate()
|
||||
if len(str(err, 'gbk')) > 0:
|
||||
print(f"subprocess 执行结果:out:{out} err:{str(err, 'gbk')}")
|
||||
return 0
|
||||
if len(str(out, 'gbk')) == 0:
|
||||
return 0
|
||||
return float(out)
|
||||
|
||||
def decrypt_videos(self, exporter, start_date, end_date, dir_name, convert_video) -> None:
|
||||
"""将视频文件从缓存中复制出来,重命名为{md5}_{duration}.mp4
|
||||
duration单位为秒
|
||||
"""
|
||||
months = self.get_all_month_between_dates(start_date, end_date)
|
||||
|
||||
total_files = 0
|
||||
processed_files = 0
|
||||
for month in months:
|
||||
source_dir = self.sns_cache_path + "/" + month
|
||||
total_files = total_files + len(list(Path(source_dir).rglob('*')))
|
||||
|
||||
for month in months:
|
||||
source_dir = self.sns_cache_path + "/" + month
|
||||
for file in Path(source_dir).rglob('*'):
|
||||
if not exporter.stop_flag:
|
||||
try:
|
||||
file_type = filetype.guess(file.resolve())
|
||||
if file_type and file_type.extension == "mp4":
|
||||
print("Process Video: "+str(file.resolve()))
|
||||
md5 = self.calculate_md5(file.resolve())
|
||||
print("video md5: "+md5)
|
||||
duration = self.get_video_duration(str(file.resolve()))
|
||||
print("video duration: " + str(duration))
|
||||
# 是否需要将视频转码
|
||||
if convert_video:
|
||||
input_path = str(file.resolve())
|
||||
ffmpeg_path = self.get_ffmpeg_path()
|
||||
output_path = self.get_output_path(dir_name, md5, duration)
|
||||
if os.path.exists(ffmpeg_path):
|
||||
cmd = f'''"{ffmpeg_path}" -loglevel quiet -i "{input_path}" -c:v libx264 "{output_path}"'''
|
||||
subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
else:
|
||||
shutil.copy(file.resolve(), f"output/{dir_name}/videos/{md5}_{duration}.mp4")
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
processed_files = processed_files + 1
|
||||
# 前30%的进度作为 处理视频使用
|
||||
progress = round(processed_files / total_files * 30)
|
||||
self.gui.update_export_progressbar(progress)
|
17
entity/contact.py
Normal file
@ -0,0 +1,17 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class Contact:
|
||||
userName: str
|
||||
alias: str
|
||||
type: int
|
||||
remark: str
|
||||
nickName: str
|
||||
pYInitial: str
|
||||
remarkPYInitial: str
|
||||
smallHeadImgUrl: str
|
||||
bigHeadImgUrl: str
|
||||
exTraBuf: str
|
||||
labelName: str
|
||||
latestTalkTime: int
|
119
entity/moment_msg.py
Normal file
@ -0,0 +1,119 @@
|
||||
import json
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional, List
|
||||
from datetime import datetime, timezone, timedelta
|
||||
|
||||
import xmltodict
|
||||
from dataclasses_json import dataclass_json, config
|
||||
|
||||
|
||||
@dataclass_json
|
||||
@dataclass
|
||||
class Location:
|
||||
poiName: str = field(metadata=config(field_name="@poiName"), default="")
|
||||
longitude: str = field(metadata=config(field_name="@longitude"), default="")
|
||||
latitude: str = field(metadata=config(field_name="@latitude"), default="")
|
||||
country: str = field(metadata=config(field_name="@country"), default="")
|
||||
|
||||
|
||||
@dataclass_json
|
||||
@dataclass
|
||||
class Url:
|
||||
type: str = field(metadata=config(field_name="@type"))
|
||||
text: str = field(metadata=config(field_name="#text"), default="")
|
||||
md5: str = field(metadata=config(field_name="@md5"), default="")
|
||||
|
||||
@dataclass_json
|
||||
@dataclass
|
||||
class Thumb:
|
||||
type: str = field(metadata=config(field_name="@type"))
|
||||
text: str = field(metadata=config(field_name="#text"))
|
||||
|
||||
|
||||
@dataclass_json
|
||||
@dataclass
|
||||
class Media:
|
||||
type: Optional[str] = None
|
||||
id: Optional[str] = None
|
||||
url: Optional[Url] | str = None
|
||||
thumb: Optional[Thumb] = None
|
||||
thumbUrl: Optional[str] = None
|
||||
videoDuration: Optional[str] = None
|
||||
|
||||
@dataclass_json
|
||||
@dataclass
|
||||
class MediaList:
|
||||
media: list[Media]
|
||||
|
||||
|
||||
|
||||
@dataclass_json
|
||||
@dataclass
|
||||
class FinderFeed:
|
||||
feedType: Optional[str] = ""
|
||||
nickname: Optional[str] = ""
|
||||
desc: Optional[str] = ""
|
||||
mediaList: Optional[MediaList] = None
|
||||
|
||||
@dataclass_json
|
||||
@dataclass
|
||||
class ContentObject:
|
||||
contentStyle: int
|
||||
contentUrl: Optional[str] = ""
|
||||
title: Optional[str] = ""
|
||||
mediaList: Optional[MediaList] = None
|
||||
# 视频号消息
|
||||
finderFeed: Optional[FinderFeed] = None
|
||||
|
||||
@dataclass_json
|
||||
@dataclass
|
||||
class TimelineObject:
|
||||
username: str
|
||||
location: Location
|
||||
ContentObject: ContentObject
|
||||
createTime: int
|
||||
contentDesc: Optional[str] = ""
|
||||
|
||||
@property
|
||||
def create_date(self):
|
||||
dt = datetime.fromtimestamp(self.createTime, timezone.utc)
|
||||
# 转换为北京时间(UTC+8)
|
||||
beijing_timezone = timezone(timedelta(hours=8))
|
||||
date = dt.astimezone(beijing_timezone).date()
|
||||
return date
|
||||
@property
|
||||
def create_time(self)->str:
|
||||
dt = datetime.fromtimestamp(self.createTime, timezone.utc)
|
||||
# 转换为北京时间(UTC+8)
|
||||
beijing_timezone = timezone(timedelta(hours=8))
|
||||
time_formatted = dt.astimezone(beijing_timezone).strftime('%Y-%m-%d %H:%M:%S')
|
||||
return time_formatted
|
||||
|
||||
|
||||
@dataclass_json
|
||||
@dataclass
|
||||
class MomentMsg:
|
||||
timelineObject: TimelineObject = field(metadata=config(field_name="TimelineObject"))
|
||||
|
||||
|
||||
|
||||
|
||||
def test():
|
||||
|
||||
xml = """
|
||||
"""
|
||||
msg_dict = xmltodict.parse(xml.replace(chr(10), '').replace(chr(9), ''), force_list={'media'})
|
||||
msg_json = json.dumps(msg_dict, sort_keys=False, indent=2)
|
||||
momentMsg = MomentMsg.from_json(msg_json)
|
||||
print(momentMsg)
|
||||
|
||||
def test_time_convert():
|
||||
time = 1706592456
|
||||
dt = datetime.fromtimestamp(time, timezone.utc)
|
||||
# 转换为北京时间(UTC+8)
|
||||
beijing_timezone = timezone(timedelta(hours=8))
|
||||
beijing_time = dt.astimezone(beijing_timezone).strftime('%Y-%m-%d %H:%M:%S')
|
||||
print(beijing_time)
|
||||
|
||||
if __name__ == "__main__":
|
||||
test()
|
28
exporter/avatar_exporter.py
Normal file
@ -0,0 +1,28 @@
|
||||
import io
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
||||
class AvatarExporter:
|
||||
def __init__(self, dir_name: str):
|
||||
self.dir_name = dir_name
|
||||
# 头像是否已保存好 Key: userName value: True/False
|
||||
self._saved_map = {}
|
||||
if not os.path.exists(f'output/{self.dir_name}/avatars/'):
|
||||
os.mkdir(f'output/{self.dir_name}/avatars/')
|
||||
|
||||
def get_avatar_path(self, userName) -> str:
|
||||
if userName in self._saved_map:
|
||||
return f'avatars/{userName}.png'
|
||||
|
||||
from app.DataBase import misc_db
|
||||
blob_data = misc_db.get_avatar_buffer(userName)
|
||||
self._saved_map[userName] = True
|
||||
if blob_data:
|
||||
image = Image.open(io.BytesIO(blob_data))
|
||||
image.save(f'output/{self.dir_name}/avatars/{userName}.png', 'PNG')
|
||||
return f'avatars/{userName}.png'
|
||||
else:
|
||||
return f'icons/empty-avatar.jpg'
|
459
exporter/emoji_exporter.py
Normal file
@ -0,0 +1,459 @@
|
||||
import re
|
||||
|
||||
|
||||
class EmojiExporter:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def replace_emoji(text: str):
|
||||
replacement_rules = [
|
||||
{
|
||||
"pattern": re.compile(r'\[微笑\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_1@2x.png" id="微笑" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[发呆\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_4@2x.png" id="发呆" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[撇嘴\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_2@2x.png" id="撇嘴" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[色\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_3@2x.png" id="色" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[发呆\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_4@2x.png" id="发呆" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[得意\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_5@2x.png" id="得意" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[流泪\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_6@2x.png" id="流泪" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[害羞\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_7@2x.png" id="害羞" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[闭嘴\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_8@2x.png" id="闭嘴" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[睡\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_9@2x.png" id="睡" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[大哭\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_10@2x.png" id="大哭" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[尴尬\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_11@2x.png" id="尴尬" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[发怒\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_12@2x.png" id="发怒" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[调皮\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_13@2x.png" id="调皮" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[呲牙\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_14@2x.png" id="呲牙" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[惊讶\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_15@2x.png" id="惊讶" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[难过\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_16@2x.png" id="难过" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[抓狂\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_19@2x.png" id="抓狂" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[吐\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_20@2x.png" id="吐" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[偷笑\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_21@2x.png" id="偷笑" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[愉快\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_22@2x.png" id="愉快" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[白眼\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_23@2x.png" id="白 眼" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[傲慢\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_24@2x.png" id="傲慢" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[困\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_26@2x.png" id="困" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[惊恐\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_27@2x.png" id="惊恐" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[憨笑\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_29@2x.png" id="憨笑" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[悠闲\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_30@2x.png" id="悠闲" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[咒骂\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_32@2x.png" id="咒骂" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[疑问\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_33@2x.png" id="疑问" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[嘘\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_34@2x.png" id="嘘" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[晕\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_35@2x.png" id="晕" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[衰\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_37@2x.png" id="衰" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[骷髅\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_38@2x.png" id="骷髅" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[敲打\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_39@2x.png" id="敲打" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[再见\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_40@2x.png" id="再见" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[擦汗\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_41@2x.png" id="擦汗" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[抠鼻\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_42@2x.png" id="抠鼻" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[鼓掌\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_43@2x.png" id="鼓掌" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[坏笑\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_45@2x.png" id="坏笑" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[右哼哼\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_47@2x.png" id="右哼哼" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[鄙视\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_49@2x.png" id="鄙视" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[委屈\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_50@2x.png" id="委屈" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[快哭了\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_51@2x.png" id="快哭了" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[阴险\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_52@2x.png" id="阴险" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[亲亲\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_53@2x.png" id="亲亲" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[可怜\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_55@2x.png" id="可怜" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[Whimper\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_55@2x.png" id="可怜" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[笑脸\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Happy.png" id="笑脸" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[生病\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Sick.png" id="生病" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[脸红\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Flushed.png" id="脸红" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[破涕为笑\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Lol.png" id="破涕为笑" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[恐惧\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Terror.png" id="恐惧" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[失望\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/LetDown.png" id="失望" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[无语\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Duh.png" id="无语" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[嘿哈\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_04.png" id="嘿哈" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[捂脸\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_05.png" id="捂脸" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[奸笑\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_02.png" id="奸笑" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[机智\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_06.png" id="机智" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[皱眉\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_12.png" id="皱眉" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[耶\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_11.png" id="耶" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[吃瓜\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Watermelon.png" id="吃瓜" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[加油\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Addoil.png" id="加油" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[汗\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Sweat.png" id="汗" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[天啊\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Shocked.png" id="天啊" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[Emm\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Cold.png" id="Emm" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[社会社会\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Social.png" id="社会社会" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[旺柴\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Yellowdog.png" id="旺柴" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[好的\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/NoProb.png" id="好的" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[打脸\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Slap.png" id="打脸" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[哇\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Wow.png" id="哇" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[翻白眼\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Boring.png" id="翻白眼" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[666\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/666.png" id="666" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[让我看看\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/LetMeSee.png" id="让我看看" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[叹气\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Sigh.png" id="叹气" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[苦涩\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Hurt.png" id="苦涩" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[難受\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Hurt.png" id="苦涩" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[裂开\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Broken.png" id="裂开" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[嘴唇\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_66@2x.png" id="嘴唇" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[爱心\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_67@2x.png" id="爱心" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[心碎\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_68@2x.png" id="心碎" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[拥抱\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_79@2x.png" id="拥抱" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[强\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_80@2x.png" id="强" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[弱\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_81@2x.png" id="弱" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[握手\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_82@2x.png" id="握手" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[胜利\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_83@2x.png" id="胜利" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[抱拳\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_84@2x.png" id="抱拳" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[勾引\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_85@2x.png" id="勾引" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[拳头\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_86@2x.png" id="拳头" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[OK\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_90@2x.png" id="OK" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[合十\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Worship.png" id="合十" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[啤酒\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_58@2x.png" id="啤酒" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[咖啡]\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_61@2x.png" id="咖啡" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[蛋糕\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_69@2x.png" id="蛋糕" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[玫瑰\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_64@2x.png" id="玫 瑰" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[凋谢\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_65@2x.png" id="凋谢" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[菜刀\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_56@2x.png" id="菜刀" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[炸弹\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_71@2x.png" id="炸弹" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[便便\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_75@2x.png" id="便便" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[月亮\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_76@2x.png" id="月亮" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[太阳\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_77@2x.png" id="太阳" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[庆 祝\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Party.png" id="庆祝" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[礼物\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_78@2x.png" id="礼物" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[红包\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_09.png" id="红包" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[發\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_16.png" id="發" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[福\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_15.png" id="福" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[烟花\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Fireworks.png" id="烟花" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[爆竹\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Firecracker.png" id="爆竹" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[猪头\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_63@2x.png" id="猪头" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[跳跳\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_93@2x.png" id="跳跳" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[发抖\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_94@2x.png" id="发抖" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
"pattern": re.compile(r'\[转圈\]'),
|
||||
"replacement": '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_96@2x.png" id="转圈" class="emoji_img">'
|
||||
}]
|
||||
|
||||
for rule in replacement_rules:
|
||||
pattern = rule.get("pattern")
|
||||
text = re.sub(pattern, rule.get("replacement"), text)
|
||||
return text
|
199
exporter/html_exporter.py
Normal file
@ -0,0 +1,199 @@
|
||||
import datetime
|
||||
import json
|
||||
import shutil
|
||||
import threading
|
||||
import time
|
||||
|
||||
import xmltodict
|
||||
|
||||
from entity.contact import Contact
|
||||
from exporter.avatar_exporter import AvatarExporter
|
||||
from exporter.emoji_exporter import EmojiExporter
|
||||
from exporter.image_exporter import ImageExporter
|
||||
from exporter.video_exporter import VideoExporter
|
||||
from log import LOG
|
||||
from entity.moment_msg import MomentMsg
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def get_img_div_css(size: int) -> str:
|
||||
if size == 1:
|
||||
return 'width:10rem; overflow:hidden'
|
||||
else:
|
||||
return 'width:19rem; overflow:hidden'
|
||||
|
||||
|
||||
def get_img_css(size: int) -> str:
|
||||
"""object-fit: cover; 预览图居中裁剪
|
||||
cursor:pointer; 手形鼠标
|
||||
"""
|
||||
img_style = "object-fit:cover;cursor:pointer;"
|
||||
if size == 1:
|
||||
return f'width:10rem;height:10rem;{img_style}'
|
||||
elif size == 2:
|
||||
return f'width:8rem;height:8rem;float:left;margin-bottom:0.2rem;margin-right:0.2rem;{img_style}'
|
||||
elif size == 4:
|
||||
return f'width:8rem;height:8rem;float:left;margin-bottom:0.2rem;margin-right:0.2rem;{img_style}'
|
||||
else:
|
||||
return f'width:5rem;height:5rem;float:left;margin-bottom:0.2rem;margin-right:0.2rem;{img_style}'
|
||||
|
||||
|
||||
class HtmlExporter(threading.Thread):
|
||||
|
||||
def __init__(self, gui: 'Gui', dir_name: str, contacts_map: dict[str, Contact], begin_date: datetime.date,
|
||||
end_date: datetime.date, download_pic: int, convert_video: int):
|
||||
self.dir_name = dir_name
|
||||
if Path(f"output/{self.dir_name}").exists():
|
||||
shutil.rmtree(f"output/{self.dir_name}")
|
||||
shutil.copytree("resource/template/", f"output/{self.dir_name}")
|
||||
|
||||
self.gui = gui
|
||||
self.avatar_exporter = AvatarExporter(dir_name)
|
||||
self.image_exporter = ImageExporter(dir_name)
|
||||
self.video_exporter = VideoExporter(dir_name)
|
||||
self.html_head = None
|
||||
self.html_end = None
|
||||
self.file = None
|
||||
self.contacts_map = contacts_map
|
||||
self.begin_date = begin_date
|
||||
self.end_date = end_date
|
||||
self.download_pic = download_pic
|
||||
self.convert_video = convert_video
|
||||
self.stop_flag = False
|
||||
super().__init__()
|
||||
|
||||
def run(self) -> None:
|
||||
|
||||
with open(f"resource/template.html", encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
self.html_head, self.html_end = content.split('/*内容分割线*/')
|
||||
self.file = open(f"output/{self.dir_name}/index.html", 'w', encoding='utf-8')
|
||||
|
||||
if self.gui.account_info and self.gui.account_info.get('wxid'):
|
||||
self.avatar_exporter.get_avatar_path(self.gui.account_info.get('wxid'))
|
||||
self.html_head = self.html_head.replace("{my_wxid}", f"{self.gui.account_info.get('wxid')}")
|
||||
from app.DataBase import micro_msg_db
|
||||
my_info = micro_msg_db.get_contact_by_username(self.gui.account_info.get('wxid'))
|
||||
self.html_head = self.html_head.replace("{my_name}", f"{my_info[4]}")
|
||||
|
||||
from app.DataBase import sns_db
|
||||
cover_url = sns_db.get_cover_url()
|
||||
if cover_url:
|
||||
cover_path = self.image_exporter.save_image(cover_url, 'image')
|
||||
self.html_head = self.html_head.replace("{cover_path}", cover_path)
|
||||
|
||||
self.file.write(self.html_head)
|
||||
# 加一天
|
||||
end_date = self.end_date + datetime.timedelta(days=1)
|
||||
begin_time = time.mktime(datetime.datetime(self.begin_date.year, self.begin_date.month, self.begin_date.day).timetuple())
|
||||
end_time = time.mktime(datetime.datetime(end_date.year, end_date.month, end_date.day).timetuple())
|
||||
|
||||
self.gui.video_decrypter.decrypt_videos(self, self.begin_date, end_date, self.dir_name, self.convert_video)
|
||||
|
||||
|
||||
message_datas = sns_db.get_messages_in_time(begin_time, end_time)
|
||||
for index, message_data in enumerate(message_datas):
|
||||
if not self.stop_flag:
|
||||
if message_data[0] in self.contacts_map:
|
||||
self.export_msg(message_data[1], self.contacts_map, self.download_pic)
|
||||
# 更新进度条 前30%视频处理 后70%其他处理
|
||||
progress = round(index / len(message_datas) * 70)
|
||||
self.gui.update_export_progressbar(30 + progress)
|
||||
self.gui.update_export_progressbar(100)
|
||||
self.finish_file()
|
||||
self.gui.export_succeed()
|
||||
|
||||
def stop(self) -> None:
|
||||
self.stop_flag = True
|
||||
|
||||
def export_msg(self, message: str, contacts_map: dict[str, Contact], download_pic: int) -> None:
|
||||
|
||||
LOG.info(message)
|
||||
# force_list: 强制要求转media为list
|
||||
msg_dict = xmltodict.parse(message, force_list={'media'})
|
||||
msg_json = json.dumps(msg_dict)
|
||||
msg = MomentMsg.from_json(msg_json)
|
||||
|
||||
# 微信ID
|
||||
username = msg.timelineObject.username
|
||||
# 头像路径
|
||||
avatar_path = self.avatar_exporter.get_avatar_path(username)
|
||||
|
||||
contact = contacts_map.get(username)
|
||||
# 备注, 或用户名
|
||||
remark = contact.remark if contact.remark else contact.nickName
|
||||
|
||||
# 朋友圈图片
|
||||
images = self.image_exporter.get_images(msg, download_pic)
|
||||
|
||||
# 朋友圈视频
|
||||
videos = self.video_exporter.get_videos(msg)
|
||||
|
||||
# 样式 3:链接样式
|
||||
content_style = msg.timelineObject.ContentObject.contentStyle
|
||||
|
||||
html = ' <div class="row item">\n'
|
||||
html += ' <div class="col-xs-2">\n'
|
||||
html += ' <div class="logo01_box">\n'
|
||||
html += f' <img src="{avatar_path}" />\n'
|
||||
html += ' </div>\n'
|
||||
html += ' </div>\n'
|
||||
html += ' <div class="col-xs-10 xs8">\n'
|
||||
html += ' <div class="towp">\n'
|
||||
html += f' <p class="p1">{remark}</p>\n'
|
||||
if msg.timelineObject.contentDesc:
|
||||
content_desc = msg.timelineObject.contentDesc.replace("\n", "<br>")
|
||||
content_desc = EmojiExporter.replace_emoji(content_desc)
|
||||
html += f' <p class="p2">{content_desc}</p>\n'
|
||||
html += ' </div>\n'
|
||||
|
||||
# 超链接
|
||||
if content_style == 3:
|
||||
html += f' <a href="{msg.timelineObject.ContentObject.contentUrl}" target="_blank">\n'
|
||||
html += ' <div class ="out_link" >\n'
|
||||
if images:
|
||||
thumb_path, image_path = images[0]
|
||||
html += f' <img src = "{thumb_path}"/>\n'
|
||||
html += f' <div class ="text" >{msg.timelineObject.ContentObject.title}</div>\n'
|
||||
html += ' </div >\n'
|
||||
html += ' </a>\n'
|
||||
# 视频号
|
||||
elif msg.timelineObject.ContentObject.finderFeed:
|
||||
html += f' <div style="width:10rem; overflow:hidden">\n'
|
||||
# 视频号图片
|
||||
thumb_path = self.image_exporter.get_finder_images(msg)
|
||||
html += f' <img src="{thumb_path}" onclick="openWarningOverlay(event)" style="width:10rem;height:10rem;object-fit:cover;cursor:pointer;"/>\n'
|
||||
html += ' </div>\n'
|
||||
|
||||
# 视频号说明
|
||||
html += ' <div class="texts_box">\n'
|
||||
nickname = msg.timelineObject.ContentObject.finderFeed.nickname
|
||||
desc = msg.timelineObject.ContentObject.finderFeed.desc
|
||||
html += f' <p class="location">视频号 · {nickname} · {desc}</p>\n'
|
||||
html += ' </div>\n'
|
||||
# 普通朋友圈
|
||||
else:
|
||||
html += f' <div style="{get_img_div_css(len(images))}">\n'
|
||||
for thumb_path, image_path in images:
|
||||
html += f' <img src="{thumb_path}" full_img="{image_path}" onclick="openFullSize(event)" style="{get_img_css(len(images))}"/>\n'
|
||||
html += ' </div>\n'
|
||||
|
||||
html += ' <div>\n'
|
||||
for video_path in videos:
|
||||
html += f' <video controls height="500">\n'
|
||||
html += f' <source src="{video_path}" type="video/mp4">\n'
|
||||
html += f' <video>\n'
|
||||
html += ' </div>\n'
|
||||
|
||||
html += ' <div class="texts_box">\n'
|
||||
if msg.timelineObject.location and msg.timelineObject.location.poiName:
|
||||
html += f' <p class="location">{msg.timelineObject.location.poiName}</p>\n'
|
||||
html += f' <p class="time">{msg.timelineObject.create_time}</p>\n'
|
||||
html += ' </div>\n'
|
||||
html += ' </div>\n'
|
||||
html += '</div>\n'
|
||||
self.file.write(html)
|
||||
|
||||
def finish_file(self):
|
||||
self.file.write(self.html_end)
|
||||
self.file.close()
|
65
exporter/image_exporter.py
Normal file
@ -0,0 +1,65 @@
|
||||
import os
|
||||
import re
|
||||
from typing import Tuple, Optional
|
||||
|
||||
from entity.moment_msg import MomentMsg, Media
|
||||
import requests
|
||||
import uuid
|
||||
|
||||
|
||||
class ImageExporter:
|
||||
def __init__(self, dir_name: str):
|
||||
self.dir_name = dir_name
|
||||
if not os.path.exists(f'output/{self.dir_name}/thumbs/'):
|
||||
os.mkdir(f'output/{self.dir_name}/thumbs/')
|
||||
if not os.path.exists(f'output/{self.dir_name}/images/'):
|
||||
os.mkdir(f'output/{self.dir_name}/images/')
|
||||
|
||||
def save_image(self, url: str, img_type: str) -> str:
|
||||
""" 下载图片
|
||||
"""
|
||||
if not (img_type == 'image' or img_type == 'thumb'):
|
||||
raise Exception("img_type 参数非法")
|
||||
file_name = uuid.uuid4()
|
||||
response = requests.get(url)
|
||||
if response.ok:
|
||||
with open(f'output/{self.dir_name}/{img_type}s/{file_name}.jpg', 'wb') as file:
|
||||
file.write(response.content)
|
||||
return f'{img_type}s/{file_name}.jpg'
|
||||
|
||||
def get_images(self, msg: MomentMsg, download_pic: int) -> list[Tuple]:
|
||||
""" 获取一条朋友圈的全部图像, 返回值是一个元组列表
|
||||
[(缩略图路径,原图路径),(缩略图路径,原图路径)]
|
||||
"""
|
||||
results = []
|
||||
if not msg.timelineObject.ContentObject.mediaList:
|
||||
return results
|
||||
|
||||
media = msg.timelineObject.ContentObject.mediaList.media
|
||||
for media_item in media:
|
||||
if media_item.type == "2":
|
||||
if download_pic:
|
||||
thumb_path = self.save_image(media_item.thumb.text, 'thumb')
|
||||
image_path = self.save_image(media_item.url.text, 'image')
|
||||
else:
|
||||
thumb_path = media_item.thumb.text
|
||||
image_path = media_item.url.text
|
||||
if thumb_path and image_path:
|
||||
results.append((thumb_path, image_path))
|
||||
|
||||
return results
|
||||
|
||||
def get_finder_images(self, msg: MomentMsg) -> Optional[str]:
|
||||
""" 获取视频号的封面图
|
||||
"""
|
||||
results = None
|
||||
if not msg.timelineObject.ContentObject.finderFeed:
|
||||
return results
|
||||
|
||||
if not msg.timelineObject.ContentObject.finderFeed.mediaList:
|
||||
return results
|
||||
|
||||
media = msg.timelineObject.ContentObject.finderFeed.mediaList.media
|
||||
for media_item in media:
|
||||
thumb_path = self.save_image(media_item.thumbUrl, 'thumb')
|
||||
return thumb_path
|
65
exporter/video_exporter.py
Normal file
@ -0,0 +1,65 @@
|
||||
import math
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
from entity.moment_msg import MomentMsg, Media
|
||||
|
||||
|
||||
class VideoExporter:
|
||||
def __init__(self, dir_name):
|
||||
self.dir_name = dir_name
|
||||
if not os.path.exists(f'output/{self.dir_name}/videos/'):
|
||||
os.mkdir(f'output/{self.dir_name}/videos/')
|
||||
|
||||
|
||||
def find_video_by_md5(self, md5):
|
||||
"""
|
||||
使用MD5匹配视频
|
||||
"""
|
||||
folder_path = Path(f'output/{self.dir_name}/videos/')
|
||||
pattern = re.compile(r'^(.*?)(?=_)')
|
||||
|
||||
for file_path in folder_path.iterdir():
|
||||
match = pattern.search(file_path.name)
|
||||
if match:
|
||||
filename_md5 = match.group()
|
||||
if filename_md5 == md5:
|
||||
return file_path.name
|
||||
|
||||
def find_video_by_duration(self, duration):
|
||||
"""
|
||||
使用视频时长匹配视频
|
||||
"""
|
||||
folder_path = Path(f'output/{self.dir_name}/videos/')
|
||||
pattern = re.compile(r'_([0-9.]+)\.mp4')
|
||||
|
||||
for file_path in folder_path.iterdir():
|
||||
match = pattern.search(file_path.name)
|
||||
if match:
|
||||
filename_duration = float(match.group(1))
|
||||
if math.isclose(filename_duration, duration, abs_tol=0.005):
|
||||
return file_path.name
|
||||
|
||||
def get_videos(self, msg: MomentMsg) -> list[str]:
|
||||
""" 获取一条朋友圈的全部视频, 返回值是一个文件路径列表
|
||||
"""
|
||||
results = []
|
||||
if not msg.timelineObject.ContentObject.mediaList:
|
||||
return results
|
||||
|
||||
media = msg.timelineObject.ContentObject.mediaList.media
|
||||
for media_item in media:
|
||||
if media_item.type == "6":
|
||||
duration = media_item.videoDuration
|
||||
rounded_duration = round(float(duration), 2)
|
||||
# 先用MD5匹配缓存中的视频
|
||||
# 如果找不到使用视频时长再次匹配
|
||||
video = self.find_video_by_md5(media_item.url.md5)
|
||||
if video:
|
||||
results.append(f'videos/{video}')
|
||||
else:
|
||||
video = self.find_video_by_duration(rounded_duration)
|
||||
if video:
|
||||
results.append(f'videos/{video}')
|
||||
|
||||
return results
|
0
gui/__init__.py
Normal file
52
gui/auto_scroll_guide.py
Normal file
@ -0,0 +1,52 @@
|
||||
import tkinter
|
||||
import tkinter.ttk
|
||||
|
||||
import win32gui
|
||||
|
||||
from entity.contact import Contact
|
||||
from helper.auto_scroll import AutoScroll
|
||||
|
||||
|
||||
class AutoScrollGuide:
|
||||
|
||||
def __init__(self, root):
|
||||
self.flood_moments_note = None
|
||||
self.auto_thread = None
|
||||
self.frame = tkinter.LabelFrame(root)
|
||||
|
||||
self.open_moments_guide = tkinter.Label(self.frame, text="请打开朋友圈窗口")
|
||||
self.open_moments_guide.pack()
|
||||
|
||||
image = tkinter.PhotoImage(file='resource/gui_pictures/open_moments_guide.png')
|
||||
self.open_moments_guide_image = tkinter.Label(self.frame, image=image)
|
||||
self.open_moments_guide_image.image = image
|
||||
self.open_moments_guide_image.pack()
|
||||
|
||||
self.auto_scroll_button_text = tkinter.StringVar()
|
||||
self.auto_scroll_button_text.set("开始")
|
||||
|
||||
self.auto_scroll_button = tkinter.ttk.Button(self.frame, textvariable=self.auto_scroll_button_text,
|
||||
command=self.switch_auto_scroll)
|
||||
self.auto_scroll_button.pack(pady=5)
|
||||
|
||||
def switch_auto_scroll(self):
|
||||
|
||||
if self.auto_thread is None:
|
||||
moments_hwnd = win32gui.FindWindow("SnsWnd", '朋友圈')
|
||||
if moments_hwnd != 0:
|
||||
self.auto_thread = AutoScroll(self, moments_hwnd)
|
||||
self.flood_moments_note = tkinter.Label(self.frame, text="正在自动读取朋友圈数据......."
|
||||
"\n可将窗口最小化,后台自动执行"
|
||||
"\n可随时查看进度,可随时停止")
|
||||
self.flood_moments_note.pack()
|
||||
self.auto_thread.start()
|
||||
self.auto_scroll_button_text.set("停止")
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
if self.auto_thread.scrolling:
|
||||
self.auto_scroll_button_text.set("继续")
|
||||
self.auto_thread.set_scrolling(False)
|
||||
else:
|
||||
self.auto_scroll_button_text.set("停止")
|
||||
self.auto_thread.set_scrolling(True)
|
74
gui/auto_scrolls_single_guide.py
Normal file
@ -0,0 +1,74 @@
|
||||
import time
|
||||
import tkinter
|
||||
import tkinter.ttk
|
||||
|
||||
import win32con
|
||||
import win32gui
|
||||
|
||||
from helper.auto_scroll_single import AutoScrollSingle
|
||||
|
||||
|
||||
class AutoScrollSingleGuide:
|
||||
|
||||
def __init__(self, root):
|
||||
self.working_note = None
|
||||
self.auto_thread = None
|
||||
self.frame = tkinter.LabelFrame(root)
|
||||
|
||||
self.guide = tkinter.Label(self.frame, text="请打开搜一搜窗口\n点击开始后不要操作键鼠")
|
||||
self.guide.pack()
|
||||
|
||||
self.search_username = tkinter.Entry(self.frame, width=12)
|
||||
self.search_username.insert(0, '请输入好友昵称')
|
||||
self.search_username.config(fg='grey')
|
||||
self.search_username.bind('<FocusIn>', self.on_search_username_click)
|
||||
self.search_username.pack()
|
||||
|
||||
image = tkinter.PhotoImage(file='resource/gui_pictures/open_search_guide.png')
|
||||
self.guide_image = tkinter.Label(self.frame, image=image)
|
||||
self.guide_image.image = image
|
||||
self.guide_image.pack()
|
||||
|
||||
self.button_text = tkinter.StringVar()
|
||||
self.button_text.set("开始")
|
||||
|
||||
self.button = tkinter.ttk.Button(self.frame, textvariable=self.button_text,
|
||||
command=self.switch_auto_scroll_single)
|
||||
self.button.pack(pady=5)
|
||||
|
||||
def on_search_username_click(self, event):
|
||||
if self.search_username.get() == '请输入好友昵称':
|
||||
self.search_username.delete(0, tkinter.END)
|
||||
self.search_username.config(fg='black')
|
||||
|
||||
def switch_auto_scroll_single(self):
|
||||
|
||||
search_hwnd = win32gui.FindWindow('Chrome_WidgetWin_0', '微信')
|
||||
wechat_hwnd = win32gui.FindWindow('WeChatMainWndForPC', '微信')
|
||||
|
||||
search_username = self.search_username.get()
|
||||
|
||||
if self.auto_thread is None:
|
||||
if search_username == '请输入好友昵称' or search_username == '':
|
||||
self.search_username.config(fg='red')
|
||||
return
|
||||
if search_hwnd != 0 and wechat_hwnd != 0:
|
||||
|
||||
self.auto_thread = AutoScrollSingle(self, search_hwnd, search_username)
|
||||
self.working_note = tkinter.Label(self.frame, text="正在自动读取朋友圈数据......."
|
||||
"\n请不要遮挡搜一搜窗口")
|
||||
|
||||
|
||||
self.working_note.pack()
|
||||
self.auto_thread.start()
|
||||
self.button_text.set("停止")
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
if self.auto_thread.scrolling:
|
||||
self.button_text.set("开始")
|
||||
self.auto_thread.set_scrolling(False)
|
||||
self.auto_thread = None
|
||||
else:
|
||||
self.button_text.set("停止")
|
||||
self.switch_auto_scroll_single()
|
304
gui/gui.py
Normal file
@ -0,0 +1,304 @@
|
||||
import os
|
||||
import threading
|
||||
import tkinter
|
||||
import tkinter.font
|
||||
import tkinter.ttk
|
||||
from datetime import datetime, timedelta
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from time import sleep
|
||||
import tkcalendar
|
||||
from pywxdump import read_info
|
||||
from decrypter.db_decrypt import DatabaseDecrypter
|
||||
from decrypter.video_decrypt import VideoDecrypter
|
||||
from gui.auto_scroll_guide import AutoScrollGuide
|
||||
from gui.auto_scrolls_single_guide import AutoScrollSingleGuide
|
||||
from gui.tool_tip import ToolTip
|
||||
from entity.contact import Contact
|
||||
from exporter.html_exporter import HtmlExporter
|
||||
from gui.listbox_with_search import ListboxWithSearch
|
||||
|
||||
|
||||
class Gui:
|
||||
def __init__(self):
|
||||
|
||||
self.restart_note1 = None
|
||||
self.restart_note2 = None
|
||||
self.auto_scroll_single_guide = None
|
||||
self.auto_scroll_guide = None
|
||||
self.auto_scroll_frame = None
|
||||
self.search_username = None
|
||||
self.open_search_guide_image = None
|
||||
self.open_search_guide = None
|
||||
self.auto_scroll_button_single = None
|
||||
self.auto_scroll_button_single_text = None
|
||||
self.convert_video = None
|
||||
self.convert_video_var = None
|
||||
self.html_exporter_thread = None
|
||||
self.confirm_button_text = None
|
||||
self.succeed_label_2 = None
|
||||
self.succeed_label = None
|
||||
self.download_pic_var = Optional[tkinter.IntVar]
|
||||
self.download_pic = None
|
||||
self.auto_scroll_button_text = None
|
||||
self.warning_label = None
|
||||
self.root = None
|
||||
self.waiting_label = None
|
||||
self.listbox = None
|
||||
self.begin_calendar = None
|
||||
self.end_calendar = None
|
||||
self.end_calendar_label = None
|
||||
self.begin_calendar_label = None
|
||||
self.confirm_button = None
|
||||
self.decrypt_progressbar = None
|
||||
self.export_progressbar = None
|
||||
self.next_step_button = None
|
||||
self.decrypter = None
|
||||
self.auto_scroll_button = None
|
||||
self.auto_scrolling_thread = None
|
||||
self.decrypt_note = None
|
||||
self.decrypt_note_text = None
|
||||
self.account_info = None
|
||||
self.video_decrypter = None
|
||||
self.export_dir_name = None
|
||||
self.exporting = False
|
||||
# 1: 自动滚动数据 2: 解密数据库 3: 导出
|
||||
self.page_stage = 1
|
||||
|
||||
def run_gui(self):
|
||||
self.root = tkinter.Tk()
|
||||
self.root.geometry('650x650')
|
||||
self.root.title('朋友圈导出')
|
||||
|
||||
self.waiting_label = tkinter.ttk.Label(self.root, text="正在连接微信....",
|
||||
font=("微软雅黑", 16), anchor='center')
|
||||
self.waiting_label.place(relx=0.5, rely=0.05, anchor='center')
|
||||
|
||||
self.root.mainloop()
|
||||
|
||||
def wechat_logged_in(self, account_info):
|
||||
|
||||
self.account_info = account_info
|
||||
self.waiting_label.config(text="微信已登录")
|
||||
|
||||
self.auto_scroll_button_text = tkinter.StringVar()
|
||||
self.auto_scroll_button_text.set("读取全部朋友")
|
||||
self.auto_scroll_button = tkinter.ttk.Button(self.root, textvariable=self.auto_scroll_button_text,
|
||||
command=self.open_auto_scroll_guide)
|
||||
self.auto_scroll_button.place(relx=0.35, rely=0.15, anchor='center')
|
||||
|
||||
self.auto_scroll_button_single_text = tkinter.StringVar()
|
||||
self.auto_scroll_button_single_text.set("读取单个朋友")
|
||||
self.auto_scroll_button_single = tkinter.ttk.Button(self.root, textvariable=self.auto_scroll_button_single_text,
|
||||
command=self.switch_auto_scroll_single)
|
||||
self.auto_scroll_button_single.place(relx=0.655, rely=0.15, anchor='center')
|
||||
|
||||
self.next_step_button = tkinter.ttk.Button(self.root, text="下一步", command=self.next_step)
|
||||
self.next_step_button.place(relx=0.65, rely=0.8)
|
||||
|
||||
|
||||
|
||||
def open_auto_scroll_guide(self):
|
||||
|
||||
if self.auto_scroll_single_guide and self.auto_scroll_single_guide.frame:
|
||||
self.auto_scroll_single_guide.frame.place_forget()
|
||||
|
||||
self.auto_scroll_guide = AutoScrollGuide(self.root)
|
||||
self.auto_scroll_guide.frame.place(relx=0.5, rely=0.5, anchor='center')
|
||||
|
||||
def switch_auto_scroll_single(self):
|
||||
|
||||
if self.auto_scroll_guide and self.auto_scroll_guide.frame:
|
||||
self.auto_scroll_guide.frame.place_forget()
|
||||
|
||||
self.auto_scroll_single_guide = AutoScrollSingleGuide(self.root)
|
||||
self.auto_scroll_single_guide.frame.place(relx=0.5, rely=0.5, anchor='center')
|
||||
|
||||
|
||||
def next_step(self):
|
||||
|
||||
if self.page_stage == 1:
|
||||
|
||||
if self.auto_scroll_guide and self.auto_scroll_guide.auto_thread:
|
||||
self.auto_scroll_guide.auto_thread.set_scrolling(False)
|
||||
|
||||
if self.auto_scroll_single_guide and self.auto_scroll_single_guide.auto_thread:
|
||||
self.auto_scroll_guide.auto_thread.set_scrolling(False)
|
||||
|
||||
self.auto_scroll_button.place_forget()
|
||||
self.auto_scroll_button_single.place_forget()
|
||||
|
||||
if self.auto_scroll_guide and self.auto_scroll_guide.frame:
|
||||
self.auto_scroll_guide.frame.place_forget()
|
||||
|
||||
if self.auto_scroll_single_guide and self.auto_scroll_single_guide.frame:
|
||||
self.auto_scroll_single_guide.frame.place_forget()
|
||||
|
||||
self.restart_note1 = tkinter.Label(self.root, text="请关闭微信客户端", fg="red")
|
||||
self.restart_note1.place(relx=0.5, rely=0.2, anchor='center')
|
||||
self.restart_note2 = tkinter.Label(self.root, text="然后点击下一步")
|
||||
self.restart_note2.place(relx=0.5, rely=0.3, anchor='center')
|
||||
|
||||
if self.page_stage == 2:
|
||||
|
||||
self.restart_note1.place_forget()
|
||||
self.restart_note2.place_forget()
|
||||
self.waiting_label.place_forget()
|
||||
|
||||
self.decrypter = DatabaseDecrypter(self, self.account_info.get("filePath"), self.account_info.get("key"))
|
||||
|
||||
self.decrypt_note_text = tkinter.StringVar()
|
||||
self.decrypt_note_text.set("正在复制数据.....")
|
||||
|
||||
self.decrypt_note = tkinter.Label(self.root, textvariable=self.decrypt_note_text)
|
||||
self.decrypt_note.place(relx=0.5, rely=0.2, anchor='center')
|
||||
self.decrypt_progressbar = tkinter.ttk.Progressbar(self.root)
|
||||
self.decrypt_progressbar.place(relx=0.5, rely=0.3, anchor='center')
|
||||
|
||||
# 进度值最大值
|
||||
self.decrypt_progressbar['maximum'] = 100
|
||||
# 进度值初始值
|
||||
self.decrypt_progressbar['value'] = 0
|
||||
# 解密过程禁用下一步按钮
|
||||
self.next_step_button.config(state=tkinter.DISABLED)
|
||||
self.decrypter.decrypt()
|
||||
if self.page_stage == 3:
|
||||
self.decrypt_note.place_forget()
|
||||
self.decrypt_progressbar.place_forget()
|
||||
self.init_export_page()
|
||||
# 不再有下一步按钮
|
||||
self.next_step_button.place_forget()
|
||||
# 初始化视频导出器
|
||||
self.video_decrypter = VideoDecrypter(self, self.account_info.get("filePath"))
|
||||
|
||||
self.page_stage = self.page_stage + 1
|
||||
|
||||
def init_export_page(self):
|
||||
|
||||
from app.DataBase import micro_msg_db
|
||||
contact_datas = micro_msg_db.get_contact()
|
||||
|
||||
contacts = []
|
||||
for c in contact_datas:
|
||||
contact = Contact(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11])
|
||||
contacts.append(contact)
|
||||
|
||||
def validate_contact(this_contact: Contact):
|
||||
c_type = this_contact.type
|
||||
user_name: str = this_contact.userName
|
||||
|
||||
# 不是其他号码
|
||||
is_misc_account = c_type == 1 or c_type == 33 or c_type == 513
|
||||
# 不是公众号
|
||||
is_gh_account = user_name.startswith("gh_")
|
||||
# 不是聊天群
|
||||
is_chatroom = user_name.endswith("@chatroom")
|
||||
# 不是文件传输助手
|
||||
is_filehelper = this_contact.userName == "filehelper"
|
||||
return (not is_misc_account) and (not is_gh_account) and (not is_chatroom) and (not is_filehelper)
|
||||
|
||||
filtered = filter(validate_contact, contacts)
|
||||
contacts = list(filtered)
|
||||
|
||||
self.listbox = ListboxWithSearch(self.root, contacts)
|
||||
self.listbox.frame.place(relx=0.05, rely=0.03)
|
||||
|
||||
self.begin_calendar_label = tkinter.ttk.Label(text="开始日期")
|
||||
self.begin_calendar_label.place(relx=0.65, rely=0.15)
|
||||
|
||||
# 默认开始时间是100天前
|
||||
current_date = datetime.now()
|
||||
half_year_ago = current_date - timedelta(days=100)
|
||||
self.begin_calendar = tkcalendar.DateEntry(master=self.root, locale="zh_CN", year=half_year_ago.year,
|
||||
month=half_year_ago.month, day=half_year_ago.day,
|
||||
maxdate=datetime.now())
|
||||
self.begin_calendar.place(relx=0.65, rely=0.2)
|
||||
|
||||
self.end_calendar_label = tkinter.ttk.Label(text="截止日期")
|
||||
self.end_calendar_label.place(relx=0.65, rely=0.25)
|
||||
self.end_calendar = tkcalendar.DateEntry(master=self.root, locale="zh_CN", maxdate=datetime.now())
|
||||
self.end_calendar.place(relx=0.65, rely=0.3)
|
||||
|
||||
self.download_pic_var = tkinter.IntVar(value=0)
|
||||
self.download_pic = tkinter.ttk.Checkbutton(self.root, text='下载图片', variable=self.download_pic_var)
|
||||
self.download_pic.place(relx=0.65, rely=0.4)
|
||||
ToolTip(self.download_pic, "将图片下载到电脑上,网页\n可离线查看,导出速度变慢")
|
||||
|
||||
self.convert_video_var = tkinter.IntVar(value=0)
|
||||
self.convert_video = tkinter.ttk.Checkbutton(self.root, text='视频转码', variable=self.convert_video_var)
|
||||
self.convert_video.place(relx=0.65, rely=0.45)
|
||||
ToolTip(self.convert_video,
|
||||
"视频原始格式为H265,只支持\nChrome浏览器播放,勾选后\n将视频转码为H264,支持大\n部分浏览器,但导出速度变慢")
|
||||
|
||||
self.confirm_button_text = tkinter.StringVar()
|
||||
self.confirm_button_text.set("开始导出")
|
||||
|
||||
self.confirm_button = tkinter.ttk.Button(self.root, textvariable=self.confirm_button_text,
|
||||
command=self.confirm_export)
|
||||
self.confirm_button.place(relx=0.65, rely=0.6)
|
||||
|
||||
# 导出成功的提示
|
||||
self.succeed_label = tkinter.Label(self.root, text="导出结束")
|
||||
self.succeed_label_2 = tkinter.Label(self.root, text="打开文件夹", fg="#0000FF", cursor="hand2")
|
||||
self.succeed_label_2.bind("<Button-1>", self.open_target_folder)
|
||||
|
||||
# 进度条
|
||||
self.export_progressbar = tkinter.ttk.Progressbar(self.root, length=150)
|
||||
|
||||
def confirm_export(self):
|
||||
|
||||
if self.html_exporter_thread and not self.html_exporter_thread.stop_flag:
|
||||
self.html_exporter_thread.stop()
|
||||
else:
|
||||
if not self.warning_label:
|
||||
self.warning_label = tkinter.Label(self.root, fg="red")
|
||||
self.warning_label.place(relx=0.65, rely=0.55)
|
||||
|
||||
self.warning_label.config(text="")
|
||||
contacts = self.listbox.get_contacts()
|
||||
if not contacts:
|
||||
self.warning_label.config(text=f"请选择至少一个联系人")
|
||||
return
|
||||
|
||||
if self.begin_calendar.get_date() > self.end_calendar.get_date():
|
||||
self.warning_label.config(text=f"开始时间必须小于截止时间")
|
||||
return
|
||||
|
||||
self.export_progressbar.place(relx=0.64, rely=0.68)
|
||||
# 进度值最大值
|
||||
self.export_progressbar['maximum'] = 100
|
||||
# 进度值初始值
|
||||
self.export_progressbar['value'] = 0
|
||||
|
||||
current_time = datetime.now()
|
||||
self.export_dir_name = current_time.strftime("%Y_%m_%d_%H%M%S")
|
||||
contact_map = {contact.userName: contact for contact in contacts}
|
||||
|
||||
self.confirm_button_text.set("停止导出")
|
||||
self.succeed_label.place_forget()
|
||||
self.succeed_label_2.place_forget()
|
||||
|
||||
# 导出线程
|
||||
self.html_exporter_thread = HtmlExporter(self, self.export_dir_name, contact_map,
|
||||
self.begin_calendar.get_date(), self.end_calendar.get_date(),
|
||||
self.download_pic_var.get(), self.convert_video_var.get())
|
||||
self.html_exporter_thread.start()
|
||||
|
||||
def update_decrypt_progressbar(self, progress):
|
||||
self.decrypt_progressbar['value'] = progress
|
||||
self.root.update()
|
||||
|
||||
def update_export_progressbar(self, progress):
|
||||
self.export_progressbar['value'] = progress
|
||||
self.root.update()
|
||||
|
||||
def export_succeed(self):
|
||||
self.confirm_button_text.set("开始导出")
|
||||
self.succeed_label.place(relx=0.64, rely=0.75)
|
||||
self.succeed_label_2.place(relx=0.76, rely=0.75)
|
||||
|
||||
def open_target_folder(self, event):
|
||||
folder_path = Path(f"output/{self.export_dir_name}/")
|
||||
# 转换为绝对路径
|
||||
absolute_path = folder_path.resolve()
|
||||
os.startfile(absolute_path)
|
80
gui/listbox_with_search.py
Normal file
@ -0,0 +1,80 @@
|
||||
import tkinter as tk
|
||||
from entity.contact import Contact
|
||||
|
||||
|
||||
class ListboxWithSearch:
|
||||
|
||||
def __init__(self, root, contacts: list[Contact]):
|
||||
|
||||
# key index(在控件里的编号) value Contact
|
||||
self.index_contact_map = {}
|
||||
|
||||
self.frame = tk.LabelFrame(root, text="请选择导出联系人")
|
||||
self.tool_frame = tk.Frame(self.frame)
|
||||
self.tool_frame.pack()
|
||||
|
||||
self.search_label = tk.Label(self.tool_frame, text="搜索:")
|
||||
self.search_label.pack(side='left')
|
||||
|
||||
self.re = tk.Entry(self.tool_frame, width=10)
|
||||
self.re.pack(side='left')
|
||||
self.re.bind("<KeyRelease>", self.filter)
|
||||
|
||||
self.select_all_button = tk.Button(self.tool_frame, text="全选", command=self.select_all)
|
||||
self.select_all_button.pack(side='left', padx="10")
|
||||
|
||||
self.invert_select_button = tk.Button(self.tool_frame, text="反选", command=self.invert_select)
|
||||
self.invert_select_button.pack(side='left', padx="2")
|
||||
|
||||
self.scrollbar = tk.Scrollbar(self.frame)
|
||||
self.scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
|
||||
|
||||
self.lb = tk.Listbox(self.frame, selectmode='multiple', height=20, width=30, exportselection=False,
|
||||
yscrollcommand=self.scrollbar.set)
|
||||
self.scrollbar.config(command=self.lb.yview)
|
||||
|
||||
self.lb.bind('<<ListboxSelect>>', self.on_select)
|
||||
|
||||
self.lb.pack()
|
||||
self.contacts = contacts
|
||||
|
||||
|
||||
for index, contact in enumerate(contacts):
|
||||
text = f'{contact.nickName}({contact.remark})' if contact.remark else f'{contact.nickName}'
|
||||
self.lb.insert(index, text)
|
||||
self.index_contact_map[index] = contact
|
||||
|
||||
def select_all(self, event=None):
|
||||
for index in self.index_contact_map.keys():
|
||||
self.lb.select_set(index)
|
||||
self.on_select()
|
||||
|
||||
def on_select(self, event=None):
|
||||
selection = self.lb.curselection()
|
||||
self.frame.config(text=f"已选择{len(selection)}个联系人")
|
||||
|
||||
def invert_select(self, event=None):
|
||||
"""反选"""
|
||||
selected = self.lb.curselection()
|
||||
for index in self.index_contact_map.keys():
|
||||
if index in selected:
|
||||
self.lb.selection_clear(index)
|
||||
else:
|
||||
self.lb.select_set(index)
|
||||
self.on_select()
|
||||
|
||||
def get_contacts(self, event=None):
|
||||
contacts = []
|
||||
selected = self.lb.curselection()
|
||||
for index in selected:
|
||||
contacts.append(self.index_contact_map.get(index))
|
||||
return contacts
|
||||
|
||||
def filter(self, event=None):
|
||||
p = self.re.get()
|
||||
if p:
|
||||
for index, contact in self.index_contact_map.items():
|
||||
text = f'{contact.nickName}({contact.remark})' if contact.remark else f'{contact.nickName}'
|
||||
if p in text:
|
||||
self.lb.yview(index)
|
||||
break
|
26
gui/tool_tip.py
Normal file
@ -0,0 +1,26 @@
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
|
||||
class ToolTip:
|
||||
def __init__(self, widget, text):
|
||||
self.widget = widget
|
||||
self.text = text
|
||||
self.tooltip = None
|
||||
self.widget.bind("<Enter>", self.show_tooltip)
|
||||
self.widget.bind("<Leave>", self.hide_tooltip)
|
||||
|
||||
def show_tooltip(self, event=None):
|
||||
x = y = 0
|
||||
x, y, _, _ = self.widget.bbox("insert")
|
||||
x += self.widget.winfo_rootx() + 25
|
||||
y += self.widget.winfo_rooty() + 25
|
||||
self.tooltip = tk.Toplevel(self.widget)
|
||||
self.tooltip.wm_overrideredirect(True)
|
||||
self.tooltip.wm_geometry(f"+{x}+{y}")
|
||||
label = tk.Label(self.tooltip, text=self.text, background="#ffffe0", relief="solid", borderwidth=1)
|
||||
label.pack(ipadx=1)
|
||||
|
||||
def hide_tooltip(self, event=None):
|
||||
if self.tooltip:
|
||||
self.tooltip.destroy()
|
||||
self.tooltip = None
|
42
helper/auto_scroll.py
Normal file
@ -0,0 +1,42 @@
|
||||
import random
|
||||
import time
|
||||
import threading
|
||||
import pywintypes
|
||||
import win32api
|
||||
import win32con
|
||||
import win32gui
|
||||
|
||||
|
||||
class AutoScroll(threading.Thread):
|
||||
|
||||
def __init__(self, gui, moments_hwnd):
|
||||
self.gui = gui
|
||||
self.moments_hwnd = moments_hwnd
|
||||
self.scrolling = False
|
||||
super().__init__()
|
||||
|
||||
def run(self) -> None:
|
||||
self.scrolling = True
|
||||
while True:
|
||||
if self.scrolling:
|
||||
try:
|
||||
rect = win32gui.GetWindowRect(self.moments_hwnd)
|
||||
x = (rect[0] + rect[2]) // 2
|
||||
y = (rect[1] + rect[3]) // 2
|
||||
notch = 10
|
||||
win32api.SendMessage(self.moments_hwnd, win32con.WM_MOUSEWHEEL,
|
||||
win32api.MAKELONG(0, -120 * notch), win32api.MAKELONG(x, y))
|
||||
|
||||
self.gui.flood_moments_note.pack()
|
||||
random_sleep = random.uniform(0.7, 0.8)
|
||||
time.sleep(random_sleep)
|
||||
except pywintypes.error as e:
|
||||
self.moments_hwnd = win32gui.FindWindow("SnsWnd", '朋友圈')
|
||||
self.gui.flood_moments_note.pack_forget()
|
||||
time.sleep(1)
|
||||
else:
|
||||
self.gui.flood_moments_note.pack_forget()
|
||||
time.sleep(1)
|
||||
|
||||
def set_scrolling(self, scrolling: bool) -> None:
|
||||
self.scrolling = scrolling
|
199
helper/auto_scroll_single.py
Normal file
@ -0,0 +1,199 @@
|
||||
import math
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import pyautogui
|
||||
import pyperclip
|
||||
import win32con
|
||||
import win32gui
|
||||
from retry import retry
|
||||
from win32api import GetSystemMetrics
|
||||
|
||||
import log
|
||||
|
||||
|
||||
class AutoScrollSingle(threading.Thread):
|
||||
|
||||
def __init__(self, gui, search_hwnd, friend_name):
|
||||
self.gui = gui
|
||||
self.search_hwnd = search_hwnd
|
||||
self.friend_name = friend_name
|
||||
self.scrolling = False
|
||||
self.resolutions = ['', '1920', '1600', '2560_125', '2560_175', '2560_100', '1366']
|
||||
super().__init__()
|
||||
|
||||
@retry(tries=5, delay=2)
|
||||
def find_moments_tab(self):
|
||||
result = None
|
||||
for resolution in self.resolutions:
|
||||
try:
|
||||
result = pyautogui.locateCenterOnScreen(f'resource/auto_gui/{resolution}/moments_tab.png',
|
||||
grayscale=True, confidence=0.8)
|
||||
break
|
||||
except Exception as e:
|
||||
log.LOG.warn("Can't find_moments_tab in resolution: " + resolution)
|
||||
pass
|
||||
|
||||
if result is None:
|
||||
raise Exception("Can 't find_moments_tab")
|
||||
|
||||
return result
|
||||
|
||||
@retry(tries=5, delay=2)
|
||||
def find_search_button(self):
|
||||
|
||||
element = None
|
||||
for resolution in self.resolutions:
|
||||
try:
|
||||
element = pyautogui.locateOnScreen(f'resource/auto_gui/{resolution}/search_button.png',
|
||||
grayscale=True, confidence=0.8)
|
||||
break
|
||||
except Exception as e:
|
||||
log.LOG.warn("Can't find_moments_tab in resolution: " + resolution)
|
||||
pass
|
||||
|
||||
if element is None:
|
||||
raise Exception("Can 't search_button")
|
||||
|
||||
return element
|
||||
|
||||
@retry(tries=5, delay=2)
|
||||
def find_friends(self):
|
||||
result = None
|
||||
|
||||
for resolution in self.resolutions:
|
||||
try:
|
||||
result = pyautogui.locateCenterOnScreen(f'resource/auto_gui/{resolution}/friends.png',
|
||||
grayscale=True, confidence=0.8)
|
||||
break
|
||||
except Exception as e:
|
||||
log.LOG.warn("Can't find_friends in resolution: " + resolution)
|
||||
pass
|
||||
|
||||
if result is None:
|
||||
raise Exception("Can 't find_friends")
|
||||
|
||||
return result
|
||||
|
||||
@retry(tries=5, delay=2)
|
||||
def find_complete(self):
|
||||
|
||||
result = None
|
||||
|
||||
for resolution in self.resolutions:
|
||||
try:
|
||||
result = pyautogui.locateCenterOnScreen(f'resource/auto_gui/{resolution}/complete.png',
|
||||
grayscale=True, confidence=0.8)
|
||||
break
|
||||
except Exception as e:
|
||||
log.LOG.warn("Can't find_complete in resolution: " + resolution)
|
||||
pass
|
||||
|
||||
if result is None:
|
||||
raise Exception("Can 't find_complete")
|
||||
|
||||
return result
|
||||
|
||||
def run(self) -> None:
|
||||
self.scrolling = True
|
||||
|
||||
try:
|
||||
search_hwnd = win32gui.FindWindow('Chrome_WidgetWin_0', '微信')
|
||||
wechat_hwnd = win32gui.FindWindow('WeChatMainWndForPC', '微信')
|
||||
|
||||
# 先把微信主窗口放置前台
|
||||
win32gui.SetForegroundWindow(wechat_hwnd)
|
||||
win32gui.ShowWindow(wechat_hwnd, win32con.SW_SHOWNORMAL)
|
||||
win32gui.SetWindowPos(wechat_hwnd, None, 100, 100, 0, 0, win32con.SWP_NOSIZE)
|
||||
time.sleep(0.3)
|
||||
# 先把搜一搜窗口放前台
|
||||
win32gui.SetForegroundWindow(search_hwnd)
|
||||
win32gui.ShowWindow(search_hwnd, win32con.SW_SHOWNORMAL)
|
||||
win32gui.SetWindowPos(search_hwnd, None, 50, 50, 0, 0, win32con.SWP_NOSIZE)
|
||||
|
||||
|
||||
# 点击朋友圈三个字
|
||||
x, y = self.find_moments_tab()
|
||||
pyautogui.click(x, y)
|
||||
time.sleep(0.1)
|
||||
|
||||
# 点击搜索按钮左侧
|
||||
element = self.find_search_button()
|
||||
pyautogui.click(element.left - 100, element.top + element.height / 2)
|
||||
time.sleep(0.25)
|
||||
|
||||
# 输入字符
|
||||
pyautogui.write('1')
|
||||
time.sleep(0.25)
|
||||
|
||||
# 搜索
|
||||
pyautogui.click(element.left + element.width / 2, element.top + element.height / 2)
|
||||
time.sleep(1.5)
|
||||
|
||||
# 展开朋友
|
||||
x, y = self.find_friends()
|
||||
pyautogui.click(x, y)
|
||||
time.sleep(0.5)
|
||||
|
||||
# 搜索好友
|
||||
pyperclip.copy(self.friend_name)
|
||||
time.sleep(0.25)
|
||||
pyautogui.hotkey('ctrl', 'v')
|
||||
time.sleep(0.5)
|
||||
|
||||
# 回车
|
||||
pyautogui.press('enter')
|
||||
time.sleep(0.5)
|
||||
|
||||
# 点击完成
|
||||
x, y = self.find_complete()
|
||||
pyautogui.click(x, y)
|
||||
time.sleep(0.25)
|
||||
|
||||
# 点击搜索按钮左侧
|
||||
element = self.find_search_button()
|
||||
pyautogui.click(element.left - 100, element.top + element.height / 2)
|
||||
time.sleep(0.25)
|
||||
|
||||
pyautogui.press('backspace')
|
||||
time.sleep(0.1)
|
||||
pyautogui.press('backspace')
|
||||
time.sleep(0.25)
|
||||
pyperclip.copy('?')
|
||||
time.sleep(0.25)
|
||||
pyautogui.hotkey('ctrl', 'v')
|
||||
time.sleep(0.25)
|
||||
|
||||
|
||||
|
||||
element = self.find_search_button()
|
||||
pyautogui.click(element.left + element.width / 2, element.top + element.height / 2)
|
||||
time.sleep(1.0)
|
||||
|
||||
while self.scrolling:
|
||||
|
||||
element = self.find_search_button()
|
||||
right_bottom = (element.left + element.width, element.top + element.height + 300)
|
||||
pyautogui.scroll(-120)
|
||||
pyautogui.click(right_bottom)
|
||||
time.sleep(0.2)
|
||||
|
||||
search_hwnd = win32gui.FindWindow('Chrome_WidgetWin_0', '微信')
|
||||
moments_hwnd = win32gui.FindWindow('SnsWnd', '朋友圈')
|
||||
|
||||
if search_hwnd and moments_hwnd:
|
||||
# 调整位置朋友圈不要遮挡
|
||||
width = GetSystemMetrics(0)
|
||||
win32gui.SetWindowPos(moments_hwnd, None, 50, 50, 0, 0, win32con.SWP_NOSIZE)
|
||||
win32gui.SetWindowPos(search_hwnd, None, 50, 50, 0, 0, win32con.SWP_NOSIZE)
|
||||
|
||||
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
|
||||
def set_scrolling(self, scrolling: bool) -> None:
|
||||
self.scrolling = scrolling
|
||||
if not self.scrolling:
|
||||
self.gui.working_note.pack_forget()
|
||||
if self.scrolling and self.gui.working_note:
|
||||
self.gui.working_note.pack()
|
27
log.py
Normal file
@ -0,0 +1,27 @@
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
filename = time.strftime("%Y-%m-%d", time.localtime(time.time()))
|
||||
|
||||
try:
|
||||
if not os.path.exists('log'):
|
||||
os.mkdir('log')
|
||||
log_file = f'log/{filename}-log.log'
|
||||
console_file = f'log/{filename}-output.log'
|
||||
except:
|
||||
log_file = f'{filename}-log.log'
|
||||
console_file = f'{filename}-output.log'
|
||||
|
||||
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
||||
# pyinstaller 输出日志到文件
|
||||
f = open(console_file, 'a')
|
||||
sys.stdout = f
|
||||
sys.stderr = f
|
||||
|
||||
file_handler = logging.FileHandler(log_file, encoding='utf-8')
|
||||
logging.basicConfig(level='DEBUG', format="%(asctime)s [%(levelname)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
|
||||
logging.getLogger().addHandler(file_handler)
|
||||
LOG = logging.getLogger("WechatMoments")
|
||||
|
34
main.py
Normal file
@ -0,0 +1,34 @@
|
||||
import threading
|
||||
import tkinter
|
||||
import traceback
|
||||
from time import sleep
|
||||
from pywxdump import read_info
|
||||
|
||||
def main():
|
||||
from gui.gui import Gui
|
||||
|
||||
gui = Gui()
|
||||
gui_thread = threading.Thread(target=gui.run_gui)
|
||||
gui_thread.start()
|
||||
|
||||
info = ""
|
||||
while True:
|
||||
try:
|
||||
info = read_info(None, is_logging=True)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
# 如果解密失败,读取到报错信息
|
||||
if isinstance(info, str):
|
||||
gui.waiting_label.config(text="请启动微信....")
|
||||
sleep(0.5)
|
||||
elif isinstance(info, list) and info[0].get("key") == "None":
|
||||
gui.waiting_label.config(text="请登陆微信....")
|
||||
sleep(0.5)
|
||||
else:
|
||||
break
|
||||
|
||||
gui.wechat_logged_in(info[0])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
46
main.spec
Normal file
@ -0,0 +1,46 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['main.py'],
|
||||
pathex=[],
|
||||
binaries=[],
|
||||
hiddenimports=['babel.numbers'],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
noarchive=False,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
[],
|
||||
exclude_binaries=True,
|
||||
name='wechat_moments',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
console=False,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None
|
||||
)
|
||||
coll = COLLECT(
|
||||
exe,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
name='wechat_moments',
|
||||
)
|
||||
|
||||
# 将资源文件夹拷贝出来
|
||||
import shutil
|
||||
shutil.copytree('resource', f'{DISTPATH}/wechat_moments/resource')
|
11
requirements.txt
Normal file
@ -0,0 +1,11 @@
|
||||
pywxdump~=2.4.44
|
||||
xmltodict~=0.13.0
|
||||
dataclasses_json
|
||||
pillow~=10.2.0
|
||||
tkcalendar~=1.6.1
|
||||
pywin32
|
||||
requests~=2.31.0
|
||||
fileType
|
||||
pyautogui
|
||||
opencv-python
|
||||
retry
|
BIN
resource/auto_gui/1366/complete.png
Normal file
After Width: | Height: | Size: 651 B |
BIN
resource/auto_gui/1366/friends.png
Normal file
After Width: | Height: | Size: 668 B |
BIN
resource/auto_gui/1366/moments_tab.png
Normal file
After Width: | Height: | Size: 809 B |
BIN
resource/auto_gui/1366/search_button.png
Normal file
After Width: | Height: | Size: 674 B |
BIN
resource/auto_gui/1600/complete.png
Normal file
After Width: | Height: | Size: 641 B |
BIN
resource/auto_gui/1600/friends.png
Normal file
After Width: | Height: | Size: 678 B |
BIN
resource/auto_gui/1600/moments_tab.png
Normal file
After Width: | Height: | Size: 795 B |
BIN
resource/auto_gui/1600/search_button.png
Normal file
After Width: | Height: | Size: 692 B |
BIN
resource/auto_gui/1920/complete.png
Normal file
After Width: | Height: | Size: 754 B |
BIN
resource/auto_gui/1920/friends.png
Normal file
After Width: | Height: | Size: 796 B |
BIN
resource/auto_gui/1920/moments_tab.png
Normal file
After Width: | Height: | Size: 986 B |
BIN
resource/auto_gui/1920/search_button.png
Normal file
After Width: | Height: | Size: 875 B |
BIN
resource/auto_gui/2560_100/complete.png
Normal file
After Width: | Height: | Size: 676 B |
BIN
resource/auto_gui/2560_100/friends.png
Normal file
After Width: | Height: | Size: 831 B |
BIN
resource/auto_gui/2560_100/moments_tab.png
Normal file
After Width: | Height: | Size: 811 B |
BIN
resource/auto_gui/2560_100/search_button.png
Normal file
After Width: | Height: | Size: 693 B |
BIN
resource/auto_gui/2560_125/complete.png
Normal file
After Width: | Height: | Size: 771 B |
BIN
resource/auto_gui/2560_125/friends.png
Normal file
After Width: | Height: | Size: 831 B |
BIN
resource/auto_gui/2560_125/moments_tab.png
Normal file
After Width: | Height: | Size: 1018 B |
BIN
resource/auto_gui/2560_125/search_button.png
Normal file
After Width: | Height: | Size: 965 B |
BIN
resource/auto_gui/2560_175/complete.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
resource/auto_gui/2560_175/friends.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
resource/auto_gui/2560_175/moments_tab.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
resource/auto_gui/2560_175/search_button.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
resource/auto_gui/complete.png
Normal file
After Width: | Height: | Size: 897 B |
BIN
resource/auto_gui/friends.png
Normal file
After Width: | Height: | Size: 930 B |
BIN
resource/auto_gui/moments_tab.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
resource/auto_gui/search_button.png
Normal file
After Width: | Height: | Size: 950 B |
BIN
resource/ffmpeg.exe
Normal file
BIN
resource/ffprobe.exe
Normal file
BIN
resource/gui_pictures/open_moments_guide -原始.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
resource/gui_pictures/open_moments_guide.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
resource/gui_pictures/open_search_guide-原始.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
resource/gui_pictures/open_search_guide.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
71
resource/template.html
Normal file
@ -0,0 +1,71 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="css/index.css"/>
|
||||
</head>
|
||||
<script>
|
||||
function openFullSize(event) {
|
||||
document.getElementById('fullSizeImage').src = event.target.getAttribute('full_img');
|
||||
document.getElementById('fullSizeOverlay').style.display = "block";
|
||||
}
|
||||
|
||||
function closeFullSize(event) {
|
||||
if (event.target.id !== 'fullSizeImage') {
|
||||
document.getElementById('fullSizeOverlay').style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function openWarningOverlay(event) {
|
||||
document.getElementById('warningOverlay').style.display = "block";
|
||||
}
|
||||
|
||||
function closeWarningOverlay(event) {
|
||||
document.getElementById('warningOverlay').style.display = "none";
|
||||
}
|
||||
|
||||
</script>
|
||||
<body >
|
||||
<div id="fullSizeOverlay" style="display:none;" onclick="closeFullSize(event)">
|
||||
<img id="fullSizeImage" src="" alt="Full Size Image"/>
|
||||
</div>
|
||||
|
||||
<div id="warningOverlay" style="display:none;">
|
||||
<label>
|
||||
<div class="alert info" onclick="closeWarningOverlay(event)">
|
||||
<span class="alertClose"> X </span>
|
||||
<span class="alertText">
|
||||
视频号请到微信搜索观看
|
||||
<br class="clear"/>
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="col-xs-12 text-center">
|
||||
朋友圈
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cover_container">
|
||||
<img src="{cover_path}" class="cover_img"/>
|
||||
<div class="avatar">
|
||||
<h4>{my_name}</h4>
|
||||
<div class="usr_img_box">
|
||||
<img src="avatars/{my_wxid}.png" class="user_logo">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text_box">
|
||||
/*内容分割线*/
|
||||
<p class="end">已显示全部内容</p>
|
||||
</div>
|
||||
</body>
|
||||
<script src="js/jquery-2.1.1.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="js/index.js" type="text/javascript" charset="utf-8"></script>
|
||||
</html>
|
5
resource/template/css/bootstrap.min.css
vendored
Normal file
162
resource/template/css/index.css
Normal file
@ -0,0 +1,162 @@
|
||||
*{margin: 0;padding: 0;}
|
||||
|
||||
|
||||
@media screen and (max-width:414px ) {
|
||||
html{font-size:8px ;}
|
||||
}
|
||||
@media screen and (min-width:415px ) and (max-width:878px) {
|
||||
html{font-size:16px ;}
|
||||
}
|
||||
@media screen and (min-width:879px ){
|
||||
html{font-size:24px ;}
|
||||
}
|
||||
|
||||
P{margin-bottom:0.4rem;}
|
||||
|
||||
.header{
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
width:100% ;
|
||||
background-color: #EDEDED;
|
||||
color:black;
|
||||
overflow: hidden;
|
||||
font-size:1rem ;
|
||||
padding:0.2rem 0;
|
||||
position:fixed;
|
||||
z-index:100;
|
||||
}
|
||||
|
||||
body {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
|
||||
.cover_container .cover_img{
|
||||
width:100%;
|
||||
height:25rem;
|
||||
object-fit:cover
|
||||
}
|
||||
|
||||
.cover_container{
|
||||
position: relative;
|
||||
padding-top:0.2rem;
|
||||
}
|
||||
|
||||
.avatar{height: 3.2rem;position: absolute ;bottom: -1rem;right: 0.8rem;}
|
||||
.avatar h4{float:left ;color:#FFFFFF;margin-top:1rem ;font-size:1rem ;margin-right:1rem ; text-shadow:1px 1px 0 #000 ;}
|
||||
.usr_img_box{width:3rem ;height:3rem ;overflow: hidden;border-radius:0.3rem;}
|
||||
.user_logo{width:100%;height: 100%;}
|
||||
|
||||
.text_box{width:100% ;overflow: hidden;}
|
||||
.logo01_box{width:2.5rem ;height:2.5rem ;overflow: hidden;border-radius:0.3rem;}
|
||||
.logo01_box img{width:100% ;height: 100%;}
|
||||
.item{border-bottom:1px solid whitesmoke ;margin-top:1rem ;}
|
||||
.p1{font-size:0.9rem ;color:#2e4f7a ;font-weight: bold;}
|
||||
.p2{font-size:0.8rem ;color:#000000 ;width:95% ;}
|
||||
.logo01_box{margin-left:0.5rem ;}
|
||||
.xs8{padding-left:0.8rem ;}
|
||||
|
||||
.out_link {background-color:#F7F7F7 ;font-size:0.7rem ;width:95% ;color:#41454D ;overflow: hidden; cursor:pointer;}
|
||||
.out_link img{width:2.5rem ;height:2.5rem ;margin:0.5rem 0.5rem ;float: left;}
|
||||
|
||||
.text{float: left;margin-top: 1.1rem;width:80% ;}
|
||||
.pl{margin-top:0.5rem ;font-size:0.6rem ;color:#80858c ;clear: both;}
|
||||
.pl span{display:inline-block ;width:2rem ;}
|
||||
|
||||
.pls{width:100% ;overflow:hidden ;color: #41454D;font-size:0.8rem ;}
|
||||
.pls span{color:#5BAFFF ;}
|
||||
.pls p{width:95% ;}
|
||||
|
||||
.text_02{margin-top: 0.9rem;}
|
||||
.dele{display: inline-block;margin-left:2rem ;width:1rem ;height: auto;cursor:pointer ;}
|
||||
.up .down{color:#ACB1B7;font-size:0.6rem ;cursor:pointer ;}
|
||||
.pls img{width:1rem ;height:auto ;}
|
||||
.end{text-align:center ;margin:0.6rem 0 1rem 0 ;font-size:0.9rem ;color:#ACB1B7 ;}
|
||||
|
||||
|
||||
#fullSizeOverlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
z-index: 9999;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#fullSizeImage {
|
||||
max-width: 85%;
|
||||
max-height: 85%;
|
||||
margin-top: 3%;
|
||||
}
|
||||
|
||||
.time{font-size:0.6rem ;color:#ACB1B7 ;margin-top:0.5rem ;}
|
||||
.location{font-size:0.6rem ;color:#2e4f7a;margin-top:0.5rem ;}
|
||||
|
||||
.emoji_img {
|
||||
max-width: 1.0rem;
|
||||
max-height: 1.0rem;
|
||||
padding-bottom: 0.15rem;
|
||||
}
|
||||
|
||||
.alert {
|
||||
position: relative;
|
||||
top: 10;
|
||||
left: 0;
|
||||
width: auto;
|
||||
height: auto;
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
line-height: 1.8;
|
||||
border-radius: 5px;
|
||||
cursor: hand;
|
||||
cursor: pointer;
|
||||
font-family: sans-serif;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.alertCheckbox {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:checked + .alert {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.alertText {
|
||||
display: table;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.alertClose {
|
||||
float: right;
|
||||
padding-left: 10px;
|
||||
font-size: 16px;
|
||||
margin-bottom:15px;
|
||||
}
|
||||
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.info {
|
||||
background-color: #EEE;
|
||||
border: 1px solid #DDD;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
#warningOverlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 70%;
|
||||
left: 30%;
|
||||
width: 40%;
|
||||
z-index: 9999;
|
||||
text-align: center;
|
||||
}
|
18
resource/template/icons/comment-downarrow.svg
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="12px" height="7px" viewBox="0 0 12 7" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 39 (31667) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>enter-arrow</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="发现" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="02-发现-车友圈" transform="translate(-165.000000, -804.000000)" fill="#ACB1B7">
|
||||
<g id="content" transform="translate(0.000000, 290.000000)">
|
||||
<g id="示例2" transform="translate(16.000000, 246.000000)">
|
||||
<g id="enter-arrow" transform="translate(155.000000, 271.500000) rotate(90.000000) translate(-155.000000, -271.500000) translate(151.500000, 265.500000)">
|
||||
<path d="M0.608841978,14 C0.470277523,14 0.331006479,13.9613238 0.216734051,13.882168 C-0.0405860142,13.7039169 -0.0734545654,13.3878545 0.14324884,13.1762378 L6.59564512,6.87581039 L0.44101501,0.822369399 C0.225213114,0.610111401 0.259470477,0.294169219 0.517545862,0.116659651 C0.775621246,-0.0608098387 1.15976178,-0.0326343529 1.37556367,0.179623645 L7.85814834,6.55561984 C8.04780646,6.74216721 8.04722169,7.01376206 7.85675953,7.19974832 L1.07504424,13.821749 C0.95455871,13.9394007 0.782272925,13.99998 0.608841978,14 L0.608841978,14 Z" id="箭头"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
18
resource/template/icons/comment-uparrow.svg
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="12px" height="7px" viewBox="0 0 12 7" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 39 (31667) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>enter-arrow</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="发现" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="02-发现-车友圈" transform="translate(-92.000000, -1301.000000)" fill="#ACB1B7">
|
||||
<g id="content" transform="translate(0.000000, 290.000000)">
|
||||
<g id="示例3" transform="translate(16.000000, 558.000000)">
|
||||
<g id="enter-arrow" transform="translate(82.000000, 456.500000) rotate(-90.000000) translate(-82.000000, -456.500000) translate(78.500000, 450.500000)">
|
||||
<path d="M0.608841978,14 C0.470277523,14 0.331006479,13.9613238 0.216734051,13.882168 C-0.0405860142,13.7039169 -0.0734545654,13.3878545 0.14324884,13.1762378 L6.59564512,6.87581039 L0.44101501,0.822369399 C0.225213114,0.610111401 0.259470477,0.294169219 0.517545862,0.116659651 C0.775621246,-0.0608098387 1.15976178,-0.0326343529 1.37556367,0.179623645 L7.85814834,6.55561984 C8.04780646,6.74216721 8.04722169,7.01376206 7.85675953,7.19974832 L1.07504424,13.821749 C0.95455871,13.9394007 0.782272925,13.99998 0.608841978,14 L0.608841978,14 Z" id="箭头"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
14
resource/template/icons/massage.svg
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="20px" height="18px" viewBox="0 0 20 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 39 (31667) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>massage</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="发现" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="08-发现-车友圈-个人主页-新消息提示" transform="translate(-343.000000, -34.000000)" fill="#FFFFFF">
|
||||
<g id="Navigation-Bar">
|
||||
<path d="M347.346816,52 C347.250245,52 347.153628,51.9774497 347.066496,51.9321805 C346.886656,51.8387519 346.775387,51.6630751 346.775387,51.4726319 L346.775387,48.3768338 L346.746633,48.3581649 C346.176415,47.9884377 345.655249,47.567809 345.197648,47.1079651 C344.737031,46.6451047 344.339727,46.1414261 344.016778,45.6108727 C343.687841,45.0705525 343.434652,44.4999613 343.264229,43.9149625 C343.088892,43.3131512 343,42.691553 343,42.0674867 C343,40.9794631 343.263909,39.9239465 343.784389,38.9301952 C344.287453,37.9696892 345.007842,37.1069151 345.925558,36.3658153 C346.843936,35.6241671 347.913537,35.0418472 349.104624,34.6350355 C350.338294,34.2136473 351.648901,34 353.000057,34 C354.35119,34 355.661774,34.2136473 356.895422,34.6350355 C358.086486,35.0418683 359.156087,35.6241881 360.074442,36.3658153 C360.992135,37.1069151 361.712547,37.9696892 362.215633,38.9301952 C362.736114,39.9239465 363,40.9794842 363,42.0674656 C363,43.155658 362.736091,44.2113222 362.215611,45.2051157 C361.712547,46.1656006 360.992181,47.0283958 360.074442,47.7694745 C359.156064,48.5110806 358.086463,49.0933582 356.895399,49.5001066 C355.661843,49.9214315 354.351236,50.1350578 353.000057,50.1350578 C352.389908,50.1350578 351.777884,50.0873837 351.129038,49.9893144 L351.104375,49.9856017 L347.643228,51.9234894 C347.552257,51.9744332 347.449582,52 347.346816,52 Z M357.760871,43.274358 C357.107102,43.274358 356.576472,42.7547317 356.576472,42.1128404 C356.576472,41.4710334 357.107102,40.9514493 357.760871,40.9514493 C358.414769,40.9514493 358.945399,41.4717717 358.945399,42.1128404 C358.945399,42.7540355 358.414769,43.274358 357.760871,43.274358 Z M353.019825,43.274358 C352.366659,43.274358 351.835297,42.7547317 351.835297,42.1128404 C351.835297,41.4710334 352.366659,40.9514493 353.019825,40.9514493 C353.673594,40.9514493 354.204224,41.4717717 354.204224,42.1128404 C354.204224,42.7540355 353.673594,43.274358 353.019825,43.274358 Z M348.290279,43.274358 C347.637199,43.274358 347.10588,42.7547317 347.10588,42.1128404 C347.10588,41.4710334 347.637199,40.9514493 348.290279,40.9514493 C348.944048,40.9514493 349.474679,41.4717717 349.474679,42.1128404 C349.474679,42.7540355 348.944048,43.274358 348.290279,43.274358 Z" id="massage"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.8 KiB |
7
resource/template/js/bootstrap.min.js
vendored
Normal file
463
resource/template/js/index.js
Normal file
@ -0,0 +1,463 @@
|
||||
$(function(){
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
function replaceEmoji(text) {
|
||||
// 定义替换规则,可以根据需要添加更多规则
|
||||
var replacementRules = [
|
||||
{
|
||||
pattern: /\[微笑\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_1@2x.png" id="微笑" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[发呆\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_4@2x.png" id="发呆" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[撇嘴\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_2@2x.png" id="撇嘴" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[色\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_3@2x.png" id="色" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[发呆\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_4@2x.png" id="发呆" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[得意\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_5@2x.png" id="得意" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[流泪\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_6@2x.png" id="流泪" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[害羞\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_7@2x.png" id="害羞" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[闭嘴\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_8@2x.png" id="闭嘴" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[睡\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_9@2x.png" id="睡" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[大哭\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_10@2x.png" id="大哭" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[尴尬\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_11@2x.png" id="尴尬" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[发怒\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_12@2x.png" id="发怒" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[调皮\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_13@2x.png" id="调皮" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[呲牙\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_14@2x.png" id="呲牙" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[惊讶\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_15@2x.png" id="惊讶" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[难过\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_16@2x.png" id="难过" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[抓狂\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_19@2x.png" id="抓狂" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[吐\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_20@2x.png" id="吐" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[偷笑\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_21@2x.png" id="偷笑" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[愉快\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_22@2x.png" id="愉快" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[白眼\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_23@2x.png" id="白 眼" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[傲慢\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_24@2x.png" id="傲慢" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[困\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_26@2x.png" id="困" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[惊恐\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_27@2x.png" id="惊恐" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[憨笑\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_29@2x.png" id="憨笑" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[悠闲\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_30@2x.png" id="悠闲" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[咒骂\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_32@2x.png" id="咒骂" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[疑问\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_33@2x.png" id="疑问" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[嘘\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_34@2x.png" id="嘘" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[晕\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_35@2x.png" id="晕" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[衰\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_37@2x.png" id="衰" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[骷髅\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_38@2x.png" id="骷髅" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[敲打\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_39@2x.png" id="敲打" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[再见\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_40@2x.png" id="再见" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[擦汗\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_41@2x.png" id="擦汗" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[抠鼻\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_42@2x.png" id="抠鼻" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[鼓掌\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_43@2x.png" id="鼓掌" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[坏笑\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_45@2x.png" id="坏笑" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[右哼哼\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_47@2x.png" id="右哼哼" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[鄙视\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_49@2x.png" id="鄙视" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[委屈\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_50@2x.png" id="委屈" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[快哭了\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_51@2x.png" id="快哭了" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[阴险\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_52@2x.png" id="阴险" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[亲亲\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_53@2x.png" id="亲亲" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[可怜\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_55@2x.png" id="可怜" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[Whimper\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_55@2x.png" id="可怜" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[笑脸\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Happy.png" id="笑脸" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[生病\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Sick.png" id="生病" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[脸红\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Flushed.png" id="脸红" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[破涕为笑\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Lol.png" id="破涕为笑" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[恐惧\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Terror.png" id="恐惧" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[失望\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/LetDown.png" id="失望" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[无语\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Duh.png" id="无语" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[嘿哈\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_04.png" id="嘿哈" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[捂脸\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_05.png" id="捂脸" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[奸笑\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_02.png" id="奸笑" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[机智\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_06.png" id="机智" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[皱眉\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_12.png" id="皱眉" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[耶\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_11.png" id="耶" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[吃瓜\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Watermelon.png" id="吃瓜" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[加油\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Addoil.png" id="加油" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[汗\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Sweat.png" id="汗" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[天啊\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Shocked.png" id="天啊" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[Emm\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Cold.png" id="Emm" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[社会社会\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Social.png" id="社会社会" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[旺柴\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Yellowdog.png" id="旺柴" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[好的\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/NoProb.png" id="好的" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[打脸\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Slap.png" id="打脸" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[哇\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Wow.png" id="哇" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[翻白眼\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Boring.png" id="翻白眼" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[666\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/666.png" id="666" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[让我看看\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/LetMeSee.png" id="让我看看" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[叹气\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Sigh.png" id="叹气" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[苦涩\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Hurt.png" id="苦涩" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[難受\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Hurt.png" id="苦涩" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[裂开\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Broken.png" id="裂开" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[嘴唇\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_66@2x.png" id="嘴唇" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[爱心\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_67@2x.png" id="爱心" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[心碎\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_68@2x.png" id="心碎" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[拥抱\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_79@2x.png" id="拥抱" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[强\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_80@2x.png" id="强" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[弱\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_81@2x.png" id="弱" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[握手\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_82@2x.png" id="握手" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[胜利\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_83@2x.png" id="胜利" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[抱拳\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_84@2x.png" id="抱拳" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[勾引\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_85@2x.png" id="勾引" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[拳头\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_86@2x.png" id="拳头" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[OK\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_90@2x.png" id="OK" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[合十\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Worship.png" id="合十" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[啤酒\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_58@2x.png" id="啤酒" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[咖啡]\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_61@2x.png" id="咖啡" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[蛋糕\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_69@2x.png" id="蛋糕" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[玫瑰\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_64@2x.png" id="玫 瑰" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[凋谢\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_65@2x.png" id="凋谢" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[菜刀\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_56@2x.png" id="菜刀" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[炸弹\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_71@2x.png" id="炸弹" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[便便\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_75@2x.png" id="便便" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[月亮\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_76@2x.png" id="月亮" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[太阳\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_77@2x.png" id="太阳" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[庆 祝\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Party.png" id="庆祝" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[礼物\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_78@2x.png" id="礼物" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[红包\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_09.png" id="红包" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[發\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_16.png" id="發" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[福\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/2_15.png" id="福" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[烟花\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Fireworks.png" id="烟花" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[爆竹\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/newemoji/Firecracker.png" id="爆竹" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[猪头\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_63@2x.png" id="猪头" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[跳跳\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_93@2x.png" id="跳跳" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[发抖\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_94@2x.png" id="发抖" class="emoji_img">'
|
||||
},
|
||||
{
|
||||
pattern: /\[转圈\]/g,
|
||||
replacement: '<img src="https://res.wx.qq.com/t/wx_fed/we-emoji/res/v1.2.8/assets/Expression/Expression_96@2x.png" id="转圈" class="emoji_img">'
|
||||
}
|
||||
];
|
||||
|
||||
// 循环遍历替换规则
|
||||
for (var i = 0; i < replacementRules.length; i++) {
|
||||
var rule = replacementRules[i];
|
||||
text = text.replace(rule.pattern, rule.replacement);
|
||||
}
|
||||
return text;
|
||||
}
|
4
resource/template/js/jquery-2.1.1.min.js
vendored
Normal file
38
test.py
Normal file
@ -0,0 +1,38 @@
|
||||
import datetime
|
||||
from decrypter.video_decrypt import VideoDecrypter
|
||||
import threading
|
||||
from time import sleep
|
||||
from pywxdump import read_info
|
||||
from gui.gui import Gui
|
||||
|
||||
|
||||
def stage_3():
|
||||
gui = Gui()
|
||||
gui_thread = threading.Thread(target=gui.run_gui)
|
||||
gui_thread.start()
|
||||
gui.init_export_page()
|
||||
|
||||
gui.begin_calendar.set_date(datetime.date(2024, 3, 6))
|
||||
gui.end_calendar.set_date(datetime.date(2024, 3, 6))
|
||||
|
||||
# 后台读取微信信息
|
||||
# 请等待完全接入微信再进行UI操作
|
||||
while True:
|
||||
sleep(0.5)
|
||||
result = read_info(None, is_logging=True)
|
||||
# 如果解密失败,读取到报错信息
|
||||
if isinstance(result, str):
|
||||
gui.waiting_label.config(text="请启动微信....")
|
||||
pass
|
||||
elif isinstance(result, list) and result[0].get("key") == "None":
|
||||
gui.waiting_label.config(text="请登陆微信....")
|
||||
else:
|
||||
gui.account_info = result[0]
|
||||
gui.waiting_label.config(text="微信已登录")
|
||||
# 初始化视频导出器
|
||||
gui.video_decrypter = VideoDecrypter(gui, gui.account_info.get("filePath"))
|
||||
gui.waiting_label.place_forget()
|
||||
break
|
||||
|
||||
if __name__ == "__main__":
|
||||
stage_3()
|