diff --git a/lib-multisrc/goda/build.gradle.kts b/lib-multisrc/goda/build.gradle.kts new file mode 100644 index 000000000..dc076cc37 --- /dev/null +++ b/lib-multisrc/goda/build.gradle.kts @@ -0,0 +1,5 @@ +plugins { + id("lib-multisrc") +} + +baseVersionCode = 1 diff --git a/src/zh/baozimhorg/res/mipmap-hdpi/ic_launcher.png b/lib-multisrc/goda/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from src/zh/baozimhorg/res/mipmap-hdpi/ic_launcher.png rename to lib-multisrc/goda/res/mipmap-hdpi/ic_launcher.png diff --git a/src/zh/baozimhorg/res/mipmap-mdpi/ic_launcher.png b/lib-multisrc/goda/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from src/zh/baozimhorg/res/mipmap-mdpi/ic_launcher.png rename to lib-multisrc/goda/res/mipmap-mdpi/ic_launcher.png diff --git a/src/zh/baozimhorg/res/mipmap-xhdpi/ic_launcher.png b/lib-multisrc/goda/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from src/zh/baozimhorg/res/mipmap-xhdpi/ic_launcher.png rename to lib-multisrc/goda/res/mipmap-xhdpi/ic_launcher.png diff --git a/src/zh/baozimhorg/res/mipmap-xxhdpi/ic_launcher.png b/lib-multisrc/goda/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from src/zh/baozimhorg/res/mipmap-xxhdpi/ic_launcher.png rename to lib-multisrc/goda/res/mipmap-xxhdpi/ic_launcher.png diff --git a/src/zh/baozimhorg/res/mipmap-xxxhdpi/ic_launcher.png b/lib-multisrc/goda/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from src/zh/baozimhorg/res/mipmap-xxxhdpi/ic_launcher.png rename to lib-multisrc/goda/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/BaozimhOrg.kt b/lib-multisrc/goda/src/eu/kanade/tachiyomi/multisrc/goda/GoDa.kt similarity index 87% rename from src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/BaozimhOrg.kt rename to lib-multisrc/goda/src/eu/kanade/tachiyomi/multisrc/goda/GoDa.kt index 9109b2f56..bbf8f5750 100644 --- a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/BaozimhOrg.kt +++ b/lib-multisrc/goda/src/eu/kanade/tachiyomi/multisrc/goda/GoDa.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.extension.zh.baozimhorg +package eu.kanade.tachiyomi.multisrc.goda import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.model.Filter @@ -13,10 +13,11 @@ import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.Request import okhttp3.Response import org.jsoup.nodes.Document +import org.jsoup.nodes.Element import org.jsoup.nodes.Entities import rx.Observable -open class BaozimhOrg( +open class GoDa( override val name: String, override val baseUrl: String, override val lang: String, @@ -77,29 +78,33 @@ open class BaozimhOrg( return GET(getMangaUrl(manga), headers) } - private fun Document.getMangaId() = selectFirst("#mangachapters")!!.attr("data-mid") + private fun Element.getMangaId() = selectFirst("#mangachapters")!!.attr("data-mid") override fun mangaDetailsParse(response: Response) = SManga.create().apply { - val document = response.asJsoup() + val document = response.asJsoup().selectFirst("main")!! val titleElement = document.selectFirst("h1")!! val elements = titleElement.parent()!!.parent()!!.children() check(elements.size == 6) title = titleElement.ownText() - status = SManga.UNKNOWN // Everything is marked as ongoing + status = when (titleElement.child(0).text()) { + "連載中", "Ongoing" -> SManga.ONGOING + "完結" -> SManga.COMPLETED + else -> SManga.UNKNOWN + } author = Entities.unescape(elements[1].children().drop(1).joinToString { it.text().removeSuffix(" ,") }) genre = buildList { elements[2].children().drop(1).mapTo(this) { it.text().removeSuffix(" ,") } elements[3].children().mapTo(this) { it.text().removePrefix("#") } }.joinToString() - description = elements[4].text() + "\n\nID: ${document.getMangaId()}" + description = (elements[4].text() + "\n\nID: ${document.getMangaId()}").trim() thumbnail_url = document.selectFirst("img.object-cover")!!.attr("src") } override fun fetchChapterList(manga: SManga): Observable> = Observable.fromCallable { val mangaId = manga.description - ?.substringAfterLast("\nID: ", "") - ?.takeIf { it.isNotEmpty() && it.all(Character::isDigit) } + ?.substringAfterLast("ID: ", "") + ?.takeIf { it.toIntOrNull() != null } ?: client.newCall(mangaDetailsRequest(manga)).execute().asJsoup().getMangaId() fetchChapterList(mangaId) @@ -125,8 +130,8 @@ open class BaozimhOrg( override fun pageListRequest(chapter: SChapter): Request { val id = chapter.url.substringAfterLast('#', "") - val mangaId = id.substringBefore('/') - val chapterId = id.substringAfter('/') + val mangaId = id.substringBefore('/', "") + val chapterId = id.substringAfter('/', "") return pageListRequest(mangaId, chapterId) } @@ -134,8 +139,8 @@ open class BaozimhOrg( override fun pageListParse(response: Response): List { val document = response.asJsoup() - return document.select("noscript > img").mapIndexed { index, element -> - Page(index, imageUrl = element.attr("src")) + return document.select("#chapcontent > div > img").mapIndexed { index, element -> + Page(index, imageUrl = element.attr("data-src").ifEmpty { element.attr("src") }) } } diff --git a/src/en/goda/build.gradle b/src/en/goda/build.gradle new file mode 100644 index 000000000..bc88daf30 --- /dev/null +++ b/src/en/goda/build.gradle @@ -0,0 +1,8 @@ +ext { + extName = 'Goda' + extClass = '.Goda' + themePkg = 'goda' + overrideVersionCode = 0 +} + +apply from: "$rootDir/common.gradle" diff --git a/src/en/goda/src/eu/kanade/tachiyomi/extension/en/goda/Goda.kt b/src/en/goda/src/eu/kanade/tachiyomi/extension/en/goda/Goda.kt new file mode 100644 index 000000000..6fb90b686 --- /dev/null +++ b/src/en/goda/src/eu/kanade/tachiyomi/extension/en/goda/Goda.kt @@ -0,0 +1,5 @@ +package eu.kanade.tachiyomi.extension.en.goda + +import eu.kanade.tachiyomi.multisrc.goda.GoDa + +class Goda : GoDa("Goda", "https://manhuascans.org", "en") diff --git a/src/zh/baozimhorg/build.gradle b/src/zh/baozimhorg/build.gradle index 3f5ff1644..e3018d189 100644 --- a/src/zh/baozimhorg/build.gradle +++ b/src/zh/baozimhorg/build.gradle @@ -1,7 +1,8 @@ ext { extName = 'GoDa' extClass = '.GoDaManhua' - extVersionCode = 29 + themePkg = 'goda' + overrideVersionCode = 29 } apply from: "$rootDir/common.gradle" diff --git a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/GoDaFactory.kt b/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/GoDaFactory.kt deleted file mode 100644 index 555354912..000000000 --- a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/GoDaFactory.kt +++ /dev/null @@ -1,12 +0,0 @@ -package eu.kanade.tachiyomi.extension.zh.baozimhorg - -import eu.kanade.tachiyomi.source.SourceFactory - -// This is not used because ideally the extension language should be updated to "Multi" (all). -// Chinese users don't receive status updates from Discord, so I'll keep the package name unchanged for now. -class GoDaFactory : SourceFactory { - override fun createSources() = listOf( - GoDaManhua(), - BaozimhOrg("Goda", "https://manhuascans.org", "en"), - ) -} diff --git a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/GoDaManhua.kt b/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/GoDaManhua.kt index 8aaf14d72..98091e0aa 100644 --- a/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/GoDaManhua.kt +++ b/src/zh/baozimhorg/src/eu/kanade/tachiyomi/extension/zh/baozimhorg/GoDaManhua.kt @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.extension.zh.baozimhorg import android.app.Application import androidx.preference.ListPreference import androidx.preference.PreferenceScreen +import eu.kanade.tachiyomi.multisrc.goda.GoDa import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.Page @@ -16,7 +17,7 @@ import okio.IOException import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -class GoDaManhua : BaozimhOrg("GoDa漫画", "", "zh"), ConfigurableSource { +class GoDaManhua : GoDa("GoDa漫画", "", "zh"), ConfigurableSource { override val id get() = 774030471139699415 diff --git a/src/zh/eighteenmanhua/build.gradle b/src/zh/eighteenmanhua/build.gradle new file mode 100644 index 000000000..76840ab3d --- /dev/null +++ b/src/zh/eighteenmanhua/build.gradle @@ -0,0 +1,9 @@ +ext { + extName = '18Manhua' + extClass = '.EighteenManhua' + themePkg = 'goda' + overrideVersionCode = 0 + isNsfw = true +} + +apply from: "$rootDir/common.gradle" diff --git a/src/zh/eighteenmanhua/res/mipmap-hdpi/ic_launcher.png b/src/zh/eighteenmanhua/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..67b22c654 Binary files /dev/null and b/src/zh/eighteenmanhua/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/zh/eighteenmanhua/res/mipmap-mdpi/ic_launcher.png b/src/zh/eighteenmanhua/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..30a537cf8 Binary files /dev/null and b/src/zh/eighteenmanhua/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/zh/eighteenmanhua/res/mipmap-xhdpi/ic_launcher.png b/src/zh/eighteenmanhua/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..85ea59c49 Binary files /dev/null and b/src/zh/eighteenmanhua/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/zh/eighteenmanhua/res/mipmap-xxhdpi/ic_launcher.png b/src/zh/eighteenmanhua/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..f9e013a91 Binary files /dev/null and b/src/zh/eighteenmanhua/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/zh/eighteenmanhua/res/mipmap-xxxhdpi/ic_launcher.png b/src/zh/eighteenmanhua/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..1ed3bde46 Binary files /dev/null and b/src/zh/eighteenmanhua/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/zh/eighteenmanhua/src/eu/kanade/tachiyomi/extension/zh/eighteenmanhua/EighteenManhua.kt b/src/zh/eighteenmanhua/src/eu/kanade/tachiyomi/extension/zh/eighteenmanhua/EighteenManhua.kt new file mode 100644 index 000000000..836935245 --- /dev/null +++ b/src/zh/eighteenmanhua/src/eu/kanade/tachiyomi/extension/zh/eighteenmanhua/EighteenManhua.kt @@ -0,0 +1,5 @@ +package eu.kanade.tachiyomi.extension.zh.eighteenmanhua + +import eu.kanade.tachiyomi.multisrc.goda.GoDa + +class EighteenManhua : GoDa("18漫画", "https://18mh.org", "zh")