Make GoDa multisrc and add sources (#3318)
5
lib-multisrc/goda/build.gradle.kts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
plugins {
|
||||||
|
id("lib-multisrc")
|
||||||
|
}
|
||||||
|
|
||||||
|
baseVersionCode = 1
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
@ -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.network.GET
|
||||||
import eu.kanade.tachiyomi.source.model.Filter
|
import eu.kanade.tachiyomi.source.model.Filter
|
||||||
@ -13,10 +13,11 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
|
import org.jsoup.nodes.Element
|
||||||
import org.jsoup.nodes.Entities
|
import org.jsoup.nodes.Entities
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
|
|
||||||
open class BaozimhOrg(
|
open class GoDa(
|
||||||
override val name: String,
|
override val name: String,
|
||||||
override val baseUrl: String,
|
override val baseUrl: String,
|
||||||
override val lang: String,
|
override val lang: String,
|
||||||
@ -77,29 +78,33 @@ open class BaozimhOrg(
|
|||||||
return GET(getMangaUrl(manga), headers)
|
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 {
|
override fun mangaDetailsParse(response: Response) = SManga.create().apply {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup().selectFirst("main")!!
|
||||||
val titleElement = document.selectFirst("h1")!!
|
val titleElement = document.selectFirst("h1")!!
|
||||||
val elements = titleElement.parent()!!.parent()!!.children()
|
val elements = titleElement.parent()!!.parent()!!.children()
|
||||||
check(elements.size == 6)
|
check(elements.size == 6)
|
||||||
|
|
||||||
title = titleElement.ownText()
|
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(" ,") })
|
author = Entities.unescape(elements[1].children().drop(1).joinToString { it.text().removeSuffix(" ,") })
|
||||||
genre = buildList {
|
genre = buildList {
|
||||||
elements[2].children().drop(1).mapTo(this) { it.text().removeSuffix(" ,") }
|
elements[2].children().drop(1).mapTo(this) { it.text().removeSuffix(" ,") }
|
||||||
elements[3].children().mapTo(this) { it.text().removePrefix("#") }
|
elements[3].children().mapTo(this) { it.text().removePrefix("#") }
|
||||||
}.joinToString()
|
}.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")
|
thumbnail_url = document.selectFirst("img.object-cover")!!.attr("src")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> = Observable.fromCallable {
|
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> = Observable.fromCallable {
|
||||||
val mangaId = manga.description
|
val mangaId = manga.description
|
||||||
?.substringAfterLast("\nID: ", "")
|
?.substringAfterLast("ID: ", "")
|
||||||
?.takeIf { it.isNotEmpty() && it.all(Character::isDigit) }
|
?.takeIf { it.toIntOrNull() != null }
|
||||||
?: client.newCall(mangaDetailsRequest(manga)).execute().asJsoup().getMangaId()
|
?: client.newCall(mangaDetailsRequest(manga)).execute().asJsoup().getMangaId()
|
||||||
|
|
||||||
fetchChapterList(mangaId)
|
fetchChapterList(mangaId)
|
||||||
@ -125,8 +130,8 @@ open class BaozimhOrg(
|
|||||||
|
|
||||||
override fun pageListRequest(chapter: SChapter): Request {
|
override fun pageListRequest(chapter: SChapter): Request {
|
||||||
val id = chapter.url.substringAfterLast('#', "")
|
val id = chapter.url.substringAfterLast('#', "")
|
||||||
val mangaId = id.substringBefore('/')
|
val mangaId = id.substringBefore('/', "")
|
||||||
val chapterId = id.substringAfter('/')
|
val chapterId = id.substringAfter('/', "")
|
||||||
return pageListRequest(mangaId, chapterId)
|
return pageListRequest(mangaId, chapterId)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,8 +139,8 @@ open class BaozimhOrg(
|
|||||||
|
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun pageListParse(response: Response): List<Page> {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
return document.select("noscript > img").mapIndexed { index, element ->
|
return document.select("#chapcontent > div > img").mapIndexed { index, element ->
|
||||||
Page(index, imageUrl = element.attr("src"))
|
Page(index, imageUrl = element.attr("data-src").ifEmpty { element.attr("src") })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
8
src/en/goda/build.gradle
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
ext {
|
||||||
|
extName = 'Goda'
|
||||||
|
extClass = '.Goda'
|
||||||
|
themePkg = 'goda'
|
||||||
|
overrideVersionCode = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: "$rootDir/common.gradle"
|
@ -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")
|
@ -1,7 +1,8 @@
|
|||||||
ext {
|
ext {
|
||||||
extName = 'GoDa'
|
extName = 'GoDa'
|
||||||
extClass = '.GoDaManhua'
|
extClass = '.GoDaManhua'
|
||||||
extVersionCode = 29
|
themePkg = 'goda'
|
||||||
|
overrideVersionCode = 29
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
@ -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"),
|
|
||||||
)
|
|
||||||
}
|
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.extension.zh.baozimhorg
|
|||||||
import android.app.Application
|
import android.app.Application
|
||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
|
import eu.kanade.tachiyomi.multisrc.goda.GoDa
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
@ -16,7 +17,7 @@ import okio.IOException
|
|||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
|
||||||
class GoDaManhua : BaozimhOrg("GoDa漫画", "", "zh"), ConfigurableSource {
|
class GoDaManhua : GoDa("GoDa漫画", "", "zh"), ConfigurableSource {
|
||||||
|
|
||||||
override val id get() = 774030471139699415
|
override val id get() = 774030471139699415
|
||||||
|
|
||||||
|
9
src/zh/eighteenmanhua/build.gradle
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
ext {
|
||||||
|
extName = '18Manhua'
|
||||||
|
extClass = '.EighteenManhua'
|
||||||
|
themePkg = 'goda'
|
||||||
|
overrideVersionCode = 0
|
||||||
|
isNsfw = true
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: "$rootDir/common.gradle"
|
BIN
src/zh/eighteenmanhua/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
src/zh/eighteenmanhua/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
src/zh/eighteenmanhua/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
src/zh/eighteenmanhua/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
src/zh/eighteenmanhua/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
@ -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")
|