一個需求
需要利用Python+第三方庫wxauto It is used to automatically obtain chat information on WeChat,Thereby, the information can be automatically processed for the second time according to its own needs,
such as auto-responders,Another example is to automatically send files or other.
這邊使用Python的第三方庫`wxauto`來進行開發,而不是`itchat`
--- 記錄於2022年07月
使用Python3的第三方庫wxauto
, 它適用於Windows的微信客戶端
官網: https://github.com/cluic/wxauto
這邊使用
wxauto
來進行開發,而不是itchat
,原因如下
itchat
All previous tutorials,
In essence, the interface of WeChat's web page is used for data interaction.
如果你想要使用itchat
的代碼的話,
https://wx.qq.com/
Tencent official although no official statement,But you can search for relevant information
大概從去年開始(The time is not quite certain),Most WeChat accounts cannot continue to log in to the WeChat webpage,Only a few accounts can still log in.
原因未知.
itchat
code to learn to run,如果登錄失敗,Then maybe you can try itwxauto
That is the method mentioned here to run.
Windows 10
Python 3.8.10
Windows 10WeChat client version:3.7.5.23 (英文版本)
注:Both Chinese and English versions of the WeChat client are available
沒什麼太大區別.
安裝Python3的第三方庫
wxauto
,具體步驟如下
官網: https://github.com/cluic/wxauto
在cmdWindow execute the following command to install
wxauto
python3 --version
python3 -m pip install wxauto -i https://pypi.tuna.tsinghua.edu.cn/simple
wxauto
是否安裝成功python3 -c "import wxauto; print(wxauto.VERSION)"
The first article here only introduces getting the chat information of the default window
from wxauto import *
# 獲取當前微信客戶端
wx = WeChat()
# 獲取會話列表
wx.GetSessionList()
###############################
# 1、Get default window chat information
###############################
def get_default_window_messages():
# The default is the currently selected window of the WeChat window
# 輸出當前聊天窗口聊天消息
msgs = wx.GetAllMessage
for msg in msgs:
print('%s : %s' % (msg[0], msg[1]))
# 獲取更多聊天記錄
wx.LoadMoreMessage()
msgs = wx.GetAllMessage
for msg in msgs:
print('%s : %s' % (msg[0], msg[1]))
if __name__ == '__main__':
get_default_window_messages()
打開cmd窗口,在cmd窗口執行:
If no third party library is installed,參考上面的
安裝
Steps to install and then execute the following command
cd 你的main.py所在路徑
python3 main.py
cmdThe window normally outputs the chat information of your default WeChat window
Just started writing a series of articles here,I want to develop my own blog and WeChat public account
如果對你有幫助,You can follow it if it's convenient The WeChat official account on the left side of the blog(Click on my avatar to enter the personal center,on the lower left)
如有問題的話,You can also leave a message directly through the official account,There is a WeChat reminder here,Respond promptly within a few hours
也可直接在CSDNBlog message or private message message,There is no WeChat reminder for this,So here may reply within a day or a few days
The location of the WeChat public account:打開
個人中心
也就是這個鏈接
https://blog.csdn.net/xiaozi_001?type=blog
左側下方
如有需求,
Want to automate some WeChat operations to improve efficiency:
比如
Automatically send different chat messages to several WeChat groups
Automatically send different pictures to several WeChat groups
Automatically send different files to several WeChat groups
If you know the code yourself, Look directly at third-party libraries
wxauto
的使用,Just write it yourself,The blog will continue to be updated based on this series in the follow-up.
Welcome to comment and ask questions,方便的話 點贊收藏 關注下微信公眾號
Just want a simple WeChat processing tool to meet your needs
You can leave a message on WeChat public account or private message,
Post your specific needs,Here, the next secondary development will be carried out according to your needs
費用大概100RMB~500RMB不等,Determined according to your requirements complexity and development time
簡單的功能,比如上面提到的,一般100RMB就可以了
復雜的需求,It will be determined according to your requirements complexity and development time
Generally this meets the needs,After the development is completed and confirmed to the user, the payment will be made
The location of the WeChat public account:打開
個人中心
也就是這個鏈接
https://blog.csdn.net/xiaozi_001?type=blog
左側下方
如有需求,You can follow the WeChat public account to leave a message or leave a private message directly
The former can respond promptly within a few hours
The latter may not be seen in time,Reply in about a day or a few days
注:Just started thinking about making some orders in my spare time,Think about your future career plans
Orders that can be part-time developed for part-time requirements,微信自動化,QQ自動化,Static official website development, etc. can be
A series of tutorials will follow Welcome to communicate if necessary
如有問題 歡迎提出
如有疑問 歡迎留言
如有作用 歡迎點贊
如有失效 歡迎留言
2022年07月 可用