diff --git a/multisrc/overrides/mdb/maofly/additional.gradle b/multisrc/overrides/mdb/maofly/additional.gradle new file mode 100644 index 000000000..c129427e8 --- /dev/null +++ b/multisrc/overrides/mdb/maofly/additional.gradle @@ -0,0 +1,3 @@ +dependencies { + implementation 'com.github.wajda:lzstring4java:0.1' +} diff --git a/multisrc/overrides/mdb/maofly/res/mipmap-hdpi/ic_launcher.png b/multisrc/overrides/mdb/maofly/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..85fdeae04 Binary files /dev/null and b/multisrc/overrides/mdb/maofly/res/mipmap-hdpi/ic_launcher.png differ diff --git a/multisrc/overrides/mdb/maofly/res/mipmap-mdpi/ic_launcher.png b/multisrc/overrides/mdb/maofly/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..b2ec828bc Binary files /dev/null and b/multisrc/overrides/mdb/maofly/res/mipmap-mdpi/ic_launcher.png differ diff --git a/multisrc/overrides/mdb/maofly/res/mipmap-xhdpi/ic_launcher.png b/multisrc/overrides/mdb/maofly/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..d7bf4ec6d Binary files /dev/null and b/multisrc/overrides/mdb/maofly/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/mdb/maofly/res/mipmap-xxhdpi/ic_launcher.png b/multisrc/overrides/mdb/maofly/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..70c131597 Binary files /dev/null and b/multisrc/overrides/mdb/maofly/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/mdb/maofly/res/mipmap-xxxhdpi/ic_launcher.png b/multisrc/overrides/mdb/maofly/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..44d92b323 Binary files /dev/null and b/multisrc/overrides/mdb/maofly/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/mdb/maofly/res/web_hi_res_512.png b/multisrc/overrides/mdb/maofly/res/web_hi_res_512.png new file mode 100644 index 000000000..5856d2d0d Binary files /dev/null and b/multisrc/overrides/mdb/maofly/res/web_hi_res_512.png differ diff --git a/multisrc/overrides/mdb/maofly/src/Maofly.kt b/multisrc/overrides/mdb/maofly/src/Maofly.kt new file mode 100644 index 000000000..75ba4c758 --- /dev/null +++ b/multisrc/overrides/mdb/maofly/src/Maofly.kt @@ -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 { + 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 { + 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 + } +} diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mdb/MDBGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mdb/MDBGenerator.kt index ac7440b75..0fef4e273 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mdb/MDBGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mdb/MDBGenerator.kt @@ -9,6 +9,7 @@ class MDBGenerator : ThemeSourceGenerator { override val baseVersionCode = 2 override val sources = listOf( SingleLang("ManhuaDB", "https://www.manhuadb.com", "zh", sourceName = "漫画DB", overrideVersionCode = 4), + SingleLang("Maofly", "https://www.maofly.com", "zh", sourceName = "漫画猫", overrideVersionCode = 1), ) companion object {