diff --git a/animeworld/utility.py b/animeworld/utility.py index 786bf28..df91dc0 100644 --- a/animeworld/utility.py +++ b/animeworld/utility.py @@ -115,26 +115,33 @@ def find(keyword: str) -> List[Dict]: data = res.json() if "error" in data: return [] data = data["animes"] + + for elem in data: + for k in elem: + if elem[k] == "??": + elem[k] = None + data.sort(key=lambda a: a["dub"]) + return [ { "id": elem["id"], "name": elem["name"], "jtitle": elem["jtitle"], "studio": elem["studio"], - "release": datetime.strptime(elem["release"], "%d %B %Y"), - "episodes": int(elem["state"]), + "release": datetime.strptime(elem["release"], "%d %B %Y") if elem["release"] is not None else None, + "episodes": int(elem["episodes"]) if elem["episodes"] is not None else None, "state": elem["state"], "story": elem["story"], "categories": elem["categories"], "image": elem["image"], "durationEpisodes": elem["durationEpisodes"], - "link": f"https://www.animeworld.tv/play/{elem['link']}.{elem['identifier']}", + "link": f"https://www.animeworld.tv/play/{elem['link']}.{elem['identifier']}" if elem['link'] is not None or elem['identifier'] is not None else None, "createdAt": elem["createdAt"], "language": elem["language"], "year": elem["year"], - "dub": elem["dub"] != "0", + "dub": elem["dub"] != "0" if elem["dub"] is not None else None, "season": elem["season"], "totViews": elem["totViews"], "dayViews": elem["dayViews"], @@ -149,4 +156,4 @@ def find(keyword: str) -> List[Dict]: ] SES = MySession() # sessione contenente Cookie e headers -"Sessione requests." \ No newline at end of file +"Sessione requests." diff --git a/setup.py b/setup.py index 9812458..a5b32a1 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="animeworld", - version="1.4.21", + version="1.4.22", author="MainKronos", description="AnimeWorld UNOFFICIAL API", long_description=long_description,