Fix Mukudoujin chapter number (#9729)
* Add MikuDoujin * Add MikuDoujin V.1.2.1 * Update MikuDoujin.kt * Update MikuDoujin * Add ability to search using genre * Add Rh2PlusManga * Add Rh2PlusManga V.1.12.2 * Use Madara multi-source themes * Change MikuDoujin gradle and Add Rh2PlusManga generator. * update file to suggestion. * add Rh2PlusManga to MadaraGenerator.kt. * Fix Thai Madara source time format and MikuDoujin pages selector. * add Thai relative time wordlist to Madara parseRelativeDate. * change Rh2PlusManga and Mangauptocat date format. * change Mangauptocat base url. * change MikuDoujin pageListParse selector. * Fix MikuDoujin Chapter number. * fix MikuDoujin when try to fetch chapter name with non numeric ending word.
This commit is contained in:
parent
5695e7e470
commit
f7620bc174
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'MikuDoujin'
|
extName = 'MikuDoujin'
|
||||||
pkgNameSuffix = 'th.mikudoujin'
|
pkgNameSuffix = 'th.mikudoujin'
|
||||||
extClass = '.MikuDoujin'
|
extClass = '.MikuDoujin'
|
||||||
extVersionCode = 2
|
extVersionCode = 3
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,9 @@ class MikuDoujin : ParsedHttpSource() {
|
||||||
|
|
||||||
override fun chapterListSelector() = "table.table-episode tr"
|
override fun chapterListSelector() = "table.table-episode tr"
|
||||||
|
|
||||||
override fun chapterFromElement(element: Element): SChapter {
|
override fun chapterFromElement(element: Element): SChapter = throw Exception("Unused")
|
||||||
|
|
||||||
|
private fun chapterFromElementWithIndex(element: Element, idx: Int, manga: SManga): SChapter {
|
||||||
val chapter = SChapter.create()
|
val chapter = SChapter.create()
|
||||||
element.select("td a").let {
|
element.select("td a").let {
|
||||||
chapter.setUrlWithoutDomain(it.attr("href"))
|
chapter.setUrlWithoutDomain(it.attr("href"))
|
||||||
|
@ -151,7 +153,15 @@ class MikuDoujin : ParsedHttpSource() {
|
||||||
if (chapter.name.isEmpty()) {
|
if (chapter.name.isEmpty()) {
|
||||||
chapter.chapter_number = 0.0f
|
chapter.chapter_number = 0.0f
|
||||||
} else {
|
} else {
|
||||||
chapter.chapter_number = chapter.name.split(" ").last().toFloat()
|
val lastWord = chapter.name.split(" ").last()
|
||||||
|
try {
|
||||||
|
chapter.chapter_number = lastWord.toFloat()
|
||||||
|
} catch (ex: NumberFormatException) {
|
||||||
|
if (lastWord == "จบ") {
|
||||||
|
manga.status = SManga.COMPLETED
|
||||||
|
}
|
||||||
|
chapter.chapter_number = (idx + 1).toFloat()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,6 +177,7 @@ class MikuDoujin : ParsedHttpSource() {
|
||||||
val mangaDocument = it.asJsoup()
|
val mangaDocument = it.asJsoup()
|
||||||
|
|
||||||
if (mangaDocument.select(chapterListSelector()).isEmpty()) {
|
if (mangaDocument.select(chapterListSelector()).isEmpty()) {
|
||||||
|
manga.status = SManga.COMPLETED
|
||||||
val createdChapter = SChapter.create().apply {
|
val createdChapter = SChapter.create().apply {
|
||||||
url = manga.url
|
url = manga.url
|
||||||
name = "Chapter 1"
|
name = "Chapter 1"
|
||||||
|
@ -174,8 +185,9 @@ class MikuDoujin : ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
chList = listOf(createdChapter)
|
chList = listOf(createdChapter)
|
||||||
} else {
|
} else {
|
||||||
chList = mangaDocument.select(chapterListSelector()).map { Chapter ->
|
chList =
|
||||||
chapterFromElement(Chapter)
|
mangaDocument.select(chapterListSelector()).mapIndexed { idx, Chapter ->
|
||||||
|
chapterFromElementWithIndex(Chapter, idx, manga)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chList
|
chList
|
||||||
|
|
Loading…
Reference in New Issue