Skip to content

Commit

Permalink
Update utility.py
Browse files Browse the repository at this point in the history
  • Loading branch information
MainKronos committed Feb 3, 2022
1 parent ec3daa7 commit ea0b43b
Showing 1 changed file with 30 additions and 34 deletions.
64 changes: 30 additions & 34 deletions animeworld/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,37 +81,33 @@ def find(keyword: str) -> List[Dict]:
data = res.json()["animes"]
data.sort(key=lambda a: a["dub"])

if len(data) == 0:
return None
else:
# return data
return [
{
"id": elem["id"],
"name": elem["name"],
"jtitle": elem["jtitle"],
"studio": elem["studio"],
"release": datetime.datetime.strptime(elem["release"], "%d %B %Y"),
"episodes": int(elem["state"]),
"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']}",
"createdAt": elem["createdAt"],
"language": elem["language"],
"year": elem["year"],
"dub": elem["dub"] != "0",
"season": elem["season"],
"totViews": elem["totViews"],
"dayViews": elem["dayViews"],
"weekViews": elem["weekViews"],
"monthViews": elem["monthViews"],
"malId": elem["malId"],
"anilistId": elem["anilistId"],
"mangaworldId": elem["mangaworldId"],
"malVote": elem["malVote"],
"trailer": elem["trailer"]
}for elem in data
]
return [
{
"id": elem["id"],
"name": elem["name"],
"jtitle": elem["jtitle"],
"studio": elem["studio"],
"release": datetime.datetime.strptime(elem["release"], "%d %B %Y"),
"episodes": int(elem["state"]),
"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']}",
"createdAt": elem["createdAt"],
"language": elem["language"],
"year": elem["year"],
"dub": elem["dub"] != "0",
"season": elem["season"],
"totViews": elem["totViews"],
"dayViews": elem["dayViews"],
"weekViews": elem["weekViews"],
"monthViews": elem["monthViews"],
"malId": elem["malId"],
"anilistId": elem["anilistId"],
"mangaworldId": elem["mangaworldId"],
"malVote": elem["malVote"],
"trailer": elem["trailer"]
}for elem in data
]

0 comments on commit ea0b43b

Please sign in to comment.