Naga 2 years ago committed by Koitharu
parent e916f2a66e
commit 27c07d86bc

@ -182,10 +182,16 @@ internal abstract class HeanCms(
override suspend fun getAvailableTags(): Set<MangaTag> { override suspend fun getAvailableTags(): Set<MangaTag> {
val doc = webClient.httpGet("https://$domain/comics").parseHtml() val doc = webClient.httpGet("https://$domain/comics").parseHtml()
val regex = Regex("\"tags\\\\.*?(\\[.+?])") val regex = Regex("\"tags\\\\?\":\\s*\\[(.+?)]\\s*[},]")
val tags = doc.select("script").firstNotNullOf { script -> val tags = doc.select("script").joinToString("") { it.html() }
regex.find(script.html())?.groupValues?.getOrNull(1) .let { fullHtml ->
}.unescapeJson() regex.find(fullHtml)?.groupValues?.getOrNull(1)
}
?.unescapeJson()
?.replace(Regex(""""]\)\s*self\.__next_f\.push\(\[\d+,""""), "")
?.let { "[$it]" }
?: return emptySet()
return JSONArray(tags).mapJSON { return JSONArray(tags).mapJSON {
MangaTag( MangaTag(
key = it.getInt("id").toString(), key = it.getInt("id").toString(),
@ -194,4 +200,5 @@ internal abstract class HeanCms(
) )
}.toSet() }.toSet()
} }
} }

Loading…
Cancel
Save