Add in forever loop and remove redundant def

This commit is contained in:
Brian Read 2025-02-27 10:17:53 +00:00
parent 72dd1383ee
commit 985aa30648

View File

@ -40,32 +40,6 @@ import argparse
def join_lines_with_newline(lines):
return "\n".join(lines)
def extract_changelog_top(Wiki_link):
response = requests.get(Wiki_link)
soup = BeautifulSoup(response.text, 'html.parser')
changelog_td = soup.find('td', class_='changelog')
if changelog_td:
changelog_text = changelog_td.get_text(strip=False)
lines = changelog_text.split('\n')
result = []
seen = set()
for line in lines:
stripped_line = line.strip()
if not stripped_line:
if result: # Stop at the first blank line after content
break
continue
if stripped_line not in seen:
seen.add(stripped_line)
if not result or stripped_line.startswith('-'):
result.append(stripped_line)
return join_lines_with_newline(result)
else:
return []
# Wiki RSS feed URL
Wiki_RSS_URL = "https://wiki.koozali.org/api.php?hidebots=1&urlversion=2&days=7&limit=50&action=feedrecentchanges&feedformat=rss"
# Updated Rocket.Chat webhook URL
@ -159,6 +133,7 @@ def main(one_shot=False, empty_db=False):
send_startup_message() # Send startup message
while True
entries = fetch_Wiki_feed()
for entry in entries: