New way to get tags

shub39 1 year ago
parent ba5086c409
commit 41f5cee6c6

@ -143,6 +143,7 @@ internal class Mangakakalot(context: MangaLoaderContext) :
tags = emptySet(), tags = emptySet(),
authors = emptySet(), authors = emptySet(),
state = null, state = null,
description = div.selectFirst("h2")?.text() ?: "No Description",
source = source, source = source,
contentRating = null, contentRating = null,
) )
@ -151,16 +152,23 @@ internal class Mangakakalot(context: MangaLoaderContext) :
override suspend fun fetchAvailableTags(): Set<MangaTag> { override suspend fun fetchAvailableTags(): Set<MangaTag> {
val doc = webClient.httpGet("https://$domain").parseHtml() val doc = webClient.httpGet("https://$domain").parseHtml()
val tags = doc.select("ul.tag li a").drop(1) val tags = doc.select("td a[href*='/genre/']").drop(1)
return tags.mapToSet { a -> val uniqueTags = mutableSetOf<MangaTag>()
val key = a.attr("href").substringAfterLast("category=").substringBefore("&") for (a in tags) {
val name = a.attr("title").replace(" Manga", "") val key = a.attr("href").substringAfter("/genre/").substringBefore("?")
val name = a.text().replaceFirstChar { it.uppercaseChar() }
if (uniqueTags.none { it.key == key }) {
uniqueTags.add(
MangaTag( MangaTag(
key = key, key = key,
title = name, title = name,
source = source, source = source,
) )
)
}
} }
return uniqueTags
} }
override suspend fun getChapters(doc: Document): List<MangaChapter> { override suspend fun getChapters(doc: Document): List<MangaChapter> {

Loading…
Cancel
Save