Skip to content

Commit

Permalink
mangaplus: update to titile_detailV3
Browse files Browse the repository at this point in the history
  • Loading branch information
TAAPArthur committed Jun 2, 2024
1 parent beef732 commit 8cc96a5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions amt/servers/mangaplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Mangaplus(Server):
base_url = f"https://{domain}"
api_url = "https://jumpg-webapi.tokyo-cdn.com/api"
api_list_url = api_url + "/title_list/all?format=json"
api_media_url = api_url + "/title_detail?title_id={0}&format=json"
api_media_url = api_url + "/title_detailV3?title_id={0}&format=json"
api_chapter_url = api_url + "/manga_viewer?chapter_id={0}&split=yes&img_quality=high&format=json"
media_url = base_url + "/titles/{0}?format=json"

Expand All @@ -38,11 +38,13 @@ def get_media_list(self, **kwargs):
yield self.create_media_data(id=series["titleId"], name=series["name"], lang=series.get("language", "English").lower())

def update_media_data(self, media_data, **kwargs):
r = self.session_get(self.api_media_url.format(media_data["id"]))
series_info = r.json()["success"]["titleDetailView"]
for chapter in series_info["firstChapterList"] + series_info.get("lastChapterList", []):
number = chapter["name"][1:] if chapter["name"][0] == "#" else chapter["name"]
self.update_chapter_data(media_data, id=chapter["chapterId"], title=chapter["subTitle"], number=number)
data = self.session_get_cache_json(self.api_media_url.format(media_data["id"]))
series_info = data["success"]["titleDetailView"]
for chapter_info in series_info["chapterListGroup"]:
for key in ("firstChapterList", "midChapterList", "lastChapterList"):
for chapter in chapter_info.get(key, []):
number = chapter["name"][1:] if chapter["name"][0] == "#" else chapter["name"]
self.update_chapter_data(media_data, id=chapter["chapterId"], title=chapter["subTitle"], number=number)
media_data["nextTimeStamp"] = series_info.get("nextTimeStamp", 0)

def get_media_chapter_data(self, media_data, chapter_data, stream_index=0):
Expand Down

0 comments on commit 8cc96a5

Please sign in to comment.