ManhuaES: Filter out ghost chapters (#9055)
* ManhuaES: Filter out ghost chapters * Refactor
This commit is contained in:
parent
8bb7ea96d4
commit
0a9a074d9e
|
@ -1,7 +1,32 @@
|
|||
package eu.kanade.tachiyomi.extension.en.manhuaes
|
||||
|
||||
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.Response
|
||||
|
||||
class ManhuaES : Madara("Manhua ES", "https://manhuaes.com", "en") {
|
||||
override val pageListParseSelector = ".reading-content div.text-left :has(>img)"
|
||||
|
||||
override fun chapterListParse(response: Response): List<SChapter> {
|
||||
var chapterList = super.chapterListParse(response)
|
||||
|
||||
// the site adds a ghost chapter for some entries
|
||||
chapterList.firstOrNull()?.let {
|
||||
if (!isReleasedChapter(it)) {
|
||||
chapterList = chapterList.subList(1, chapterList.size)
|
||||
}
|
||||
}
|
||||
|
||||
return chapterList
|
||||
}
|
||||
|
||||
private fun isReleasedChapter(chapter: SChapter): Boolean {
|
||||
val document = client.newCall(
|
||||
GET(chapter.url, headersBuilder().build())
|
||||
).execute().asJsoup()
|
||||
|
||||
return document.select(pageListParseSelector).isNotEmpty()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ class MadaraGenerator : ThemeSourceGenerator {
|
|||
SingleLang("Mangazuki.me", "https://mangazuki.me", "en", className = "MangazukiMe", overrideVersionCode = 1),
|
||||
SingleLang("Mangceh", "https://mangceh.me", "id", isNsfw = true, overrideVersionCode = 2),
|
||||
SingleLang("Manhua Dragon", "https://manhuadragon.com", "en"),
|
||||
SingleLang("Manhua ES", "https://manhuaes.com", "en", overrideVersionCode = 4),
|
||||
SingleLang("Manhua ES", "https://manhuaes.com", "en", overrideVersionCode = 5),
|
||||
SingleLang("Manhua Plus", "https://manhuaplus.com", "en", overrideVersionCode = 5),
|
||||
SingleLang("Manhua SY", "https://www.manhuasy.com", "en", overrideVersionCode = 1),
|
||||
SingleLang("ManhuaBox", "https://manhuabox.net", "en", overrideVersionCode = 2),
|
||||
|
|
Loading…
Reference in New Issue