新增相关文件
This commit is contained in:
parent
5e38fc6df7
commit
6153538672
14
auto.py
14
auto.py
|
|
@ -1,11 +1,15 @@
|
|||
from helium import *
|
||||
from selenium.webdriver import ChromeOptions
|
||||
import time
|
||||
|
||||
chrome_options = ChromeOptions()
|
||||
mobile_emulation = {'deviceName': 'iPhone XR'}
|
||||
chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
|
||||
from helium import *
|
||||
from selenium.webdriver import ChromeOptions
|
||||
|
||||
chrome_options = ChromeOptions()
|
||||
chrome_options.add_argument('--no-sandbox')
|
||||
# chrome_options.add_argument('--headless')
|
||||
# mobile_emulation = {'deviceName': 'Apple iPhone XR'}
|
||||
# chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
|
||||
# chrome_options.add_argument('user-agent="MQQBrowser/26 Mozilla/5.0 (Linux; U; Android 2.3.7; zh-cn; MB200 Build/GRJ22; CyanogenMod-7) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"')
|
||||
chrome_options.add_argument('user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 16_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.29(0x18001d36) NetType/WIFI Language/zh_CN"')
|
||||
start_chrome("https://youdian.jindianle.com/", options=chrome_options)
|
||||
click(Text("您尚未登录,点击登录"))
|
||||
click(Text("密码登录"))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,98 @@
|
|||
import time
|
||||
import traceback
|
||||
|
||||
from helium import *
|
||||
from selenium.webdriver import ChromeOptions
|
||||
|
||||
chrome_options = ChromeOptions()
|
||||
mobile_emulation = {'deviceName': 'iPad Mini'}
|
||||
chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
|
||||
#chrome_options.add_experimental_option('excludeSwitches', ['enable-automation'])
|
||||
#chrome_options.add_experimental_option('useAutomationExtension', False)
|
||||
chrome_options.add_argument('--no-sandbox')
|
||||
# chrome_options.add_argument('--headless')
|
||||
chrome_options.add_argument('user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"')
|
||||
driver = start_chrome("https://youdian.jindianle.com/", options=chrome_options)
|
||||
try:
|
||||
click(Text("您尚未登录,点击登录"))
|
||||
click(Text("密码登录"))
|
||||
write("15359827092", into="请输入手机号")
|
||||
write("c113w927j", into="请输入6-12位数字或字母")
|
||||
click(Button("登 录"))
|
||||
# 进入页面先点击关闭弹窗按钮
|
||||
_close = S('//*[@id="vue2_el"]/div/div[10]/div/p')
|
||||
click(_close)
|
||||
|
||||
#店内账本
|
||||
# click(Text("店内账本"))
|
||||
# moneynum = S('//span[contains(@class, "gray3") and contains(@class, "moneynum")]')
|
||||
# wait_until(moneynum.exists)
|
||||
# if moneynum is not None:
|
||||
# balance = moneynum.web_element.text
|
||||
# print(f"金额还剩:{balance}")
|
||||
# else:
|
||||
# print("元素未找到")
|
||||
# # 回退
|
||||
# back = S('#vue2_el > header > div.back > a')
|
||||
# click(back)
|
||||
|
||||
#选号记录
|
||||
# click(Text("选号记录"))
|
||||
# # 回退
|
||||
# back = S('#vue2_el > header > div.back > a')
|
||||
# click(back)
|
||||
|
||||
|
||||
# 点击排列三
|
||||
pls = S('//*[@id="vue2_el"]/div/section/div[6]/div[4]/div[3]')
|
||||
wait_until(pls.exists)
|
||||
click(pls)
|
||||
wait_until(Text('组选').exists)
|
||||
click(Text('组选'))
|
||||
# 普通投注-> 取消组3
|
||||
result = ['258', '357', '069', '168', '078', '267', '159', '339', '177', '366']
|
||||
for index, item in enumerate(result):
|
||||
if len(set(item)) == 3:
|
||||
click(Text('普通投注'))
|
||||
for i in item:
|
||||
ball_line = S(f'//*[@id="body"]/section/div[3]/div[2]/ul/li[{int(i) + 1}]/p[1]')
|
||||
if ball_line.exists:
|
||||
print(ball_line.web_element.text)
|
||||
click(ball_line)
|
||||
else:
|
||||
print(f"{i}不存在")
|
||||
wait_until(Text("组3").exists)
|
||||
click(Text("组3"))
|
||||
else:
|
||||
click(Text('组3单式'))
|
||||
if item[0] == item[1]:
|
||||
double_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[0]) + 1}]/p')
|
||||
single_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[2]) + 1}]/p')
|
||||
else:
|
||||
double_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[2]) + 1}]/p')
|
||||
single_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[0]) + 1}]/p')
|
||||
click(double_ball)
|
||||
click(single_ball)
|
||||
print(f"{index}: {item}")
|
||||
wait_until(Text("下一步").exists)
|
||||
click(Text("下一步"))
|
||||
if index + 1 != len(result):
|
||||
wait_until(Text("+继续添加").exists)
|
||||
click(Text("+继续添加"))
|
||||
wait_until(Text("保存").exists)
|
||||
click(Text("保存"))
|
||||
|
||||
# # 设置倍数后,再点击一次下一步
|
||||
# plus = Text("+")
|
||||
# # click(plus)
|
||||
# wait_until(Text("下一步").exists)
|
||||
# click(Text("下一步"))
|
||||
|
||||
# # 最后一步, 点击确认
|
||||
# wait_until(Text("确认").exists)
|
||||
# click(Text("确认"))
|
||||
print("完成。。。")
|
||||
kill_browser()
|
||||
except Exception as e:
|
||||
print(traceback.format_exc())
|
||||
kill_browser()
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
import time
|
||||
import traceback
|
||||
|
||||
from helium import *
|
||||
from selenium.webdriver import ChromeOptions
|
||||
|
||||
chrome_options = ChromeOptions()
|
||||
mobile_emulation = {'deviceName': 'iPhone XR'}
|
||||
chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
|
||||
#chrome_options.add_experimental_option('excludeSwitches', ['enable-automation'])
|
||||
#chrome_options.add_experimental_option('useAutomationExtension', False)
|
||||
chrome_options.add_argument('--no-sandbox')
|
||||
# chrome_options.add_argument('--headless')
|
||||
chrome_options.add_argument('user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"')
|
||||
driver = start_chrome("https://youdian.jindianle.com/", options=chrome_options)
|
||||
try:
|
||||
click(Text("您尚未登录,点击登录"))
|
||||
click(Text("密码登录"))
|
||||
write("15359827092", into="请输入手机号")
|
||||
write("c113w927j", into="请输入6-12位数字或字母")
|
||||
click(Button("登 录"))
|
||||
# 进入页面先点击关闭弹窗按钮
|
||||
_close = S('//*[@id="vue2_el"]/div/div[10]/div/p')
|
||||
click(_close)
|
||||
|
||||
#店内账本
|
||||
# click(Text("店内账本"))
|
||||
# moneynum = S('//span[contains(@class, "gray3") and contains(@class, "moneynum")]')
|
||||
# wait_until(moneynum.exists)
|
||||
# if moneynum is not None:
|
||||
# balance = moneynum.web_element.text
|
||||
# print(f"金额还剩:{balance}")
|
||||
# else:
|
||||
# print("元素未找到")
|
||||
# # 回退
|
||||
# back = S('#vue2_el > header > div.back > a')
|
||||
# click(back)
|
||||
|
||||
#选号记录
|
||||
# click(Text("选号记录"))
|
||||
# # 回退
|
||||
# back = S('#vue2_el > header > div.back > a')
|
||||
# click(back)
|
||||
|
||||
|
||||
# 点击排列三
|
||||
pls = S('//*[@id="vue2_el"]/div/section/div[6]/div[4]/div[3]')
|
||||
wait_until(pls.exists)
|
||||
click(pls)
|
||||
wait_until(Text('组选').exists)
|
||||
click(Text('组选'))
|
||||
click(Text('普通投注'))
|
||||
# 普通投注-> 取消组3
|
||||
#
|
||||
result = ['168', '069', '348', '249', '078']
|
||||
for index, item in enumerate(result):
|
||||
for i in item:
|
||||
i = int(i) + 1
|
||||
ball_line = S(f'//*[@id="body"]/section/div[3]/div[2]/ul/li[{i}]/p[1]')
|
||||
if ball_line.exists:
|
||||
click(ball_line)
|
||||
else:
|
||||
print(f"{i-1}不存在")
|
||||
print(f"{index}: {item}")
|
||||
wait_until(Text("组3").exists)
|
||||
click(Text("组3"))
|
||||
wait_until(Text("下一步").exists)
|
||||
click(Text("下一步"))
|
||||
if index + 1 != len(result):
|
||||
wait_until(Text("+继续添加").exists)
|
||||
click(Text("+继续添加"))
|
||||
wait_until(Text("保存").exists)
|
||||
click(Text("保存"))
|
||||
|
||||
# # 设置倍数后,再点击一次下一步
|
||||
# plus = Text("+")
|
||||
# # click(plus)
|
||||
# wait_until(Text("下一步").exists)
|
||||
# click(Text("下一步"))
|
||||
|
||||
# # 最后一步, 点击确认
|
||||
# wait_until(Text("确认").exists)
|
||||
# click(Text("确认"))
|
||||
print("完成。。。")
|
||||
kill_browser()
|
||||
except Exception as e:
|
||||
print(traceback.format_exc())
|
||||
kill_browser()
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
# import traceback
|
||||
from email.mime.text import MIMEText
|
||||
from smtplib import SMTP_SSL
|
||||
|
||||
from helium import *
|
||||
from selenium.webdriver import ChromeOptions
|
||||
|
||||
|
||||
class Chrome(object):
|
||||
def __init__(self, mobile=True, headless=True):
|
||||
self.mobile_emulation = {'deviceName': 'iPad Mini'}
|
||||
self.mobile = mobile
|
||||
self.headless = headless
|
||||
|
||||
|
||||
def __enter__(self):
|
||||
chrome_options = ChromeOptions()
|
||||
chrome_options.add_argument('--no-sandbox')
|
||||
if self.headless:
|
||||
chrome_options.add_argument('--headless')
|
||||
if self.mobile:
|
||||
chrome_options.add_experimental_option("mobileEmulation", self.mobile_emulation)
|
||||
chrome_options.add_argument('user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"')
|
||||
start_chrome("https://youdian.jindianle.com/", options=chrome_options)
|
||||
click(Text("您尚未登录,点击登录"))
|
||||
click(Text("密码登录"))
|
||||
write("15359827092", into="请输入手机号")
|
||||
write("c113w927j", into="请输入6-12位数字或字母")
|
||||
click(Button("登 录"))
|
||||
# 进入页面先点击关闭弹窗按钮
|
||||
_close = S('//*[@id="vue2_el"]/div/div[10]/div/p')
|
||||
click(_close)
|
||||
return self
|
||||
|
||||
def __exit__(self, type, value, trace):
|
||||
kill_browser()
|
||||
print("type: " + type + ", value = " + value)
|
||||
|
||||
|
||||
def balance(self):
|
||||
#店内账本
|
||||
click(Text("店内账本"))
|
||||
moneynum = S('//span[contains(@class, "gray3") and contains(@class, "moneynum")]')
|
||||
wait_until(moneynum.exists)
|
||||
if moneynum is not None:
|
||||
balance = moneynum.web_element.text
|
||||
print(f"金额还剩:{balance}")
|
||||
else:
|
||||
print("元素未找到")
|
||||
# 回退
|
||||
back = S('#vue2_el > header > div.back > a')
|
||||
click(back)
|
||||
|
||||
def pls(self, result=[]):
|
||||
# 点击排列三
|
||||
_pls = S('//*[@id="vue2_el"]/div/section/div[6]/div[4]/div[3]')
|
||||
wait_until(_pls.exists)
|
||||
click(_pls)
|
||||
zx = Text('组选')
|
||||
if not zx.exists:
|
||||
wait_until(zx.exists)
|
||||
click(zx)
|
||||
# 普通投注-> 取消组3
|
||||
# result = ['258', '357', '069', '168', '078', '267', '159', '339', '177', '366']
|
||||
for index, item in enumerate(result):
|
||||
if len(set(item)) == 3:
|
||||
click(Text('普通投注'))
|
||||
for i in item:
|
||||
ball_line = S(f'//*[@id="body"]/section/div[3]/div[2]/ul/li[{int(i) + 1}]/p[1]')
|
||||
if ball_line.exists:
|
||||
print(ball_line.web_element.text)
|
||||
click(ball_line)
|
||||
else:
|
||||
print(f"{i}不存在")
|
||||
group3 = Text("组3")
|
||||
if not group3.exists:
|
||||
wait_until(group3.exists)
|
||||
click(group3)
|
||||
else:
|
||||
click(Text('组3单式'))
|
||||
if item[0] == item[1]:
|
||||
double_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[0]) + 1}]/p')
|
||||
single_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[2]) + 1}]/p')
|
||||
else:
|
||||
double_ball = S(f'//*[@id="body"]/section/div[3]/div[1]/div[2]/ul/li[{int(item[2]) + 1}]/p')
|
||||
single_ball = S(f'//*[@id="body"]/section/div[3]/div[2]/div[2]/ul/li[{int(item[0]) + 1}]/p')
|
||||
click(double_ball)
|
||||
click(single_ball)
|
||||
print(f"{index}: {item}")
|
||||
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("+继续添加"))
|
||||
#div.mult_numkeyboard > ul > li:nth-child(1) > p
|
||||
#div.mult_numkeyboard > ul > li:nth-child(2) > p
|
||||
#div.mult_numkeyboard > ul > li:nth-child(11) > p
|
||||
save = Text("保存")
|
||||
if not save.exists:
|
||||
wait_until(save.exists)
|
||||
click(save)
|
||||
back_1 = S('a.backlink')
|
||||
if not back_1.exists:
|
||||
wait_until(back_1.exists)
|
||||
click(back_1)
|
||||
back_2 = S('div.back')
|
||||
if not back_2.exists:
|
||||
wait_until(back_2.exists)
|
||||
click(back_2)
|
||||
|
||||
|
||||
|
||||
with Chrome(headless=False) as chrome:
|
||||
chrome.balance()
|
||||
chrome.pls(result = ['258', '357', '069', '168', '078'])
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
# import traceback
|
||||
from email.mime.text import MIMEText
|
||||
from smtplib import SMTP_SSL
|
||||
|
||||
from helium import *
|
||||
from selenium.webdriver import ChromeOptions
|
||||
|
||||
|
||||
class Fund(object):
|
||||
def __init__(self, mobile=True, headless=True):
|
||||
self.mobile_emulation = {'deviceName': 'iPad Mini'}
|
||||
self.mobile = mobile
|
||||
self.headless = headless
|
||||
|
||||
|
||||
def __enter__(self):
|
||||
chrome_options = ChromeOptions()
|
||||
chrome_options.add_argument('--no-sandbox')
|
||||
if self.headless:
|
||||
chrome_options.add_argument('--headless')
|
||||
if self.mobile:
|
||||
chrome_options.add_experimental_option("mobileEmulation", self.mobile_emulation)
|
||||
chrome_options.add_argument('user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"')
|
||||
start_chrome("https://login.1234567.com.cn/login", options=chrome_options)
|
||||
|
||||
return self
|
||||
|
||||
def __exit__(self, type, value, trace):
|
||||
print("type: ", type )
|
||||
print("value: ", value)
|
||||
kill_browser()
|
||||
|
||||
|
||||
def login(self):
|
||||
write('15359827092', into=S('input#tbname'))
|
||||
write('c113w927j', into=S('input#tbpwd'))
|
||||
click(S('input#protocolCheckbox'))
|
||||
click(S('a#btn_login'))
|
||||
|
||||
def my_assets(self):
|
||||
click(S('a.aui_close'))
|
||||
elem_all_value = S('span#all_value')
|
||||
wait_until(elem_all_value.exists)
|
||||
print("资产总额:")
|
||||
print(elem_all_value.web_element.text)
|
||||
|
||||
|
||||
with Fund(headless=False, mobile=False) as fund:
|
||||
fund.login()
|
||||
fund.my_assets()
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
from requests_html import HTMLSession, HTML
|
||||
from requests_html import HTML, HTMLSession
|
||||
from retrying import retry
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from retrying import retry
|
||||
|
||||
from lottery import Lottery
|
||||
|
||||
|
||||
session = HTMLSession()
|
||||
|
||||
@retry(stop_max_attempt_number=3)
|
||||
|
|
@ -18,9 +17,9 @@ def _get_data(url, lottery_type):
|
|||
draw_code = table_list.find("div.ball_box01")[0].text.replace('\n', '')
|
||||
last_id = lottery.insert(draw_issue, draw_date, draw_code)
|
||||
if last_id:
|
||||
print(f"issue:{issue}数据写入完成。。。")
|
||||
print(f"issue:{draw_issue}数据写入完成。。。")
|
||||
else:
|
||||
print(f'issue:{issue}已经存在')
|
||||
print(f'issue:{draw_issue}已经存在')
|
||||
|
||||
def get_data(url, lottery_type):
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in New Issue