python 微信轟炸


from __future__ import unicode_literals
import requests
import itchat
import time

def get_news():
    url = "http://open.iciba.com/dsapi"
    r = requests.get(url)
    contents = r.json()['content']
    translation = r.json()['translation']
    return contents, translation

def send_news():
    try:
        # 登陸你的微信賬號,會彈出網頁二維碼,掃描即可
        itchat.auto_login(hotReload=True)
        # 改成你最心愛的人的名字。
        my_friend = itchat.search_friends(name=u'要發的人')
        # 獲取對應名稱的一串數字
        XiaoMing = my_friend[0]["UserName"]
        # 消息設置
        message3 = "來自微信自動化測試"
        # 發送消息
        for i in range(1, 10):
            itchat.send(message3, toUserName=XiaoMing)
        # t = time(1, send_news())
        # t.start()
    except:
        message4 = u"/(ㄒoㄒ)/~~"
        itchat.send(message4, toUserName=XiaoMing)

def main():
    send_news()

if __name__ == '__main__':
    main()

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM