From 8ac58d4f242c4e48fa45738512aa5b33029747ba Mon Sep 17 00:00:00 2001 From: chenwj113 Date: Wed, 3 May 2023 09:45:25 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8D3d=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=8E=B7=E5=8F=96=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasks/cron_tasks.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tasks/cron_tasks.py b/tasks/cron_tasks.py index 868a985..df088f3 100644 --- a/tasks/cron_tasks.py +++ b/tasks/cron_tasks.py @@ -15,13 +15,14 @@ def get_data_job(lottery_type='pls'): """ :param lottery_type """ - print("pls: I'm working...") url = f"https://kaijiang.500.com/{lottery_type}.shtml" r = session.get(url) if lottery_type == 'pls': issue_elem = r.html.search('排列3 第 {}期') - else: + elif lottery_type == 'plw': 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) 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 : @@ -35,6 +36,7 @@ def get_data_job(lottery_type='pls'): else: print(f'issue:{draw_issue}已经存在') + @repeat(every().day.at("00:01")) def pls_job(): get_data_job(lottery_type='pls') @@ -43,6 +45,10 @@ def pls_job(): def plw_job(): get_data_job(lottery_type='plw') +@repeat(every().day.at("00:03")) +def sd_job(): + get_data_job(lottery_type='sd') + while True: run_pending() time.sleep(1) \ No newline at end of file