Skip to content

Commit

Permalink
Merge pull request #6 from MainKronos/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
MainKronos authored Nov 8, 2022
2 parents 04f859a + 0015764 commit 4580081
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions animeworld/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -149,4 +156,4 @@ def find(keyword: str) -> List[Dict]:
]

SES = MySession() # sessione contenente Cookie e headers
"Sessione requests."
"Sessione requests."
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4580081

Please sign in to comment.