From 7348dfb161546fe5725831821596df637e665653 Mon Sep 17 00:00:00 2001 From: DasMoorhuhn Date: Fri, 3 Feb 2023 21:48:44 +0100 Subject: [PATCH] xkcd --- src/addons.py | 15 ++++++++++++--- src/main.py | 10 ++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/addons.py b/src/addons.py index e7095e5..e6a9c21 100644 --- a/src/addons.py +++ b/src/addons.py @@ -17,12 +17,21 @@ class ProgrammerExcuses: class XKCD: def __init__(self) -> None: - self.__url = "https://xkcd.com" + self.url = "https://xkcd.com" self.__api = "info.0.json" def getRandomComic(self): - pass + response = requests.get(url=f"https://c.xkcd.com/random/comic") + with open(file="data/log/comic.html", mode="w") as file: + file.write(response.text) + file.close() + + for line in response.text: + if '