Mangahub: fix some chapters not visible (#15207)
This commit is contained in:
parent
5d99570421
commit
4cc72c2f98
|
@ -200,16 +200,36 @@ abstract class MangaHub(
|
|||
}
|
||||
|
||||
// chapters
|
||||
override fun chapterListParse(response: Response): List<SChapter> {
|
||||
val document = response.asJsoup()
|
||||
val head = document.head()
|
||||
return document.select(chapterListSelector()).map { chapterFromElement(it, head) }
|
||||
}
|
||||
|
||||
override fun chapterListSelector() = ".tab-content ul li"
|
||||
|
||||
override fun chapterFromElement(element: Element): SChapter {
|
||||
private fun chapterFromElement(element: Element, head: Element): SChapter {
|
||||
val chapter = SChapter.create()
|
||||
chapter.setUrlWithoutDomain(element.select("a[href*='$baseUrl/chapter/']:not([rel=nofollow])").attr("href"))
|
||||
val potentialLinks = element.select("a[href*='$baseUrl/chapter/']:not([rel=nofollow])")
|
||||
var visibleLink = ""
|
||||
potentialLinks.forEach { a ->
|
||||
val className = a.className()
|
||||
val styles = head.select("style").html()
|
||||
if (!styles.contains(".$className { display:none; }")) {
|
||||
visibleLink = a.attr("href")
|
||||
return@forEach
|
||||
}
|
||||
}
|
||||
chapter.setUrlWithoutDomain(visibleLink)
|
||||
chapter.name = chapter.url.trimEnd('/').substringAfterLast('/').replace('-', ' ')
|
||||
chapter.date_upload = element.select("small.UovLc").first()?.text()?.let { parseChapterDate(it) } ?: 0
|
||||
return chapter
|
||||
}
|
||||
|
||||
override fun chapterFromElement(element: Element): SChapter {
|
||||
throw UnsupportedOperationException("Not Used")
|
||||
}
|
||||
|
||||
private fun parseChapterDate(date: String): Long {
|
||||
val now = Calendar.getInstance().apply {
|
||||
set(Calendar.HOUR_OF_DAY, 0)
|
||||
|
|
|
@ -9,7 +9,7 @@ class MangaHubGenerator : ThemeSourceGenerator {
|
|||
|
||||
override val themeClass = "MangaHub"
|
||||
|
||||
override val baseVersionCode: Int = 15
|
||||
override val baseVersionCode: Int = 16
|
||||
|
||||
override val sources = listOf(
|
||||
// SingleLang("1Manga.co", "https://1manga.co", "en", isNsfw = true, className = "OneMangaCo"),
|
||||
|
|
Loading…
Reference in New Issue