Updated parsing of manga title from URL. (#59)

This commit is contained in:
kooper100 2024-01-11 01:23:46 -05:00 committed by Draff
parent 2ff510b3d5
commit abc5afb00f
2 changed files with 6 additions and 4 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Madokami' extName = 'Madokami'
pkgNameSuffix = 'en.madokami' pkgNameSuffix = 'en.madokami'
extClass = '.Madokami' extClass = '.Madokami'
extVersionCode = 7 extVersionCode = 8
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -67,7 +67,10 @@ class Madokami : ConfigurableSource, ParsedHttpSource() {
override fun popularMangaFromElement(element: Element): SManga { override fun popularMangaFromElement(element: Element): SManga {
val manga = SManga.create() val manga = SManga.create()
manga.url = element.attr("href") manga.url = element.attr("href")
manga.title = URLDecoder.decode(element.attr("href").split("/").last(), "UTF-8").trimStart('!') val pathSegments = element.attr("href").split("/")
var i = pathSegments.size
manga.description = URLDecoder.decode(pathSegments[i - 1], "UTF-8")
do { i--; manga.title = URLDecoder.decode(pathSegments[i], "UTF-8") } while (URLDecoder.decode(pathSegments[i], "UTF-8").startsWith("!"))
return manga return manga
} }
@ -109,8 +112,7 @@ class Madokami : ConfigurableSource, ParsedHttpSource() {
override fun mangaDetailsParse(document: Document): SManga { override fun mangaDetailsParse(document: Document): SManga {
val manga = SManga.create() val manga = SManga.create()
manga.author = document.select("a[itemprop=\"author\"]").joinToString(", ") { it.text() } manga.author = document.select("a[itemprop=\"author\"]").joinToString(", ") { it.text() }
manga.description = "Tags: " + document.select("div.genres[itemprop=\"keywords\"] a.tag.tag-category").joinToString(", ") { it.text() } manga.genre = document.select("div.genres a.tag").joinToString(", ") { it.text() }
manga.genre = document.select("div.genres a.tag[itemprop=\"genre\"]").joinToString(", ") { it.text() }
manga.status = if (document.select("span.scanstatus").text() == "Yes") SManga.COMPLETED else SManga.UNKNOWN manga.status = if (document.select("span.scanstatus").text() == "Yes") SManga.COMPLETED else SManga.UNKNOWN
manga.thumbnail_url = document.select("div.manga-info img[itemprop=\"image\"]").attr("src") manga.thumbnail_url = document.select("div.manga-info img[itemprop=\"image\"]").attr("src")
return manga return manga