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 {
extName = 'Flame Comics'
extClass = '.FlameComics'
extVersionCode = 41
extVersionCode = 42
}
apply from: "$rootDir/common.gradle"

View File

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

View File

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