[NetTruyen] Fix chapters order
This commit is contained in:
@@ -235,8 +235,8 @@ internal abstract class WpComicsParser(
|
||||
protected open val selectDate = "div.col-xs-4"
|
||||
protected open val selectChapter = "div.list-chapter li.row:not(.heading)"
|
||||
|
||||
protected open suspend fun getChapters(doc: Document): List<MangaChapter> {
|
||||
return doc.body().select(selectChapter).mapChapters(reversed = true) { i, li ->
|
||||
protected open suspend fun getChapters(doc: Document, reversed: Boolean = true): List<MangaChapter> {
|
||||
return doc.body().select(selectChapter).mapChapters(reversed) { i, li ->
|
||||
val a = li.selectFirstOrThrow("a")
|
||||
val href = a.attrAsRelativeUrl("href")
|
||||
val dateText = li.selectFirst(selectDate)?.text()
|
||||
|
||||
@@ -3,9 +3,9 @@ package org.koitharu.kotatsu.parsers.site.wpcomics.vi
|
||||
import org.jsoup.nodes.Document
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.site.wpcomics.WpComicsParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.site.wpcomics.WpComicsParser
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
@@ -162,8 +162,8 @@ internal class DocTruyen3Q(context: MangaLoaderContext) :
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getChapters(doc: Document): List<MangaChapter> {
|
||||
return doc.select("li.row:not([style*='display: none'])").mapChapters(reversed = true) { _, element ->
|
||||
override suspend fun getChapters(doc: Document, reversed: Boolean): List<MangaChapter> {
|
||||
return doc.select("li.row:not([style*='display: none'])").mapChapters(reversed) { _, element ->
|
||||
val chapterLink = element.selectFirst("a.chapter") ?: return@mapChapters null
|
||||
val href = chapterLink.attrAsAbsoluteUrlOrNull("href") ?: return@mapChapters null
|
||||
val name = chapterLink.text()
|
||||
@@ -217,12 +217,7 @@ internal class DocTruyen3Q(context: MangaLoaderContext) :
|
||||
|
||||
absoluteTimePattern.matches(dateText) -> {
|
||||
val formatter = SimpleDateFormat("dd-MM-yyyy", Locale.getDefault())
|
||||
try {
|
||||
val parsedDate = formatter.parse(dateText)
|
||||
parsedDate?.time ?: 0L
|
||||
} catch (e: Exception) {
|
||||
0L
|
||||
}
|
||||
formatter.tryParse(dateText)
|
||||
}
|
||||
|
||||
else -> 0L
|
||||
|
||||
@@ -22,7 +22,7 @@ internal class NetTruyen(context: MangaLoaderContext) :
|
||||
override suspend fun getDetails(manga: Manga): Manga = coroutineScope {
|
||||
val fullUrl = manga.url.toAbsoluteUrl(domain)
|
||||
val doc = webClient.httpGet(fullUrl).parseHtml()
|
||||
val chaptersDeferred = async { getChapters(doc) }
|
||||
val chaptersDeferred = async { getChapters(doc, reversed = false) }
|
||||
val tagMap = getOrCreateTagMap()
|
||||
val tagsElement = doc.select("li.kind p.col-xs-8 a")
|
||||
val mangaTags = tagsElement.mapNotNullToSet { tagMap[it.text()] }
|
||||
|
||||
@@ -3,9 +3,9 @@ package org.koitharu.kotatsu.parsers.site.wpcomics.vi
|
||||
import org.jsoup.nodes.Document
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.site.wpcomics.WpComicsParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.model.*
|
||||
import org.koitharu.kotatsu.parsers.site.wpcomics.WpComicsParser
|
||||
import org.koitharu.kotatsu.parsers.util.*
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
@@ -158,8 +158,8 @@ internal class TopTruyen(context: MangaLoaderContext) :
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getChapters(doc: Document): List<MangaChapter> {
|
||||
return doc.select("li.row:not([style*='display: none'])").mapChapters(reversed = true) { _, element ->
|
||||
override suspend fun getChapters(doc: Document, reversed: Boolean): List<MangaChapter> {
|
||||
return doc.select("li.row:not([style*='display: none'])").mapChapters(reversed) { _, element ->
|
||||
val chapterLink = element.selectFirst("a.chapter") ?: return@mapChapters null
|
||||
val href = chapterLink.attrAsAbsoluteUrlOrNull("href") ?: return@mapChapters null
|
||||
val name = chapterLink.text()
|
||||
@@ -213,12 +213,7 @@ internal class TopTruyen(context: MangaLoaderContext) :
|
||||
|
||||
absoluteTimePattern.matches(dateText) -> {
|
||||
val formatter = SimpleDateFormat("dd-MM-yyyy", Locale.getDefault())
|
||||
try {
|
||||
val parsedDate = formatter.parse(dateText)
|
||||
parsedDate?.time ?: 0L
|
||||
} catch (e: Exception) {
|
||||
0L
|
||||
}
|
||||
formatter.tryParse(dateText)
|
||||
}
|
||||
|
||||
else -> 0L
|
||||
|
||||
Reference in New Issue
Block a user