SinMH: reverse chapter list section order for Qinqin (#12331)
This commit is contained in:
parent
5f8da8b120
commit
b867e280af
|
@ -4,6 +4,7 @@ import android.util.Base64
|
||||||
import eu.kanade.tachiyomi.multisrc.sinmh.SinMH
|
import eu.kanade.tachiyomi.multisrc.sinmh.SinMH
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
|
import org.jsoup.select.Elements
|
||||||
import javax.crypto.Cipher
|
import javax.crypto.Cipher
|
||||||
import javax.crypto.spec.IvParameterSpec
|
import javax.crypto.spec.IvParameterSpec
|
||||||
import javax.crypto.spec.SecretKeySpec
|
import javax.crypto.spec.SecretKeySpec
|
||||||
|
@ -14,6 +15,8 @@ class Qinqin : SinMH("亲亲漫画", "https://www.acgqd.com") {
|
||||||
|
|
||||||
override fun mangaDetailsParse(document: Document) = mangaDetailsParseDMZJStyle(document, hasBreadcrumb = true)
|
override fun mangaDetailsParse(document: Document) = mangaDetailsParseDMZJStyle(document, hasBreadcrumb = true)
|
||||||
|
|
||||||
|
override fun Elements.sectionsDescending() = this
|
||||||
|
|
||||||
// https://www.acgqd.com/js/jmzz20191018.js
|
// https://www.acgqd.com/js/jmzz20191018.js
|
||||||
override fun parsePageImages(chapterImages: String): List<String> {
|
override fun parsePageImages(chapterImages: String): List<String> {
|
||||||
val key = SecretKeySpec("cxNB23W8xzKJV26O".toByteArray(), "AES")
|
val key = SecretKeySpec("cxNB23W8xzKJV26O".toByteArray(), "AES")
|
||||||
|
|
|
@ -15,6 +15,7 @@ import okhttp3.Headers
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import org.jsoup.select.Elements
|
||||||
import org.jsoup.select.Evaluator
|
import org.jsoup.select.Evaluator
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
@ -29,6 +30,7 @@ abstract class SinMH(
|
||||||
_baseUrl: String,
|
_baseUrl: String,
|
||||||
override val lang: String = "zh",
|
override val lang: String = "zh",
|
||||||
) : ParsedHttpSource() {
|
) : ParsedHttpSource() {
|
||||||
|
|
||||||
override val baseUrl = _baseUrl
|
override val baseUrl = _baseUrl
|
||||||
protected open val mobileUrl = _baseUrl.replace("www", "m")
|
protected open val mobileUrl = _baseUrl.replace("www", "m")
|
||||||
override val supportsLatest = true
|
override val supportsLatest = true
|
||||||
|
@ -149,6 +151,7 @@ abstract class SinMH(
|
||||||
protected open val dateSelector = ".date"
|
protected open val dateSelector = ".date"
|
||||||
|
|
||||||
protected open fun List<SChapter>.sortedDescending() = this.asReversed()
|
protected open fun List<SChapter>.sortedDescending() = this.asReversed()
|
||||||
|
protected open fun Elements.sectionsDescending() = this.asReversed()
|
||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
return chapterListParse(response, chapterListSelector(), dateSelector)
|
return chapterListParse(response, chapterListSelector(), dateSelector)
|
||||||
|
@ -156,14 +159,19 @@ abstract class SinMH(
|
||||||
|
|
||||||
protected fun chapterListParse(response: Response, listSelector: String, dateSelector: String): List<SChapter> {
|
protected fun chapterListParse(response: Response, listSelector: String, dateSelector: String): List<SChapter> {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
return document.select(listSelector).map { chapterFromElement(it) }.sortedDescending().apply {
|
val sectionSelector = listSelector.substringBefore(' ')
|
||||||
if (isNewDateLogic && this.isNotEmpty()) {
|
val itemSelector = listSelector.substringAfter(' ')
|
||||||
val date = document.selectFirst(dateSelector).textNodes().last().text()
|
val list = document.select(sectionSelector).sectionsDescending().flatMap { section ->
|
||||||
this[0].date_upload = DATE_FORMAT.parse(date)?.time ?: 0L
|
section.select(itemSelector).map { chapterFromElement(it) }.sortedDescending()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (isNewDateLogic && list.isNotEmpty()) {
|
||||||
|
val date = document.selectFirst(dateSelector).textNodes().last().text()
|
||||||
|
list[0].date_upload = DATE_FORMAT.parse(date)?.time ?: 0L
|
||||||
|
}
|
||||||
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 必须是 "section item" */
|
||||||
override fun chapterListSelector() = ".chapter-body li > a"
|
override fun chapterListSelector() = ".chapter-body li > a"
|
||||||
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
||||||
runCatching { setUrlWithoutDomain(element.attr("href")) }.onFailure { url = "" }
|
runCatching { setUrlWithoutDomain(element.attr("href")) }.onFailure { url = "" }
|
||||||
|
|
|
@ -22,7 +22,7 @@ class SinMHGenerator : ThemeSourceGenerator {
|
||||||
),
|
),
|
||||||
SingleLang(
|
SingleLang(
|
||||||
name = "Qinqin Manhua", baseUrl = "https://www.acgqd.com", lang = "zh",
|
name = "Qinqin Manhua", baseUrl = "https://www.acgqd.com", lang = "zh",
|
||||||
className = "Qinqin", sourceName = "亲亲漫画", overrideVersionCode = 0
|
className = "Qinqin", sourceName = "亲亲漫画", overrideVersionCode = 1
|
||||||
),
|
),
|
||||||
SingleLang(
|
SingleLang(
|
||||||
name = "57Manhua", baseUrl = "http://www.wuqimh.net", lang = "zh",
|
name = "57Manhua", baseUrl = "http://www.wuqimh.net", lang = "zh",
|
||||||
|
|
Loading…
Reference in New Issue