change schedule

add block needle
This commit is contained in:
2024-11-18 10:21:32 +03:30
parent e022c2cf6b
commit b77d3294c9
2 changed files with 4 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ on:
branches: branches:
- main - main
schedule: schedule:
- cron: "30 2-20/6 * * *" - cron: "30 */3 * * *"
jobs: jobs:
run-script: run-script:

View File

@@ -32,10 +32,11 @@ def make_message(html: str) -> str:
soup = BeautifulSoup(html, 'html.parser') soup = BeautifulSoup(html, 'html.parser')
# table = soup.find('table', id='ctl01_ctl00_myDataList') # table = soup.find('table', id='ctl01_ctl00_myDataList')
block_needle = 'بلوك A2'
paragraphs = soup.find_all('p') 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: if not block:
return "اطلاعات بلوك B2 یافت نشد!" return f"اطلاعات {block_needle} یافت نشد!"
time_index = paragraphs.index(block) - 1 time_index = paragraphs.index(block) - 1
return paragraphs[time_index].get_text(separator='\n', strip=True) return paragraphs[time_index].get_text(separator='\n', strip=True)