diff --git a/src/all/mmrcms/build.gradle b/src/all/mmrcms/build.gradle index 627e32978..8eea00cf8 100644 --- a/src/all/mmrcms/build.gradle +++ b/src/all/mmrcms/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: My Manga Reader CMS (Many sources)' pkgNameSuffix = 'all.mmrcms' extClass = '.MyMangaReaderCMSSources' - extVersionCode = 34 + extVersionCode = 35 libVersion = '1.2' } diff --git a/src/all/mmrcms/src/eu/kanade/tachiyomi/extension/all/mmrcms/MyMangaReaderCMSSource.kt b/src/all/mmrcms/src/eu/kanade/tachiyomi/extension/all/mmrcms/MyMangaReaderCMSSource.kt index 13b6243e7..aaf990908 100644 --- a/src/all/mmrcms/src/eu/kanade/tachiyomi/extension/all/mmrcms/MyMangaReaderCMSSource.kt +++ b/src/all/mmrcms/src/eu/kanade/tachiyomi/extension/all/mmrcms/MyMangaReaderCMSSource.kt @@ -80,18 +80,19 @@ class MyMangaReaderCMSSource(override val lang: String, } } + private val latestTitles = mutableSetOf() + override fun latestUpdatesParse(response: Response): MangasPage { val document = response.asJsoup() - val mangas = document.select(latestUpdatesSelector()).map { element -> - latestUpdatesFromElement(element) - }.distinctBy { manga -> manga.url } + if (document.location().contains("page=1")) latestTitles.clear() - val hasNextPage = latestUpdatesNextPageSelector()?.let { selector -> - document.select(selector).first() - } != null + val mangas = document.select(latestUpdatesSelector()).map { element -> latestUpdatesFromElement(element) } + .distinctBy { manga -> manga.title } + .filterNot { manga -> manga.title in latestTitles } + .also { list -> latestTitles.addAll(list.map { it.title }) } - return MangasPage(mangas, hasNextPage) + return MangasPage(mangas, document.select(latestUpdatesNextPageSelector()) != null) } private fun latestUpdatesSelector() = "div.mangalist div.manga-item" private fun latestUpdatesNextPageSelector() = "a[rel=next]" @@ -165,7 +166,7 @@ class MyMangaReaderCMSSource(override val lang: String, @SuppressLint("DefaultLocale") override fun mangaDetailsParse(response: Response) = SManga.create().apply { val document = response.asJsoup() - title = document.select("h2.listmanga-header, h2.widget-title").first().text().trim() + document.select("h2.listmanga-header, h2.widget-title").firstOrNull()?.text()?.trim()?.let { title = it } thumbnail_url = coverGuess(document.select(".row [class^=img-responsive]").firstOrNull()?.attr("abs:src"), document.location()) description = document.select(".row .well p").text().trim()