feat: add type selector and limit results based on set type

This commit is contained in:
2025-05-11 14:16:56 +02:00
parent 49871c1d6e
commit 1d0f293e19
3 changed files with 19 additions and 5 deletions

View File

@@ -36,12 +36,15 @@ async def fetch_data(
) -> List[Dict[str, Any]]:
async with httpx.AsyncClient() as client:
try:
variables: Dict[str, Any] = {"search": data["query"], "type": "MANGA"}
variables: Dict[str, Any] = {"search": data["query"]}
if data.get("genres"):
variables["genres"] = data["genres"]
if data.get("tags"):
variables["tags"] = data["tags"]
# print(data["query"], variables)
if data.get("type"):
if data["type"] in ["MANGA", "NOVEL"]:
variables["format"] = data["type"]
print(data["query"], variables)
response = await client.post(
"https://graphql.anilist.co",
json={