From dab4e41de0bbc0a33532800f226f98bf04a8485d Mon Sep 17 00:00:00 2001 From: t3xhno Date: Tue, 6 Feb 2024 21:24:04 +0100 Subject: [PATCH] Added link to tasks --- functions.py | 2 +- scraper_functions.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/functions.py b/functions.py index 079b037..23872fb 100644 --- a/functions.py +++ b/functions.py @@ -24,6 +24,6 @@ def command(msg, rcpt): cmd, query = msg.split(" ", 1) return sf.query_external_website("https://en.wikipedia.org", "/wiki/" + query) elif msg.startswith("!tasks"): - content = sf.getDmzTasks() + content = sf.getDmzTasks("https://todo.dmz.rs/") return content diff --git a/scraper_functions.py b/scraper_functions.py index 0653206..026509e 100644 --- a/scraper_functions.py +++ b/scraper_functions.py @@ -18,16 +18,16 @@ def query_external_website(base_url, query): except Exception as e: return e -def getDmzTasks(): +def getDmzTasks(url): try: - page = requests.get("https://todo.dmz.rs/") + page = requests.get(url) soup = BeautifulSoup(page.content, "html.parser") tasks = soup.find_all(class_="task") result = "\nActive tasks:\n" for task in tasks: taskIndex = task.select("div")[0].text taskTitle = task.select("div")[1].text - result += taskIndex + " " + taskTitle + "\n" + result += taskIndex + " " + taskTitle + "|" + " Link: " + url + task.find("a")["href"][1:] + "\n" return result except Exception as e: return e