From b77d3294c91180adfe03a40e3043ea86a780c04f Mon Sep 17 00:00:00 2001 From: Meghdad Date: Mon, 18 Nov 2024 10:21:32 +0330 Subject: [PATCH] change schedule add block needle --- .github/workflows/run-script.yml | 2 +- main.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-script.yml b/.github/workflows/run-script.yml index d78f060..86b9aad 100644 --- a/.github/workflows/run-script.yml +++ b/.github/workflows/run-script.yml @@ -5,7 +5,7 @@ on: branches: - main schedule: - - cron: "30 2-20/6 * * *" + - cron: "30 */3 * * *" jobs: run-script: diff --git a/main.py b/main.py index 929987a..1af8828 100644 --- a/main.py +++ b/main.py @@ -32,10 +32,11 @@ def make_message(html: str) -> str: soup = BeautifulSoup(html, 'html.parser') # table = soup.find('table', id='ctl01_ctl00_myDataList') + block_needle = 'بلوك A2' paragraphs = soup.find_all('p') - block = soup.find('p', string=lambda text: isinstance(text, str) and 'بلوك B2' in text) + block = soup.find('p', string=lambda text: isinstance(text, str) and block_needle in text) if not block: - return "اطلاعات بلوك B2 یافت نشد!" + return f"اطلاعات {block_needle} یافت نشد!" time_index = paragraphs.index(block) - 1 return paragraphs[time_index].get_text(separator='\n', strip=True)