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