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