Add back Maofly (#14686)

This commit is contained in:
stevenyomi 2022-12-29 04:32:53 +08:00 committed by GitHub
parent 6c2f780a8d
commit 181e3c0f07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,3 @@
dependencies {
implementation 'com.github.wajda:lzstring4java:0.1'
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -0,0 +1,54 @@
package eu.kanade.tachiyomi.extension.zh.maofly
import eu.kanade.tachiyomi.AppInfo
import eu.kanade.tachiyomi.multisrc.mdb.MDB
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.Response
import org.jsoup.nodes.Element
import rufus.lzstring4java.LZString
import java.text.SimpleDateFormat
import java.util.Locale
class Maofly : MDB("漫画猫", "https://www.maofly.com") {
override val supportsLatest = true
override fun listUrl(params: String) = "$baseUrl/list/$params.html"
override fun extractParams(listUrl: String) = listUrl.substringAfter("/list/").removeSuffix(".html")
override fun searchUrl(page: Int, query: String) = "$baseUrl/search.html?q=$query&page=$page"
override fun popularMangaNextPageSelector() = "div.pagination > li:last-child" // in the last page it's a span
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/update-page-$page.html", headers)
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
override fun latestUpdatesSelector() = searchMangaSelector()
override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element)
override fun transformTitle(title: String) = title.run { substring(1, length - 1) } // 《title》
override val authorSelector = "td.pub-duration"
override fun transformDescription(description: String) =
description.substringAfter("的漫画作品。").substringBeforeLast(" 。。欢迎您到漫画猫畅快阅读。")
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
return document.select(chapterListSelector()).map { chapterFromElement(it) }.apply {
if (!isNewDateLogic) return@apply
this[0].date_upload = document.selectFirst("th:contains(上次更新) + td").text()
.let { dateFormat.parse(it)!!.time }
}
}
// https://www.maofly.com/static/js/vg-read-v1.js
override fun parseImages(imgData: String, readerConfig: Element): List<String> {
val list = LZString.decompressFromBase64(imgData).split(',')
val host = readerConfig.attr("data-chapter-domain")
return list.map { "$host/uploads/$it" }
}
companion object {
private val dateFormat by lazy { SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH) }
private val isNewDateLogic = AppInfo.getVersionCode() >= 81
}
}

View File

@ -9,6 +9,7 @@ class MDBGenerator : ThemeSourceGenerator {
override val baseVersionCode = 2 override val baseVersionCode = 2
override val sources = listOf( override val sources = listOf(
SingleLang("ManhuaDB", "https://www.manhuadb.com", "zh", sourceName = "漫画DB", overrideVersionCode = 4), SingleLang("ManhuaDB", "https://www.manhuadb.com", "zh", sourceName = "漫画DB", overrideVersionCode = 4),
SingleLang("Maofly", "https://www.maofly.com", "zh", sourceName = "漫画猫", overrideVersionCode = 1),
) )
companion object { companion object {