[REPO REFACTOR]: changed to a better git repository structure with branches

This commit is contained in:
2025-11-01 06:12:45 +01:00
parent b218dd3f77
commit f0b04fcaad
36 changed files with 1366 additions and 0 deletions

24
util/anime.py Normal file
View File

@@ -0,0 +1,24 @@
import requests
class Anime:
def __init__(self):
self.base_url = f"https://api.waifu.pics/"
def get(self, type: str, category: str) -> None:
if type != "nsfw" and type != "sfw":
raise Exception("Type not supported!")
if not isinstance(category, str):
raise Exception("Category must be a string!")
response = requests.get(f"{self.base_url}/{type}/{category}")
if response.status_code != 200:
raise Exception("Failed to retrieve data from API!")
return response.json()["url"]
def sfw(self, category: str) -> str:
return self.get("sfw", category)
def nsfw(self, category: str) -> str:
return self.get("nsfw", category)