diff --git a/pls.py b/pls.py index e7754f2..1b815f3 100644 --- a/pls.py +++ b/pls.py @@ -9,7 +9,7 @@ l = set([ "".join(sorted(f"{i:03d}")) for i in a ]) sum_list = [ sum(map(int, list(i))) for i in l] sum_df = pd.value_counts(sum_list) # print(sum_df.to_dict()) -# print(220/sum_df) +# print((220/sum_df).to_dict()) # 组三 group3 = [ i for i in l if len(set(i)) == 2] @@ -36,12 +36,12 @@ for i in sum_group6_dict.keys(): f2 = lambda number: len([i for i in number if int(i) %2 == 1]) != 0 f3 = lambda number: True if max(map(int, number)) - min(map(int, number)) != 2 else False f4 = lambda number: True if '3' not in number else False - f5 = lambda number: True if '3' not in number else False - f6 = lambda number: True if len(set('387').difference(number)) == 2 else False - if i in [11, 16, 17]: + f5 = lambda number: True if '7' not in number else False + f6 = lambda number: True if len(set('279').difference(number)) == 2 else False + if i in [12, 13, 16]: # result = sum_group6_dict[i] + sum_group3_dict[i] result = sum_group3_dict[i] - print(i, list(filter(f5, result))) + # print(i, list(filter(f5, result))) result = sum_group6_dict[i] print(i, list(filter(f5, result))) diff --git a/youdian.py b/youdian.py index db24fe2..0a56835 100644 --- a/youdian.py +++ b/youdian.py @@ -53,8 +53,69 @@ class Chrome(object): back = S('#vue2_el > header > div.back > a') click(back) + def plw(self, result=[], multiple=1, save_result=True): + """ + 排列五 + """ + _plw = S('p.lottname.p5') + wait_until(_plw.exists) + click(_plw) + for index, item in enumerate(result): + ten_thousand_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[0]) + 1}]/p') + if ten_thousand_ball.exists: + click(ten_thousand_ball) + thousand_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[1]) + 1}]/p') + if thousand_ball.exists: + click(thousand_ball) + hundred_ball = S(f'//*[@id="body"]/section/div[3]/div[3]/div[2]/ul/li[{int(item[2]) + 1}]/p') + if hundred_ball.exists: + click(hundred_ball) + ten_ball = S(f'//*[@id="body"]/section/div[3]/div[4]/div[2]/ul/li[{int(item[3]) + 1}]/p') + if ten_ball.exists: + click(ten_ball) + single_ball = S(f'//*[@id="body"]/section/div[3]/div[5]/div[2]/ul/li[{int(item[4]) + 1}]/p') + if single_ball.exists: + click(single_ball) + next_step = Text("下一步") + if not next_step.exists: + wait_until(next_step.exists) + click(next_step) + if index + 1 != len(result): + wait_until(Text("+继续添加").exists) + click(Text("+继续添加")) + print(f"直选, index:{index}, item:{item}") + # 倍数 + if multiple > 0: + for i in range(multiple - 1): + click(Text("+")) + if save_result: # 是否保存 + save = Text("保存") + if not save.exists: + wait_until(save.exists) + click(save) + else: # 不保存直接进行下一步 + second_next_step = Text("下一步") + if not second_next_step.exists: + wait_until(second_next_step.exists) + click(second_next_step) + confirm = Text("确认") + if not confirm.exists: + wait_until(confirm.exists) + click(confirm) + # 后退 + back_1 = S('a.backlink') + if not back_1.exists: + wait_until(back_1.exists) + click(back_1) + if save_result: # 进入保存页面还需要再后退一步 + back_2 = S('div.back') + if not back_2.exists: + wait_until(back_2.exists) + click(back_2) def pls(self, result=[], multiple=1, is_group=True, save_result=True): + """ + """ # 点击排列三 _pls = S('p.lottname.p3') wait_until(_pls.exists) @@ -196,6 +257,10 @@ class Chrome(object): with Chrome() as chrome: - chrome.balance() - result = ['189', '279', '269', '278', '179', '178', '259', '268', '079', '169'] - chrome.pls(result = result) \ No newline at end of file + # chrome.balance() + # 组选 + result = ['138', '048', '129', '246', '039', '238', '058', '139', '049', '148', '358', '259', '169', '349', '268'] + chrome.pls(result = result, multiple=1) + # 直选 + # result = ['925', '926', '278', '287', '219', '921', '327', '237', '274', '724'] + # chrome.pls(result=result, is_group=False) \ No newline at end of file