diff options
| author | Bobby <[email protected]> | 2024-10-06 01:59:43 -0400 |
|---|---|---|
| committer | Bobby <[email protected]> | 2024-10-06 01:59:43 -0400 |
| commit | 9d9d7db0a40849f56ca7903f79157301dc68f937 (patch) | |
| tree | d6738616d07bce5b24ee0d2f4c388de335d49c8e | |
| parent | baeebfad03e243bc2598fa7cf9195a03e5d130ae (diff) | |
| download | yugen-9d9d7db0a40849f56ca7903f79157301dc68f937.tar.xz yugen-9d9d7db0a40849f56ca7903f79157301dc68f937.zip | |
Chapter names in Manga
| -rw-r--r-- | read/utils.py | 12 | ||||
| -rw-r--r-- | watch/utils.py | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/read/utils.py b/read/utils.py index 804c619..af683bb 100644 --- a/read/utils.py +++ b/read/utils.py @@ -12,13 +12,21 @@ def get_manga_data(manga_id): manga_data = get_from_redis_cache(cache_key) if not manga_data: - base_url = f"{os.getenv('CONSUMET_URL')}/meta/anilist-manga/info/{manga_id}" + base_url = f"{os.getenv('CONSUMET_URL')}/meta/anilist-manga/info/{manga_id}?provider=mangareader" print(f"Trying URL: {base_url}") response = requests.get(base_url, timeout=10) manga_data = response.json() if "message" in manga_data: - return None + base_url = f"{os.getenv('CONSUMET_URL')}/meta/anilist-manga/info/{manga_id}" + print(f"Trying URL: {base_url}") + response = requests.get(base_url, timeout=10) + manga_data = response.json() + + if "message" in manga_data: + return None + else: + manga_data["chapters"] = list(filter(lambda x: "/en/" in x["id"], manga_data["chapters"])) if "status" in manga_data and manga_data["status"] == "Completed": store_in_redis_cache(cache_key, json.dumps(manga_data), 3600 * 24 * 30) diff --git a/watch/utils.py b/watch/utils.py index c488948..23c82ec 100644 --- a/watch/utils.py +++ b/watch/utils.py @@ -24,8 +24,8 @@ r = redis.Redis( password=os.getenv("REDIS_PASSWORD"), ) -# r.flushall() -# print("Redis cache flushed") +r.flushall() +print("Redis cache flushed") def get_episode_metadata(anime_data, episode): episode_metadata = get_all_episode_metadata(anime_data) |
