[Grouple] Added Seimanga support
This commit is contained in:
@@ -94,6 +94,7 @@ class Manga(
|
||||
largeCoverUrl: String? = this.largeCoverUrl,
|
||||
description: String? = this.description,
|
||||
chapters: List<MangaChapter>? = this.chapters,
|
||||
source: MangaSource = this.source,
|
||||
) = Manga(
|
||||
id = id,
|
||||
title = title,
|
||||
@@ -109,7 +110,7 @@ class Manga(
|
||||
largeCoverUrl = largeCoverUrl,
|
||||
description = description,
|
||||
chapters = chapters,
|
||||
source = source
|
||||
source = source,
|
||||
)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
|
||||
@@ -4,6 +4,7 @@ import kotlinx.coroutines.flow.channelFlow
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.launch
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||
import okhttp3.Interceptor
|
||||
@@ -112,7 +113,8 @@ internal abstract class GroupleParser(
|
||||
}
|
||||
|
||||
override suspend fun getDetails(manga: Manga): Manga {
|
||||
val doc = webClient.httpGet(manga.url.toAbsoluteUrl(domain)).checkAuthRequired().parseHtml()
|
||||
val response = webClient.httpGet(manga.url.toAbsoluteUrl(domain)).checkAuthRequired()
|
||||
val doc = response.parseHtml()
|
||||
val root = doc.body().requireElementById("mangaBox").selectFirstOrThrow("div.leftContent")
|
||||
val dateFormat = SimpleDateFormat("dd.MM.yy", Locale.US)
|
||||
val coverImg = root.selectFirst("div.subject-cover")?.selectFirst("img")
|
||||
@@ -125,7 +127,9 @@ internal abstract class GroupleParser(
|
||||
} else {
|
||||
null
|
||||
}
|
||||
val newSource = getSource(response.request.url)
|
||||
return manga.copy(
|
||||
source = newSource,
|
||||
description = root.selectFirst("div.manga-description")?.html(),
|
||||
largeCoverUrl = coverImg?.attr("data-full"),
|
||||
coverUrl = coverImg?.attr("data-thumb") ?: manga.coverUrl,
|
||||
@@ -160,7 +164,7 @@ internal abstract class GroupleParser(
|
||||
url = href,
|
||||
uploadDate = dateFormat.tryParse(tr.selectFirst("td.date")?.text()),
|
||||
scanlator = translators,
|
||||
source = source,
|
||||
source = newSource,
|
||||
branch = null,
|
||||
),
|
||||
)
|
||||
@@ -177,7 +181,7 @@ internal abstract class GroupleParser(
|
||||
url = link,
|
||||
uploadDate = dateFormat.tryParse(jo.getStringOrNull("dateCreated")),
|
||||
scanlator = null,
|
||||
source = source,
|
||||
source = newSource,
|
||||
branch = translations[personId],
|
||||
)
|
||||
}
|
||||
@@ -187,7 +191,11 @@ internal abstract class GroupleParser(
|
||||
}
|
||||
|
||||
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||
val doc = webClient.httpGet(chapter.url.toAbsoluteUrl(domain) + "?mtr=1").checkAuthRequired().parseHtml()
|
||||
if (chapter.source != source) { // handle redirects between websites
|
||||
return context.newParserInstance(chapter.source).getPages(chapter)
|
||||
}
|
||||
val url = chapter.url.toAbsoluteUrl(domain).toHttpUrl().newBuilder().setQueryParameter("mtr", "1").build()
|
||||
val doc = webClient.httpGet(url).checkAuthRequired().parseHtml()
|
||||
val scripts = doc.select("script")
|
||||
for (script in scripts) {
|
||||
val data = script.html()
|
||||
@@ -292,6 +300,14 @@ internal abstract class GroupleParser(
|
||||
return root.select("div.tile").mapNotNull(::parseManga)
|
||||
}
|
||||
|
||||
protected open fun getSource(url: HttpUrl): MangaSource = when (url.host) {
|
||||
in SeiMangaParser.domains -> MangaSource.SEIMANGA
|
||||
in MintMangaParser.domains -> MangaSource.MINTMANGA
|
||||
in ReadmangaParser.domains -> MangaSource.READMANGA_RU
|
||||
in SelfMangaParser.domains -> MangaSource.SELFMANGA
|
||||
else -> source
|
||||
}
|
||||
|
||||
private fun getSortKey(sortOrder: SortOrder) = when (sortOrder) {
|
||||
SortOrder.ALPHABETICAL -> "name"
|
||||
SortOrder.POPULARITY -> "rate"
|
||||
|
||||
@@ -10,9 +10,14 @@ internal class MintMangaParser(
|
||||
context: MangaLoaderContext,
|
||||
) : GroupleParser(context, MangaSource.MINTMANGA, 2) {
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain(
|
||||
"24.mintmanga.one",
|
||||
"mintmanga.live",
|
||||
"mintmanga.com",
|
||||
)
|
||||
override val configKeyDomain = ConfigKey.Domain(*domains)
|
||||
|
||||
companion object {
|
||||
|
||||
val domains = arrayOf(
|
||||
"24.mintmanga.one",
|
||||
"mintmanga.live",
|
||||
"mintmanga.com",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,14 @@ internal class ReadmangaParser(
|
||||
context: MangaLoaderContext,
|
||||
) : GroupleParser(context, MangaSource.READMANGA_RU, 1) {
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain(
|
||||
"readmanga.live",
|
||||
"readmanga.io",
|
||||
"readmanga.me",
|
||||
)
|
||||
override val configKeyDomain = ConfigKey.Domain(*domains)
|
||||
|
||||
companion object {
|
||||
|
||||
val domains = arrayOf(
|
||||
"readmanga.live",
|
||||
"readmanga.io",
|
||||
"readmanga.me",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.koitharu.kotatsu.parsers.site.ru.grouple
|
||||
|
||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||
import org.koitharu.kotatsu.parsers.config.ConfigKey
|
||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||
|
||||
@MangaSourceParser("SEIMANGA", "SeiManga", "ru")
|
||||
internal class SeiMangaParser(
|
||||
context: MangaLoaderContext,
|
||||
) : GroupleParser(context, MangaSource.SEIMANGA, 21) {
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain(*domains)
|
||||
|
||||
companion object {
|
||||
|
||||
val domains = arrayOf(
|
||||
"seimanga.me",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,12 @@ internal class SelfMangaParser(
|
||||
context: MangaLoaderContext,
|
||||
) : GroupleParser(context, MangaSource.SELFMANGA, 3) {
|
||||
|
||||
override val configKeyDomain = ConfigKey.Domain("selfmanga.live")
|
||||
override val configKeyDomain = ConfigKey.Domain(*domains)
|
||||
|
||||
companion object {
|
||||
|
||||
val domains = arrayOf(
|
||||
"selfmanga.live",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user