Flame Comics: Detect author as list + Display artists + Fix HTML tags in description (#8449)

* Detect author as list + Display artists + Fix HTML tags in description

* Correct camel case
This commit is contained in:
DokterKaj 2025-04-13 15:23:48 +08:00 committed by Draff
parent c6a92ce7c4
commit 400079e2ae
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
3 changed files with 11 additions and 8 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Flame Comics' extName = 'Flame Comics'
extClass = '.FlameComics' extClass = '.FlameComics'
extVersionCode = 41 extVersionCode = 42
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -22,6 +22,7 @@ import okhttp3.Protocol
import okhttp3.Request import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import okhttp3.ResponseBody.Companion.toResponseBody import okhttp3.ResponseBody.Companion.toResponseBody
import org.jsoup.Jsoup
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
@ -42,7 +43,7 @@ class FlameComics : HttpSource() {
.addInterceptor(::composedImageIntercept) .addInterceptor(::composedImageIntercept)
.build() .build()
private val removeSpecialCharsregex = Regex("[^A-Za-z0-9 ]") private val removeSpecialCharsRegex = Regex("[^A-Za-z0-9 ]")
private fun dataApiReqBuilder() = baseUrl.toHttpUrl().newBuilder().apply { private fun dataApiReqBuilder() = baseUrl.toHttpUrl().newBuilder().apply {
addPathSegment("_next") addPathSegment("_next")
@ -70,7 +71,7 @@ class FlameComics : HttpSource() {
GET( GET(
dataApiReqBuilder().apply { dataApiReqBuilder().apply {
addPathSegment("browse.json") addPathSegment("browse.json")
fragment("$page&${removeSpecialCharsregex.replace(query.lowercase(), "")}") fragment("$page&${removeSpecialCharsRegex.replace(query.lowercase(), "")}")
}.build(), }.build(),
headers, headers,
) )
@ -100,10 +101,10 @@ class FlameComics : HttpSource() {
titles += json.decodeFromString<List<String>>(series.altTitles) titles += json.decodeFromString<List<String>>(series.altTitles)
} }
titles.any { title -> titles.any { title ->
removeSpecialCharsregex.replace( removeSpecialCharsRegex.replace(
query.lowercase(), query.lowercase(),
"", "",
) in removeSpecialCharsregex.replace( ) in removeSpecialCharsRegex.replace(
title.lowercase(), title.lowercase(),
"", "",
) )
@ -185,13 +186,14 @@ class FlameComics : HttpSource() {
json.decodeFromString<MangaPageData>(response.body.string()).pageProps.series json.decodeFromString<MangaPageData>(response.body.string()).pageProps.series
title = seriesData.title title = seriesData.title
thumbnail_url = thumbnailUrl(seriesData) thumbnail_url = thumbnailUrl(seriesData)
description = seriesData.description description = Jsoup.parseBodyFragment(seriesData.description).wholeText()
genre = seriesData.tags?.let { tags -> genre = seriesData.tags?.let { tags ->
(listOf(seriesData.type) + tags).joinToString() (listOf(seriesData.type) + tags).joinToString()
} ?: seriesData.type } ?: seriesData.type
author = seriesData.author author = seriesData.author?.joinToString()
artist = seriesData.artist?.joinToString()
status = when (seriesData.status.lowercase()) { status = when (seriesData.status.lowercase()) {
"ongoing" -> SManga.ONGOING "ongoing" -> SManga.ONGOING
"dropped" -> SManga.CANCELLED "dropped" -> SManga.CANCELLED

View File

@ -72,7 +72,8 @@ class Series(
val cover: String, val cover: String,
val type: String, val type: String,
val tags: List<String>?, val tags: List<String>?,
val author: String?, val author: List<String>?,
val artist: List<String>?,
val status: String, val status: String,
val series_id: Int, val series_id: Int,
val last_edit: String, val last_edit: String,