pyttsx3 winsound win32api.MessageBox使用案例

import requests,time
from lxml import etree
import win32api,win32con
import winsound
import pyttsx3

cookies = str(input('请输入cookies:'))

def ring():
    engine = pyttsx3.init()
    engine.say('傻逼,有户了,赶紧去抢')
    engine.runAndWait()

def check_account():
    today = time.strftime('%Y-%m-%d',time.localtime())
    url1 = 'http://cm.admin.weibo.com/customer_base/customer_base.php?hiddenuid=2&exportuid=&uid=&nickname=&start_storage_time={}&end_storage_time=+{}+&type_status=2&source=&start_open_time=&end_open_time=&filed=0&industry=0&one_industry=0&region=0&one_region=0'
    headers ={'Cookie': cookies,
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36',
    'Host': 'cm.admin.weibo.com',
    }
    time.sleep(3)
    res = requests.get(url1.format(today,today),headers=headers)
    html = etree.HTML(res.text)
    html_data = html.xpath('//*[@id="listTable"]/tbody/tr/td[3]/text()')
    if len(html_data) >0:
        print('哈哈傻逼,出来' + str(len(html_data)) + '个户,赶紧抢,他们是:'+ ','.join(html_data))
        win32api.MessageBox(win32con.NULL,'哈哈傻逼,出来' + str(len(html_data)) + '个户,赶紧抢,他们是:'+ ','.join(html_data) , '有户了,快特么领去', win32con.MB_OK)
        winsound.Beep(600,500)
        ring()
        return True
    else:
        print('没有户')
        return False

if __name__ == '__main__':
    count = 1
    while True:
        todayHS = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())
        print('时间:%s 第 %s 次查询-----> '% (todayHS,str(count)),end='')
        flag=check_account()
        if flag is True:
            break
        count +=1

 

posted @ 2018-04-20 14:23  Erick-LONG  阅读(399)  评论(0编辑  收藏  举报