MCCMS: fix Pupu Manhua, remove Haomanwu, add PPHanman (#13387)

* MCCMS: fix Pupu Manhua, remove Haomanwu

* Add PPHanman
This commit is contained in:
stevenyomi 2022-09-08 20:56:07 +08:00 committed by GitHub
parent 58b6147c18
commit 5a4d5098e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 72 additions and 21 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

View File

@ -1,15 +0,0 @@
package eu.kanade.tachiyomi.extension.zh.haomanwu
import eu.kanade.tachiyomi.multisrc.mccms.MCCMS
import eu.kanade.tachiyomi.source.model.Page
import okhttp3.Response
class Haomanwu : MCCMS("好漫屋", "https://app2.haoman6.com", hasCategoryPage = false) {
override fun pageListParse(response: Response): List<Page> {
val pages = super.pageListParse(response)
if (pages.any { it.imageUrl!!.endsWith("tianjia.jpg") }) {
throw Exception("该章节有图片尚未添加")
}
return pages
}
}

View File

@ -0,0 +1,20 @@
package eu.kanade.tachiyomi.extension.zh.manhuaorg
import eu.kanade.tachiyomi.multisrc.mccms.MCCMS
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SManga
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Request
class Manhuaorg : MCCMS("朴朴漫画", "https://app.manhuaorg.com", hasCategoryPage = false) {
override fun mangaDetailsRequest(manga: SManga) = throw UnsupportedOperationException()
override fun imageRequest(page: Page): Request {
val url = page.imageUrl!!
val host = url.toHttpUrl().host
val headers = headers.newBuilder().set("Referer", "https://$host/").build()
return GET(url, headers)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,44 @@
package eu.kanade.tachiyomi.extension.zh.pphanman
import android.app.Application
import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.multisrc.mccms.MCCMS
import eu.kanade.tachiyomi.source.ConfigurableSource
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
// it has a category page with no filter
class PPHanman : MCCMS("PP韩漫", "", hasCategoryPage = false), ConfigurableSource {
override val baseUrl: String
init {
val mirrors = MIRRORS
val mirrorIndex = Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
.getString(MIRROR_PREF, "0")!!.toInt().coerceAtMost(mirrors.size - 1)
baseUrl = "https://" + mirrors[mirrorIndex]
}
// .../comic_{id}.html
override fun getMangaId(url: String) = url.substringAfterLast('_').substringBeforeLast('.')
override fun setupPreferenceScreen(screen: PreferenceScreen) {
ListPreference(screen.context).apply {
val mirrors = MIRRORS
key = MIRROR_PREF
title = "镜像站点"
summary = "%s\n重启生效"
entries = mirrors
entryValues = Array(mirrors.size) { it.toString() }
setDefaultValue("0")
}.let(screen::addPreference)
}
companion object {
private const val MIRROR_PREF = "MIRROR"
// https://bitbucket.org/fabuye/pphanman
private val MIRRORS get() = arrayOf("pphm.xyz", "pphm2.xyz", "krhentai.com")
}
}

View File

@ -94,7 +94,7 @@ open class MCCMS(
override fun mangaDetailsParse(response: Response) = throw UnsupportedOperationException("Not used.")
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> = Single.create<List<SChapter>> { subscriber ->
val id = manga.url.substringAfterLast('/')
val id = getMangaId(manga.url)
val dataResponse = client.newCall(GET("$baseUrl/api/data/chapter?mid=$id", headers)).execute()
val dataList: List<ChapterDataDto> = dataResponse.parseAs() // unordered
val dateMap = HashMap<Int, Long>(dataList.size * 2)
@ -105,6 +105,8 @@ open class MCCMS(
subscriber.onSuccess(result)
}.toObservable()
protected open fun getMangaId(url: String) = url.substringAfterLast('/')
override fun chapterListParse(response: Response) = throw UnsupportedOperationException("Not used.")
override fun pageListRequest(chapter: SChapter): Request =

View File

@ -12,10 +12,6 @@ class MCCMSGenerator : ThemeSourceGenerator {
name = "Haoman6", baseUrl = "https://www.haoman6.com", lang = "zh",
className = "Haoman6", sourceName = "好漫6", overrideVersionCode = 3
),
SingleLang( // 与 app2.haomanwu.com 相同
name = "Haomanwu", baseUrl = "https://app2.haoman6.com", lang = "zh",
className = "Haomanwu", sourceName = "好漫屋", overrideVersionCode = 3
),
SingleLang(
name = "Haoman6 (g-lens)", baseUrl = "https://www.g-lens.com", lang = "zh",
className = "Haoman6_glens", sourceName = "好漫6 (g-lens)", overrideVersionCode = 0
@ -30,7 +26,11 @@ class MCCMSGenerator : ThemeSourceGenerator {
),
SingleLang(
name = "Pupu Manhua", baseUrl = "https://app.manhuaorg.com", lang = "zh",
className = "Manhuaorg", sourceName = "朴朴漫画", overrideVersionCode = 1
className = "Manhuaorg", sourceName = "朴朴漫画", overrideVersionCode = 2
),
SingleLang(
name = "PPHanman", baseUrl = "https://pphm.xyz", lang = "zh", isNsfw = true,
className = "PPHanman", sourceName = "PP韩漫", overrideVersionCode = 0
),
)