Python+wxpy 实现微信消息轰炸

 

需要导入wxpy,在终端中输入以下命令即可

pip install wxpy

  

如果没有pip先安装pip,安装好了的直接输入命令即可,安装好了但是显示没有安装的可能是没有将pip添加到PATH中,需要添加一下,或者进入Python的安装目录下的Scripts目录中打开终端在输入上面的命令。

至于轰炸的内容可以直接去百度复制下来,在程序同目录下创建1.txt即可。

 

from __future__ import unicode_literals
from wxpy import *
import requests
from wechat_sender import Sender
import time
 
bot = Bot(cache_path=True)#登录微信,扫一下弹出来的二维码然后同意即可

 
def get_news1():
#获取txt文件数据(需要轰炸的信息,一行一条)
  file = open("1.txt")#
  get = file.read()
  result = get.splitlines()
  return result
 
def send_news():
  try:
    my_friend = bot.friends().search(u'zheli')[0]  #你朋友的微信昵称(不是备注,微信帐号)
    for i in range(len(message_text)):
       my_friend.send(message_text[i])
       time.sleep(0.5)#0.5秒发送一条,直到全部发完
  except:
    my_friend = bot.friends().search('UTF-8')[0]  #你的微信昵称(不是微信帐号)
    my_friend.send(u"消息发送失败")
     
 
   
if __name__ == "__main__":
  message_text = get_news1()
  send_news()

 

成功图:

 

posted @ 2019-05-25 01:26  我好高冷  阅读(2896)  评论(1编辑  收藏  举报