首页 >> 大全

2023年最新的Python操控微信教程

2023-10-02 大全 27 作者:考证青年

自从微信禁止网页版登陆之后, 库实现的功能也就都不能用了,那现在 还能操作微信吗?答案是:可以!

在上有一个项目叫《》可以使用对微信进行操控。简单来说,它是通过逆向PC端微信来实现对微信的操控,使用封装后调用更加简单!

地址:

码云地址:

拉取(好友/群/公众号)等列表

# 拉取列表(好友/群/公众号等)
# 好友列表:pull_type = 1
# 群列表:pull_type = 2
# 公众号列表:pull_type = 3
# 其他:pull_type = 4
data = w.pull_list(pull_type=1)
print(data)# 获取群成员列表
data = w.get_chat_room_members(to_chat_room="xxx@chatroom")
print(data)

朋友圈操作

# 获取朋友圈数据
moments = w.get_moments()
if not moments:print("没有最新的朋友圈")
else:for item in moments:print(item)# 朋友圈点赞/取消点赞
w.like_moments(moments_id="130000",state=True
)# 朋友圈评论
w.comment_moments(moments_id="1300000",content="我是评论内容"
)# 朋友圈删除评论
w.del_comment_moments(moments_id="1300000",comment_id="3"
)

发送、接收、转发消息

# 发送文本消息
w.send_text(to_wx="filehelper", msg='你好鸭~')
time.sleep(1)# 发送图片消息
w.send_img(to_wx="filehelper", path=r"C:\Users\Administrator\Desktop\1.png")
time.sleep(1)# 发送卡片链接
w.send_card_link(to_wx="filehelper",title="我是卡片标题",desc="我是卡片描述啊啊啊啊啊啊啊啊啊啊",target_url="http://baidu.com",img_url="http://img.czdsh.com/Fsc_C6Rz5Sk7sblr_Q4YI0Y9v0zb"
)# 发送其他消息...# 处理消息回调
while True:msg = msg_queue.get()if msg["msg_type"] == 37:# 同意添加好友申请w.agree_friend(msg_data=msg)# 收款elif msg["msg_type"] == 490:is_recv = msg["detail"]["is_recv"]if is_recv:# 收款w.collection(msg_data=msg)# 保存图片elif msg["msg_type"] == 3:w.save_img(save_path=os.path.join(BASE_DIR, "temp\\1.png"),msg_data=msg)# 如果是老板发来的信息if msg["wx_id"] == "wxid_xxx":# 转发给工作小组w.forward_msg("xxxxxx@chatroom", msg["msg_id"])

以下是效果图:

关于我们

最火推荐

小编推荐

联系我们


版权声明:本站内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 88@qq.com 举报,一经查实,本站将立刻删除。备案号:桂ICP备2021009421号
Powered By Z-BlogPHP.
复制成功
微信号:
我知道了