NineManga: cleaning manga title from ch name (#13730)

if manga title contains number can cause some issue to tracking and taking space

closes #13219
This commit is contained in:
Riztard Lanthorn 2022-10-07 20:34:56 +07:00 committed by GitHub
parent 1cb0baf862
commit 9310239ddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'NineManga' extName = 'NineManga'
pkgNameSuffix = "all.ninemanga" pkgNameSuffix = "all.ninemanga"
extClass = '.NineMangaFactory' extClass = '.NineMangaFactory'
extVersionCode = 16 extVersionCode = 17
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -51,6 +51,9 @@ open class NineManga(
override fun popularMangaNextPageSelector() = latestUpdatesNextPageSelector() override fun popularMangaNextPageSelector() = latestUpdatesNextPageSelector()
// for cleaning manga title from chapter name
private var mangaTitleForCleaning = ""
override fun mangaDetailsParse(document: Document) = SManga.create().apply { override fun mangaDetailsParse(document: Document) = SManga.create().apply {
document.select("div.bookintro").let { document.select("div.bookintro").let {
title = it.select("li > span:not([class])").text().removeSuffix(" Manga") title = it.select("li > span:not([class])").text().removeSuffix(" Manga")
@ -59,6 +62,8 @@ open class NineManga(
status = parseStatus(it.select("li a.red").first().text()) status = parseStatus(it.select("li a.red").first().text())
description = it.select("p[itemprop=description]").text() description = it.select("p[itemprop=description]").text()
thumbnail_url = it.select("img[itemprop=image]").attr("abs:src") thumbnail_url = it.select("img[itemprop=image]").attr("abs:src")
mangaTitleForCleaning = "$title "
} }
} }
@ -76,7 +81,7 @@ open class NineManga(
override fun chapterFromElement(element: Element) = SChapter.create().apply { override fun chapterFromElement(element: Element) = SChapter.create().apply {
element.select("a.chapter_list_a").let { element.select("a.chapter_list_a").let {
name = it.text() name = it.text().replace(mangaTitleForCleaning, "", true)
url = it.attr("href").substringAfter(baseUrl).replace("%20", " ") url = it.attr("href").substringAfter(baseUrl).replace("%20", " ")
} }
date_upload = parseChapterDate(element.select("span").text()) date_upload = parseChapterDate(element.select("span").text())