import requests
from bs4 import BeautifulSoup
import itchat
import time,datetime all = [{1, 2, 3, 7, 8},
{1, 2, 3, 7, 9},
{1, 2, 3, 7, 10},
{1, 2, 3, 8, 9},
{1, 2, 3, 8, 10},
{1, 2, 3, 9, 10},
{1, 2, 4, 7, 8},
{1, 2, 4, 7, 9},
{1, 2, 4, 7, 10},
{1, 2, 4, 8, 9},
{1, 2, 4, 8, 10},
{1, 2, 4, 9, 10},
{1, 2, 5, 7, 8},
{1, 2, 5, 7, 9},
{1, 2, 5, 7, 10},
{1, 2, 5, 8, 9},
{1, 2, 5, 8, 10},
{1, 2, 5, 9, 10},
{1, 2, 6, 7, 8},
{1, 2, 6, 7, 9},
{1, 2, 6, 7, 10},
{1, 2, 6, 8, 9},
{1, 2, 6, 8, 10},
{1, 2, 6, 9, 10},
{1, 2, 7, 8, 9},
{1, 2, 7, 8, 10},
{1, 2, 7, 8, 11},
{1, 2, 7, 9, 10},
{1, 2, 7, 9, 11},
{1, 2, 7, 10, 11},
{1, 2, 8, 9, 10},
{1, 2, 8, 9, 11},
{1, 2, 8, 10, 11},
{1, 2, 9, 10, 11},
{1, 3, 4, 7, 8},
{1, 3, 4, 7, 9},
{1, 3, 4, 7, 10},
{1, 3, 4, 8, 9},
{1, 3, 4, 8, 10},
{1, 3, 4, 9, 10},
{1, 3, 5, 7, 8},
{1, 3, 5, 7, 9},
{1, 3, 5, 7, 10},
{1, 3, 5, 8, 9},
{1, 3, 5, 8, 10},
{1, 3, 5, 9, 10},
{1, 3, 6, 7, 8},
{1, 3, 6, 7, 9},
{1, 3, 6, 7, 10},
{1, 3, 6, 8, 9},
{1, 3, 6, 8, 10},
{1, 3, 6, 9, 10},
{1, 3, 7, 8, 9},
{1, 3, 7, 8, 10},
{1, 3, 7, 8, 11},
{1, 3, 7, 9, 10},
{1, 3, 7, 9, 11},
{1, 3, 7, 10, 11},
{1, 3, 8, 9, 10},
{1, 3, 8, 9, 11},
{1, 3, 8, 10, 11},
{1, 3, 9, 10, 11},
{1, 4, 5, 7, 8},
{1, 4, 5, 7, 9},
{1, 4, 5, 7, 10},
{1, 4, 5, 8, 9},
{1, 4, 5, 8, 10},
{1, 4, 5, 9, 10},
{1, 4, 6, 7, 8},
{1, 4, 6, 7, 9},
{1, 4, 6, 7, 10},
{1, 4, 6, 8, 9},
{1, 4, 6, 8, 10},
{1, 4, 6, 9, 10},
{1, 4, 7, 8, 9},
{1, 4, 7, 8, 10},
{1, 4, 7, 8, 11},
{1, 4, 7, 9, 10},
{1, 4, 7, 9, 11},
{1, 4, 7, 10, 11},
{1, 4, 8, 9, 10},
{1, 4, 8, 9, 11},
{1, 4, 8, 10, 11},
{1, 4, 9, 10, 11},
{1, 5, 6, 7, 8},
{1, 5, 6, 7, 9},
{1, 5, 6, 7, 10},
{1, 5, 6, 8, 9},
{1, 5, 6, 8, 10},
{1, 5, 6, 9, 10},
{1, 5, 7, 8, 9},
{1, 5, 7, 8, 10},
{1, 5, 7, 8, 11},
{1, 5, 7, 9, 10},
{1, 5, 7, 9, 11},
{1, 5, 7, 10, 11},
{1, 5, 8, 9, 10},
{1, 5, 8, 9, 11},
{1, 5, 8, 10, 11},
{1, 5, 9, 10, 11},
{2, 3, 4, 7, 8},
{2, 3, 4, 7, 9},
{2, 3, 4, 7, 10},
{2, 3, 4, 8, 9},
{2, 3, 4, 8, 10},
{2, 3, 4, 9, 10},
{2, 3, 5, 7, 8},
{2, 3, 5, 7, 9},
{2, 3, 5, 7, 10},
{2, 3, 5, 8, 9},
{2, 3, 5, 8, 10},
{2, 3, 5, 9, 10},
{2, 3, 6, 7, 8},
{2, 3, 6, 7, 9},
{2, 3, 6, 7, 10},
{2, 3, 6, 8, 9},
{2, 3, 6, 8, 10},
{2, 3, 6, 9, 10},
{2, 3, 7, 8, 9},
{2, 3, 7, 8, 10},
{2, 3, 7, 8, 11},
{2, 3, 7, 9, 10},
{2, 3, 7, 9, 11},
{2, 3, 7, 10, 11},
{2, 3, 8, 9, 10},
{2, 3, 8, 9, 11},
{2, 3, 8, 10, 11},
{2, 3, 9, 10, 11},
{2, 4, 5, 7, 8},
{2, 4, 5, 7, 9},
{2, 4, 5, 7, 10},
{2, 4, 5, 8, 9},
{2, 4, 5, 8, 10},
{2, 4, 5, 9, 10},
{2, 4, 6, 7, 8},
{2, 4, 6, 7, 9},
{2, 4, 6, 7, 10},
{2, 4, 6, 8, 9},
{2, 4, 6, 8, 10},
{2, 4, 6, 9, 10},
{2, 4, 7, 8, 9},
{2, 4, 7, 8, 10},
{2, 4, 7, 8, 11},
{2, 4, 7, 9, 10},
{2, 4, 7, 9, 11},
{2, 4, 7, 10, 11},
{2, 4, 8, 9, 10},
{2, 4, 8, 9, 11},
{2, 4, 8, 10, 11},
{2, 4, 9, 10, 11},
{2, 5, 6, 7, 8},
{2, 5, 6, 7, 9},
{2, 5, 6, 7, 10},
{2, 5, 6, 8, 9},
{2, 5, 6, 8, 10},
{2, 5, 6, 9, 10},
{2, 5, 7, 8, 9},
{2, 5, 7, 8, 10},
{2, 5, 7, 8, 11},
{2, 5, 7, 9, 10},
{2, 5, 7, 9, 11},
{2, 5, 7, 10, 11},
{2, 5, 8, 9, 10},
{2, 5, 8, 9, 11},
{2, 5, 8, 10, 11},
{2, 5, 9, 10, 11},
{3, 4, 5, 7, 8},
{3, 4, 5, 7, 9},
{3, 4, 5, 7, 10},
{3, 4, 5, 8, 9},
{3, 4, 5, 8, 10},
{3, 4, 5, 9, 10},
{3, 4, 6, 7, 8},
{3, 4, 6, 7, 9},
{3, 4, 6, 7, 10},
{3, 4, 6, 8, 9},
{3, 4, 6, 8, 10},
{3, 4, 6, 9, 10},
{3, 4, 7, 8, 9},
{3, 4, 7, 8, 10},
{3, 4, 7, 8, 11},
{3, 4, 7, 9, 10},
{3, 4, 7, 9, 11},
{3, 4, 7, 10, 11},
{3, 4, 8, 9, 10},
{3, 4, 8, 9, 11},
{3, 4, 8, 10, 11},
{3, 4, 9, 10, 11},
{3, 5, 6, 7, 8},
{3, 5, 6, 7, 9},
{3, 5, 6, 7, 10},
{3, 5, 6, 8, 9},
{3, 5, 6, 8, 10},
{3, 5, 6, 9, 10},
{3, 5, 7, 8, 9},
{3, 5, 7, 8, 10},
{3, 5, 7, 8, 11},
{3, 5, 7, 9, 10},
{3, 5, 7, 9, 11},
{3, 5, 7, 10, 11},
{3, 5, 8, 9, 10},
{3, 5, 8, 9, 11},
{3, 5, 8, 10, 11},
{3, 5, 9, 10, 11},
{4, 5, 6, 7, 8},
{4, 5, 6, 7, 9},
{4, 5, 6, 7, 10},
{4, 5, 6, 8, 9},
{4, 5, 6, 8, 10},
{4, 5, 6, 9, 10},
{4, 5, 7, 8, 9},
{4, 5, 7, 8, 10},
{4, 5, 7, 8, 11},
{4, 5, 7, 9, 10},
{4, 5, 7, 9, 11},
{4, 5, 7, 10, 11},
{4, 5, 8, 9, 10},
{4, 5, 8, 9, 11},
{4, 5, 8, 10, 11},
{4, 5, 9, 10, 11},]
ret_list=[
'http://chart.icaile.com/gd11x5.php',
'http://chart.icaile.com/',
'http://chart.icaile.com/jx11x5.php',
'http://chart.icaile.com/sh11x5.php',
'http://chart.icaile.com/js11x5.php',
'http://chart.icaile.com/yn11x5.php',
'http://chart.icaile.com/jl11x5.php',
'http://chart.icaile.com/nmg11x5.php',
'http://chart.icaile.com/ah11x5.php',
]
while True:
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
#和值大小
for i in ret_list: #循环9个省份
ret = requests.get(i) #爬数据
ret1 = ret.text #输出内容
soup = BeautifulSoup(ret1,'html.parser') #beautifulsoup解析
title = soup.title #获取title
periods = soup.find_all("td","chart-bg-qh") #找到所有期数
result = [] #去除所有和值
for period in periods:
period_text = int(period.get_text()) #每期期数
sum = int(period.find_next_siblings("td")[21].get_text()) #找到和值
last = sum % 10 #尾数
result.append(last) #将尾数加入空列表
result.reverse() #反转list,让最新的盘在前面
period_last = int(period.get_text())
result_big=[]
result_sml=[]
#判断大
for i in result:
if i > 4 :
result_big.append(i)
else:break
len_big = len(result_big) #查看大的有几期
print("%s %s ---大 -------%s期" % (title.get_text(), period_last,len_big))
if len_big > 8: #满足条件是发微信
print("\033[1;30;41m%s %s ---大 -------%s期\033[0m" % (title.get_text(), period_last, len_big))
try:
itchat.auto_login(hotReload=True) #微信登录
users = itchat.search_friends(name='Mo') #选择用户
userName = users[0]['UserName'] #用于发消息+
itchat.send(title.get_text()+ '----大'+ '-------'+str(len_big)+'期' + '----'+ datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') , toUserName=userName)
time.sleep(1)
except Exception as e:
print("微信发消息异常")
continue
#判断小
for i in result:
if i < 5 :
result_sml.append(i)
else:break
len_sml = len(result_sml) #查看小的有几期
print("%s %s ---小 -------%s期" % (title.get_text(), period_last, len_sml))
if len_sml > 8: #满足条件是发微信
print("\033[1;30;41m%s %s ---小 -------%s期\033[0m" % (title.get_text(), period_last, len_sml))
try:
itchat.auto_login(hotReload=True) #微信登录
users = itchat.search_friends(name='Mo') #选择用户
userName = users[0]['UserName'] #用于发消息+
itchat.send(title.get_text()+ '----小'+ '--------'+str(len_sml) +'期'+ '----'+ datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') , toUserName=userName)
time.sleep(1)
except Exception as e:
print("微信发消息异常")
continue
print('-------------------------------------------------------------')
#
for i in ret_list: #循环9个省份
ret = requests.get(i) #爬数据
ret1 = ret.text #输出内容
soup = BeautifulSoup(ret1,'html.parser') #beautifulsoup解析
title = soup.title #获取title
periods = soup.find_all("td","chart-bg-qh") #找到所有期数
period = periods[-1].get_text() #找到最后一期
four_all = soup.find_all("td","chart-bg-hmfb dqhm") #找到出奖号码中的4位
one_all = soup.find_all("td","chart-bg-kjhmo") #找到出奖号码中的1位
four_list = [] #所有的4位,加入一个列表
one_list = [] #所有的1位,加入一个列表
for i in four_all:
four = int(i.get_text())
four_list.append(four)
for i in one_all:
one = int(i.get_text())
one_list.append(one)
four_list_split = [four_list[i:i+4] for i in range(0,len(four_list),4)] #[[1, 3, 7, 9], [2, 6, 9, 11], [2, 4, 5, 8]]
one_list_split = [one_list[i:i + 1] for i in range(0, len(one_list),1)] #[[2], [4], [6], [8], [3]]
five_list = [] #生成开奖号码用
five_list_set = [] #转化为集合方式
five_23_ok = []
for i,j in zip(four_list_split,one_list_split): #开奖的五位数 [[1, 5, 6, 9, 7], [3, 4, 5, 9, 7], [2, 8, 9, 11, 4]]
five = i + j
five_list.append(five)
five_list.reverse() #将最新的排在前面
for i in five_list :
five_set = set(i)
five_list_set.append(five_set)
# print(five_list_set) #开奖的五位数 [{8, 9, 11, 4, 5}, {11, 8, 3, 5, 7}, {11, 9, 10, 3, 7}]
for i in five_list_set:
if i not in all:
five_23_ok.append(i)
else:break
len23 = len(five_23_ok)
print("%s %s ---23 -------%s期" % (title.get_text(),period ,len23))
if len23 > 6: #满足6期才发信息
try:
itchat.auto_login(hotReload=True) # 微信登录
users = itchat.search_friends(name='Mo') # 选择用户
userName = users[0]['UserName'] # 用于发消息+
itchat.send(title.get_text() + period +'----23'+'-------'+ str(len23)+'期' + '----' + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
toUserName=userName)
time.sleep(1)
except Exception as e:
print("微信发消息异常")
continue
print('--------------------------------------------------------------')
itchat.logout()
time.sleep(60)

最新文章

  1. Ubuntu 16.10 开启PHP错误提示
  2. 【.net深呼吸】(WCF)OperationContextScope 的用途
  3. ASP.NET Core中的依赖注入(5): ServiceProvider实现揭秘 【总体设计 】
  4. 使用Python和Perl绘制北京跑步地图
  5. VC----SDK下对窗口非客户区的操作
  6. 使用 MongoDB 的_id 查询
  7. python递归次数和堆栈溢出问题
  8. sqlalchemy - day2
  9. 最近在折腾VPS(持续完善)
  10. dispatch队列
  11. 2014.3.6-C语言学习小结
  12. 一般增广路方法求网络最大流(Ford-Fulkerson算法)
  13. Django__Ready
  14. 一文把samba相关的都说清楚
  15. 第七篇--ubuntu18.04下面特殊符号
  16. [模板] 树状数组 (C++ class)
  17. vue实现简单的全选、反选、不选
  18. oracle:10g下载地址(转载)
  19. 利用原生js的Dom操作实现简单的ToDoList的效果
  20. pinnet 计算云分区

热门文章

  1. Introduction to vSphere Integrated Containers
  2. ASP.NET5 MVC6 利用Middleware 创建可访问HttpContext 的业务类工厂。(代替HttpContext.Current)
  3. poj 3468 线段树模板题
  4. Linux 配置 SSL 证书
  5. php记录代码执行时间
  6. 使用kibana进行简单的CRUD和版本控制
  7. Get Started with ASP.NET Web API 2 (C#)
  8. webpack 从0 手动配置
  9. 可编辑的div模仿文本框缓存(使用AUTOCOMPLETE属性,off是不缓存,on是缓存(默认))
  10. 5.6 WebDriver API实例讲解(31-40)