diff --git a/src/en/mangakakalot/build.gradle b/src/en/mangakakalot/build.gradle index 3dabda388..107c34296 100644 --- a/src/en/mangakakalot/build.gradle +++ b/src/en/mangakakalot/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: MangaKakalot' pkgNameSuffix = 'en.mangakakalot' extClass = '.Mangakakalot' - extVersionCode = 3 + extVersionCode = 4 libVersion = '1.2' } diff --git a/src/en/mangakakalot/src/eu/kanade/tachiyomi/extension/en/mangakakalot/Mangakakalot.kt b/src/en/mangakakalot/src/eu/kanade/tachiyomi/extension/en/mangakakalot/Mangakakalot.kt index 7bd92f929..68ea04fd7 100644 --- a/src/en/mangakakalot/src/eu/kanade/tachiyomi/extension/en/mangakakalot/Mangakakalot.kt +++ b/src/en/mangakakalot/src/eu/kanade/tachiyomi/extension/en/mangakakalot/Mangakakalot.kt @@ -1,12 +1,13 @@ package eu.kanade.tachiyomi.extension.en.mangakakalot import eu.kanade.tachiyomi.network.GET -import eu.kanade.tachiyomi.source.model.* +import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.model.Page +import eu.kanade.tachiyomi.source.model.SChapter +import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.ParsedHttpSource -import eu.kanade.tachiyomi.util.asJsoup import okhttp3.OkHttpClient import okhttp3.Request -import okhttp3.Response import org.jsoup.nodes.Document import org.jsoup.nodes.Element @@ -25,7 +26,6 @@ class Mangakakalot : ParsedHttpSource() { override fun popularMangaSelector() = "div.truyen-list > div.list-truyen-item-wrap" override fun popularMangaRequest(page: Int): Request { - return GET("$baseUrl/manga_list?type=topview&category=all&state=all&page=$page") } @@ -35,16 +35,6 @@ class Mangakakalot : ParsedHttpSource() { return GET("$baseUrl/manga_list?type=latest&category=all&state=all&page=$page") } - override fun latestUpdatesParse(response: Response): MangasPage { - val document = response.asJsoup() - - val mangas = document.select(latestUpdatesSelector()).map { element -> - latestUpdatesFromElement(element) - } - - return MangasPage(mangas, hasNextPage(document)) - } - override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() element.select("h3 a").first().let { @@ -55,74 +45,36 @@ class Mangakakalot : ParsedHttpSource() { return manga } - override fun popularMangaParse(response: Response): MangasPage { - val document = response.asJsoup() - - val mangas = document.select(popularMangaSelector()).map { element -> - popularMangaFromElement(element) - } - - return MangasPage(mangas, hasNextPage(document)) - } - override fun latestUpdatesFromElement(element: Element): SManga = popularMangaFromElement(element) - override fun popularMangaNextPageSelector() = throw UnsupportedOperationException("Not used") + override fun popularMangaNextPageSelector() = "a.page_select + a:not(.page_last)" - override fun latestUpdatesNextPageSelector() = throw UnsupportedOperationException("Not used") + override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector() override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - //site ignore everything after the first word + // Site ignores everything after the first word val substringBefore = query.replace(" ", "_").replace(",", "_").replace(":", "_") - val url = "$baseUrl/search/$substringBefore/$page" + val url = "$baseUrl/search/$substringBefore?page=$page" return GET(url, headers) } - override fun searchMangaParse(response: Response): MangasPage { - val document = response.asJsoup() + override fun searchMangaSelector() = ".panel_story_list .story_item" + override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element) - val mangas = document.select(searchMangaSelector()).map { element -> - searchMangaFromElement(element) - } - - return MangasPage(mangas, false) - } - - private fun hasNextPage(document: Document): Boolean { - - val currentPage = document.select("div.group-page a.pageselect").first().text() - val lastPage = document.select("div.group-page a.page.page-blue")[1].text().substringAfter("Last(").substringBefore(")") - - return currentPage != lastPage - } - - - override fun searchMangaSelector() = "div.daily-update-item" - - override fun searchMangaFromElement(element: Element): SManga { - val manga = SManga.create() - element.select("a").first()?.let { - manga.setUrlWithoutDomain(it.attr("href")) - manga.title = it.text() - } - return manga - } - - override fun searchMangaNextPageSelector() = throw UnsupportedOperationException("Not used") + override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() override fun mangaDetailsParse(document: Document): SManga { val infoElement = document.select("div.manga-info-top").first() - val manga = SManga.create() manga.title = infoElement.select("h1").first().text() - manga.author = infoElement.select("div.manga-info-top li").find { it -> it.text().startsWith("Author") }?.text()?.substringAfter(") :") - val status = infoElement.select("div.manga-info-top li").find { it -> it.text().startsWith("Status") }?.text()?.substringAfter("Status :") + manga.author = infoElement.select("div.manga-info-top li").find { it.text().startsWith("Author") }?.text()?.substringAfter(") :") + val status = infoElement.select("div.manga-info-top li").find { it.text().startsWith("Status") }?.text()?.substringAfter("Status :") manga.status = parseStatus(status) val genres = mutableListOf() - infoElement.select("div.manga-info-top li").find { it -> it.text().startsWith("Genres :") }?.select("a")?.forEach { it -> genres.add(it.text()) } + infoElement.select("div.manga-info-top li").find { it.text().startsWith("Genres :") }?.select("a")?.forEach { genres.add(it.text()) } manga.genre = genres.joinToString() manga.description = document.select("div#noidungm").text() manga.thumbnail_url = document.select("div.manga-info-pic").first().select("img").first().attr("src") @@ -148,7 +100,6 @@ class Mangakakalot : ParsedHttpSource() { } override fun pageListParse(document: Document): List { - val pages = mutableListOf() document.select("div#vungdoc img")?.forEach {