研招网监控器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

31 lines
1.0 KiB

2 years ago
  1. #encoding:utf-8
  2. from win10toast import ToastNotifier
  3. import requests as r
  4. import os
  5. import time
  6. toaster = ToastNotifier()
  7. oritxt = r.get('http://yzb2.ustc.edu.cn/cjcx').text
  8. if oritxt.find(u'未开通') == -1:
  9. print(u'[NOTICE] 可能已经可以查分了,帮你打开浏览器,快去看看')
  10. os.system('start http://yzb2.ustc.edu.cn/cjcx')
  11. toaster.show_toast(u"USTC查分网监控器",
  12. u"查分网站内容发生变更时我会通知您,并自动打开浏览器", duration=10)
  13. print(u'[NOTICE] 监控开始')
  14. while True:
  15. time.sleep(15)
  16. os.system('cls')
  17. print(u'http://yzb2.ustc.edu.cn/cjcx:获取中...')
  18. try:
  19. current = r.get('http://yzb2.ustc.edu.cn/cjcx').text
  20. if current == oritxt:
  21. print(time.strftime('[NOTICE] %X\tNO...',time.localtime(time.time())))
  22. else:
  23. os.system('start http://yzb2.ustc.edu.cn/cjcx')
  24. toaster.show_toast(u"监控程序",
  25. u"好像可以查询成绩了,帮你打开浏览器,快去看看", duration=60)
  26. exit()
  27. except KeyboardInterrupt:
  28. exit()
  29. except Exception, e:
  30. print("[ERROR] ", e)