bugfix: 修复3d数据获取出错

This commit is contained in:
chenwj113 2023-05-03 09:45:25 +08:00
parent 727da85755
commit 8ac58d4f24
1 changed files with 8 additions and 2 deletions

View File

@ -15,13 +15,14 @@ def get_data_job(lottery_type='pls'):
""" """
:param lottery_type :param lottery_type
""" """
print("pls: I'm working...")
url = f"https://kaijiang.500.com/{lottery_type}.shtml" url = f"https://kaijiang.500.com/{lottery_type}.shtml"
r = session.get(url) r = session.get(url)
if lottery_type == 'pls': if lottery_type == 'pls':
issue_elem = r.html.search('排列3 第 {}') issue_elem = r.html.search('排列3 第 {}')
else: elif lottery_type == 'plw':
issue_elem = r.html.search('排列5 第 {}') issue_elem = r.html.search('排列5 第 {}')
else:
issue_elem = r.html.search('福彩3D 第 {}')
draw_date = r.html.xpath('//td[@class="td_title01"]/span[@class="span_right"]/text()', first=True) draw_date = r.html.xpath('//td[@class="td_title01"]/span[@class="span_right"]/text()', first=True)
result = r.html.xpath('//li[@class="ball_orange"]/text()') result = r.html.xpath('//li[@class="ball_orange"]/text()')
if issue_elem is not None and draw_date is not None and result is not None and len(result) != 0 : if issue_elem is not None and draw_date is not None and result is not None and len(result) != 0 :
@ -35,6 +36,7 @@ def get_data_job(lottery_type='pls'):
else: else:
print(f'issue:{draw_issue}已经存在') print(f'issue:{draw_issue}已经存在')
@repeat(every().day.at("00:01")) @repeat(every().day.at("00:01"))
def pls_job(): def pls_job():
get_data_job(lottery_type='pls') get_data_job(lottery_type='pls')
@ -43,6 +45,10 @@ def pls_job():
def plw_job(): def plw_job():
get_data_job(lottery_type='plw') get_data_job(lottery_type='plw')
@repeat(every().day.at("00:03"))
def sd_job():
get_data_job(lottery_type='sd')
while True: while True:
run_pending() run_pending()
time.sleep(1) time.sleep(1)