zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    统计nginx日志里访问次数最多的前十个IP
    while 格式化输出 运算符 字符编码
    Python 软件安装
    Python 基础
    Typora 基础的使用方法
    Django ORM (四) annotate,F,Q 查询
    Django 惰性机制
    Django ORM (三) 查询,删除,更新操作
    Django ORM (二) 增加操作
    Django ORM (一) 创建数据库和模型常用的字段类型参数及Field 重要参数介绍
  • 原文地址:https://www.cnblogs.com/Erick-L/p/8890731.html
Copyright © 2011-2022 走看看