diff --git a/src/ja/nicomanga/src/eu/kanade/tachiyomi/extension/ja/nicomanga/Nicomanga.kt b/src/ja/nicomanga/src/eu/kanade/tachiyomi/extension/ja/nicomanga/Nicomanga.kt index 55d09bbc..b87201f9 100644 --- a/src/ja/nicomanga/src/eu/kanade/tachiyomi/extension/ja/nicomanga/Nicomanga.kt +++ b/src/ja/nicomanga/src/eu/kanade/tachiyomi/extension/ja/nicomanga/Nicomanga.kt @@ -60,8 +60,6 @@ class Nicomanga : HttpSource() { return MangasPage(mangas, hasNextPage) } - override fun latestUpdatesParse(response: Response): MangasPage = mangaListParse(response) - override fun latestUpdatesRequest(page: Int): Request { val url = "$baseUrl/manga-list.html".toHttpUrl().newBuilder() .addQueryParameter("page", page.toString()) @@ -71,7 +69,7 @@ class Nicomanga : HttpSource() { return GET(url) } - override fun popularMangaParse(response: Response): MangasPage = mangaListParse(response) + override fun latestUpdatesParse(response: Response): MangasPage = mangaListParse(response) override fun popularMangaRequest(page: Int): Request { val url = "$baseUrl/manga-list.html".toHttpUrl().newBuilder() @@ -82,7 +80,7 @@ class Nicomanga : HttpSource() { return GET(url) } - override fun searchMangaParse(response: Response): MangasPage = mangaListParse(response) + override fun popularMangaParse(response: Response): MangasPage = mangaListParse(response) override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { val url = "$baseUrl/manga-list.html".toHttpUrl().newBuilder() @@ -101,6 +99,8 @@ class Nicomanga : HttpSource() { return GET(url, headers) } + override fun searchMangaParse(response: Response): MangasPage = mangaListParse(response) + override fun mangaDetailsParse(response: Response): SManga = SManga.create().apply { val doc = Jsoup.parse(response.body.string()) author = doc.select("ul.manga-info a[href^=\"manga-author\"]").joinToString { it.text() } @@ -119,6 +119,11 @@ class Nicomanga : HttpSource() { } } + override fun chapterListRequest(manga: SManga): Request { + val slug = Nicomanga.urlRegex.find(manga.url)?.groupValues?.get(0) ?: "" + return GET("$baseUrl/app/manga/controllers/cont.Listchapterapi.php?slug=$slug") + } + override fun chapterListParse(response: Response): List { val doc = Jsoup.parse(response.body.string()) val chapterList = doc.select("ul > a") @@ -134,9 +139,11 @@ class Nicomanga : HttpSource() { return chapters } - override fun chapterListRequest(manga: SManga): Request { - val slug = Nicomanga.urlRegex.find(manga.url)?.groupValues?.get(0) ?: "" - return GET("$baseUrl/app/manga/controllers/cont.Listchapterapi.php?slug=$slug") + override fun pageListRequest(chapter: SChapter): Request { + val r = client.newCall(GET(getChapterUrl(chapter))).execute() + val id = Nicomanga.chapterIdRegex.find(r.body.string())?.groupValues?.get(0) ?: throw Exception("chapter-id not found") + val headers = headersBuilder().set("referer", getChapterUrl(chapter)).build() + return GET("$baseUrl/app/manga/controllers/cont.imgsList.php?cid=$id", headers) } override fun pageListParse(response: Response): List { @@ -151,13 +158,6 @@ class Nicomanga : HttpSource() { return pages } - override fun pageListRequest(chapter: SChapter): Request { - val r = client.newCall(GET(getChapterUrl(chapter))).execute() - val id = Nicomanga.chapterIdRegex.find(r.body.string())?.groupValues?.get(0) ?: throw Exception("chapter-id not found") - val headers = headersBuilder().set("referer", getChapterUrl(chapter)).build() - return GET("$baseUrl/app/manga/controllers/cont.imgsList.php?cid=$id", headers) - } - override fun imageRequest(page: Page): Request { val headers = headersBuilder().set("referer", baseUrl).build() return GET(page.imageUrl!!, headers)