diff options
| author | Fuwn <[email protected]> | 2023-07-26 22:12:26 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-07-26 22:12:26 -0700 |
| commit | a95b5dafc051df577f5bc55699657a4f8995a73e (patch) | |
| tree | 0f6de346be1c6718734b6b352f996eb227260caf | |
| parent | feat(html): sort by available (diff) | |
| download | old.due.moe-a95b5dafc051df577f5bc55699657a4f8995a73e.tar.xz old.due.moe-a95b5dafc051df577f5bc55699657a4f8995a73e.zip | |
fix(html): initial search with native title
| -rw-r--r-- | src/due/html.py | 15 | ||||
| -rw-r--r-- | src/due/media.py | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/due/html.py b/src/due/html.py index 7bd32ed..27eb13a 100644 --- a/src/due/html.py +++ b/src/due/html.py @@ -76,7 +76,7 @@ def manga_to_html(releasing_outdated_manga, show_missing): def process(media): manga = media["media"] - title = manga["title"]["english"] + title = manga["title"]["native"] id = manga["id"] if id in ids: @@ -94,9 +94,6 @@ def manga_to_html(releasing_outdated_manga, show_missing): if available <= 0: available = "?" - if title is None: - title = manga["title"]["romaji"] - mangadex_data = cache.get(str(manga["id"]) + "id") mangadex_id = None @@ -106,6 +103,7 @@ def manga_to_html(releasing_outdated_manga, show_missing): params={"title": title, "year": manga["startDate"]["year"]}, ).json()["data"] + # This is very stupid. It should never get this far, anyway. if len(mangadex_data) == 0: mangadex_data = requests.get( "https://api.mangadex.org/manga", @@ -115,6 +113,15 @@ def manga_to_html(releasing_outdated_manga, show_missing): }, ).json()["data"] + if len(mangadex_data) == 0: + mangadex_data = requests.get( + "https://api.mangadex.org/manga", + params={ + "title": manga["title"]["romaji"], + "year": manga["startDate"]["year"], + }, + ).json()["data"] + cache.set(str(manga["id"]) + "id", mangadex_data) if len(mangadex_data) == 0: diff --git a/src/due/media.py b/src/due/media.py index c4be6c9..5dde303 100644 --- a/src/due/media.py +++ b/src/due/media.py @@ -96,7 +96,7 @@ def media_list_collection_query(user_id: int, type) -> str: id status type - title {{ romaji english }} + title {{ romaji english native }} nextAiringEpisode {{ episode }} mediaListEntry {{ progress }} startDate {{ year }} |