MCCMS multisrc theme (#11839)

* MCCMS multisrc theme

* MCCMS: use English for extension names
This commit is contained in:
kasperskier 2022-05-14 02:52:46 +08:00 committed by GitHub
parent d4af6170be
commit e679306cd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 172 additions and 189 deletions

View File

@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="MCCMSGenerator" type="JetRunConfigurationType" nameIsGenerated="true">
<module name="tachiyomi-extensions.multisrc" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="MAIN_CLASS_NAME" value="eu.kanade.tachiyomi.multisrc.mccms.MCCMSGenerator" />
<option name="WORKING_DIRECTORY" value="" />
<method v="2">
<option name="Make" enabled="true" />
<option name="Gradle.BeforeRunTask" enabled="true" tasks="ktFormat" externalProjectPath="$PROJECT_DIR$/multisrc" vmOptions="" scriptParameters="" />
<option name="Gradle.BeforeRunTask" enabled="true" tasks="ktLint" externalProjectPath="$PROJECT_DIR$/multisrc" vmOptions="" scriptParameters="" />
</method>
</configuration>
</component>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,8 @@
package eu.kanade.tachiyomi.extension.zh.haoman6
import eu.kanade.tachiyomi.multisrc.mccms.MCCMS
class Haoman6 : MCCMS("好漫6", "https://www.haoman6.com") {
override fun transformTitle(title: String) = title.removeSuffix("(最新在线)").removeSuffix("-")
override val lazyLoadImageAttr = "echo-pc"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,8 @@
package eu.kanade.tachiyomi.extension.zh.haoman6_glens
import eu.kanade.tachiyomi.multisrc.mccms.MCCMS
class Haoman6_glens : MCCMS("好漫6 (g-lens)", "https://www.g-lens.com") {
override fun transformTitle(title: String) = title.removeSuffix("_").removeSuffix("-")
override val lazyLoadImageAttr = "pc-ec"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -0,0 +1,15 @@
package eu.kanade.tachiyomi.extension.zh.haoman8
import eu.kanade.tachiyomi.multisrc.mccms.MCCMS
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.FilterList
class Haoman8 : MCCMS("好漫8", "https://caiji.haoman8.com") {
// Search: 此站点nginx配置有问题只能用以下格式搜索第一页
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) =
GET("$baseUrl/index.php/search?key=$query", headers)
override fun searchMangaNextPageSelector(): String? = null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

View File

@ -0,0 +1,17 @@
package eu.kanade.tachiyomi.extension.zh.haomanwu
import eu.kanade.tachiyomi.multisrc.mccms.MCCMS
import eu.kanade.tachiyomi.source.model.SManga
import org.jsoup.nodes.Element
class Haomanwu : MCCMS("好漫屋", "https://app2.haomanwu.com") {
// Search
override fun searchMangaNextPageSelector() = "li:nth-child(30) > a" // 有30项则可能有下一页
override fun searchMangaSelector() = "li > a"
override fun searchMangaFromElement(element: Element) = SManga.create().apply {
title = element.text()
setUrlWithoutDomain(element.attr("abs:href"))
}
}

View File

@ -0,0 +1,84 @@
package eu.kanade.tachiyomi.multisrc.mccms
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
// 漫城CMS http://mccms.cn/
abstract class MCCMS(
override val name: String,
override val baseUrl: String,
override val lang: String = "zh",
) : ParsedHttpSource() {
override val supportsLatest: Boolean = true
protected open val nextPageSelector = "div#Pagination a.next"
protected open val comicItemSelector = "div.common-comic-item"
protected open val comicItemTitleSelector = "p.comic__title > a"
protected open fun transformTitle(title: String) = title
// Popular
override fun popularMangaRequest(page: Int) = GET("$baseUrl/category/order/hits/page/$page", headers)
override fun popularMangaNextPageSelector() = nextPageSelector
override fun popularMangaSelector() = comicItemSelector
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
val titleElement = element.select(comicItemTitleSelector)
title = transformTitle(titleElement.text().trim())
setUrlWithoutDomain(titleElement.attr("abs:href"))
thumbnail_url = element.select("img").attr("abs:data-original")
}
// Latest
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/category/order/addtime/page/$page", headers)
override fun latestUpdatesNextPageSelector() = nextPageSelector
override fun latestUpdatesSelector() = comicItemSelector
override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element)
// Search
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) =
GET("$baseUrl/search/$query/$page", headers)
override fun searchMangaNextPageSelector(): String? = nextPageSelector
override fun searchMangaSelector() = comicItemSelector
override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
// Details
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
title = transformTitle(document.select("div.de-info__box > p.comic-title").text().trim())
thumbnail_url = document.select("div.de-info__cover > img").attr("abs:src")
author = document.select("div.comic-author > span.name > a").text()
artist = author
genre = document.select("div.comic-status > span.text:nth-child(1) a").eachText().joinToString(", ")
description = document.select("div.comic-intro > p.intro-total").text()
}
// Chapters
override fun chapterListSelector() = "ul.chapter__list-box > li"
override fun chapterFromElement(element: Element) = SChapter.create().apply {
setUrlWithoutDomain(element.select("a").attr("abs:href"))
name = element.select("a").text()
}
override fun chapterListParse(response: Response) = super.chapterListParse(response).reversed()
// Pages
protected open val lazyLoadImageAttr = "data-original"
override fun pageListParse(document: Document) = document.select("div.rd-article__pic > img")
.mapIndexed { i, el -> Page(i, "", el.attr("abs:$lazyLoadImageAttr")) }
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used.")
}

View File

@ -0,0 +1,23 @@
package eu.kanade.tachiyomi.multisrc.mccms
import generator.ThemeSourceData.SingleLang
import generator.ThemeSourceGenerator
class MCCMSGenerator : ThemeSourceGenerator {
override val themeClass = "MCCMS"
override val themePkg = "mccms"
override val baseVersionCode = 1
override val sources = listOf(
SingleLang("Haoman6", "https://www.haoman6.com", "zh", className = "Haoman6", overrideVersionCode = 1),
SingleLang("Haomanwu", "https://app2.haomanwu.com", "zh", className = "Haomanwu", overrideVersionCode = 2),
SingleLang("Haoman6 (g-lens)", "https://www.g-lens.com", "zh", className = "Haoman6_glens", overrideVersionCode = 0),
SingleLang("Haoman8", "https://caiji.haoman8.com", "zh", className = "Haoman8", overrideVersionCode = 0),
)
companion object {
@JvmStatic
fun main(args: Array<String>) {
MCCMSGenerator().createAll()
}
}
}

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="eu.kanade.tachiyomi.extension" />

View File

@ -1,11 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
ext {
extName = 'Haoman6'
pkgNameSuffix = 'zh.haoman6'
extClass = '.Haoman6'
extVersionCode = 1
}
apply from: "$rootDir/common.gradle"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,82 +0,0 @@
package eu.kanade.tachiyomi.extension.zh.haoman6
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
class Haoman6 : ParsedHttpSource() {
override val name: String = "好漫6"
override val lang: String = "zh"
override val supportsLatest: Boolean = false
override val baseUrl: String = "https://www.haoman6.com"
// Popular
override fun popularMangaRequest(page: Int) = GET("$baseUrl/custom/hot", headers)
override fun popularMangaNextPageSelector(): String? = null
override fun popularMangaSelector(): String = "div.top-list__box > div.top-list__box-item"
override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
title = element.select("p.comic__title > a").text()
setUrlWithoutDomain(element.select("p.comic__title > a").attr("abs:href"))
thumbnail_url = element.select("img").attr("abs:data-original")
}
// Latest
override fun latestUpdatesRequest(page: Int) = throw Exception("Not used")
override fun latestUpdatesNextPageSelector() = throw Exception("Not used")
override fun latestUpdatesSelector() = throw Exception("Not used")
override fun latestUpdatesFromElement(element: Element) = throw Exception("Not used")
// Search
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return GET("$baseUrl/search/$query/$page", headers)
}
override fun searchMangaNextPageSelector(): String? = "div#Pagination a.next"
override fun searchMangaSelector(): String = "div.common-comic-item"
override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply {
title = element.select("p.comic__title > a").text()
setUrlWithoutDomain(element.select("p.comic__title > a").attr("abs:href"))
thumbnail_url = element.select("img").attr("abs:data-original")
}
// Details
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
title = document.select("div.de-info__box > p.comic-title").text()
thumbnail_url = document.select("div.de-info__cover > img").attr("abs:src")
author = document.select("div.comic-author > span.name > a").text()
artist = author
genre = document.select("div.comic-status > span.text:nth-child(1) a").eachText().joinToString(", ")
description = document.select("div.comic-intro > p.intro-total").text()
}
// Chapters
override fun chapterListSelector(): String = "ul.chapter__list-box > li"
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
setUrlWithoutDomain(element.select("a").attr("abs:href"))
name = element.select("a").text()
}
override fun chapterListParse(response: Response): List<SChapter> {
return super.chapterListParse(response).reversed()
}
// Pages
override fun pageListParse(document: Document): List<Page> {
return document.select("div.rd-article__pic > img.lazy-read")
.mapIndexed { i, el -> Page(i, "", el.attr("abs:echo-pc")) }
}
override fun imageUrlParse(document: Document): String = throw Exception("Not Used")
}

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="eu.kanade.tachiyomi.extension" />

View File

@ -1,11 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
ext {
extName = 'Haomanwu'
pkgNameSuffix = 'zh.haomanwu'
extClass = '.Haomanwu'
extVersionCode = 2
}
apply from: "$rootDir/common.gradle"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

View File

@ -1,81 +0,0 @@
package eu.kanade.tachiyomi.extension.zh.haomanwu
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
class Haomanwu : ParsedHttpSource() {
override val name: String = "好漫屋"
override val lang: String = "zh"
override val supportsLatest: Boolean = true
override val baseUrl: String = "https://app2.haomanwu.com"
// Popular
override fun popularMangaRequest(page: Int) = GET("$baseUrl/category/order/hits/page/$page", headers)
override fun popularMangaNextPageSelector(): String? = "div#Pagination a.next"
override fun popularMangaSelector(): String = "div.cate-comic-list > div.common-comic-item"
override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
title = element.select("p.comic__title > a").text()
url = element.select("p.comic__title > a").attr("href")
thumbnail_url = element.select("img").attr("data-original")
}
// Latest
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/category/order/addtime/page/$page", headers)
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
override fun latestUpdatesSelector() = popularMangaSelector()
override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element)
// Search
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return GET("$baseUrl/index.php/search?key=$query", headers)
}
override fun searchMangaNextPageSelector(): String? = null
override fun searchMangaSelector(): String = "li > a"
override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply {
title = element.text()
url = element.attr("href")
}
// Details
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
title = document.select("div.de-info__box > p.comic-title").text()
thumbnail_url = document.select("div.de-info__cover > img").attr("src")
author = document.select("div.comic-author > span.name > a").text()
artist = author
genre = document.select("div.comic-status > span.text:nth-child(1) a").eachText().joinToString(", ")
description = document.select("p.intro-total").text()
}
// Chapters
override fun chapterListSelector(): String = "ul.chapter__list-box > li"
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
url = element.select("a").attr("href")
name = element.select("a").text()
}
override fun chapterListParse(response: Response): List<SChapter> {
return super.chapterListParse(response).reversed()
}
// Pages
override fun pageListParse(document: Document): List<Page> {
return document.select("div.rd-article__pic > img.lazy-read")
.mapIndexed { i, el -> Page(i, "", el.attr("data-original")) }
}
override fun imageUrlParse(document: Document): String = throw Exception("Not Used")
}