From 71cd52b7ca2c867f379743f1e8873b343a12df3d Mon Sep 17 00:00:00 2001 From: Techwolf Date: Sat, 8 Jan 2022 21:49:08 -0800 Subject: [PATCH] Fix MangaDex site engine --- dosagelib/plugins/mangadex.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dosagelib/plugins/mangadex.py b/dosagelib/plugins/mangadex.py index 4d674087f..d244aa885 100644 --- a/dosagelib/plugins/mangadex.py +++ b/dosagelib/plugins/mangadex.py @@ -16,6 +16,7 @@ class MangaDex(_ParserScraper): self.url = baseUrl + 'manga/%s' % mangaId self.chaptersUrl = baseUrl + 'manga/%s/feed?translatedLanguage[]=en&order[chapter]=desc&limit=500' % mangaId self.stripUrl = baseUrl + 'chapter/%s' + self.cdnUrl = baseUrl + 'at-home/server/%s' self.imageUrl = 'https://s5.mangadex.org/data/%s/%%s' def starter(self): @@ -75,10 +76,13 @@ class MangaDex(_ParserScraper): # Retrieve chapter metadata from API chapterData = json.loads(data.text_content()) self.chapter = chapterData['data'] + cdnData = self.session.get(self.cdnUrl % self.chapter['id']) + cdnData.raise_for_status() + cdnBlock = cdnData.json() # Save link order for position-based filenames - imageUrl = self.imageUrl % self.chapter['attributes']['hash'] - self.imageUrls = [imageUrl % page for page in self.chapter['attributes']['data']] + imageUrl = self.imageUrl % cdnBlock['chapter']['hash'] + self.imageUrls = [imageUrl % page for page in cdnBlock['chapter']['data']] return self.imageUrls def namer(self, imageUrl, pageUrl):