import requests import json from models.xkcdComic import Comic class ProgrammerExcuses: def __init__(self) -> None: self.url = "http://programmingexcuses.com" def get_excuse(self): page = requests.get(url=self.url) content = page.content.decode().split("\n") for html in content: if 'href="/"' in html: start_index = html.find('3;">') end_index = html.find("") return html[start_index + 4:end_index] class XKCD: def __init__(self) -> None: self.url = "https://xkcd.com" self.api = "info.0.json" def get_random_comic(self): response = requests.get(url=f"https://c.xkcd.com/random/comic") for line in response.text.split("\n"): if '