Fix chapter names in FallenAngels (#7469)
* create override for fallenangels in mmrcms * construct chapter name without manga name previous - <mangaName> <chapterNumber> : <chapterTitle> current - Chapter <chapterNumber> : <chapterTitle> * remove unnecessary code not specific to fallenangels - name the package correctly to fallenangels - remove excess code copied over from MMRCMS method that isn't required for fallenangel source - refactor parsing date for date_upload - parse the correct Tag from Element to get Chapter title * remove unused regex * update versionCode for FallenAngels in generator
This commit is contained in:
parent
ba1da0be4c
commit
aac7a7375f
|
@ -0,0 +1,55 @@
|
|||
package eu.kanade.tachiyomi.extension.en.fallenangels
|
||||
|
||||
import eu.kanade.tachiyomi.multisrc.mmrcms.MMRCMS
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Element
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
|
||||
class FallenAngels : MMRCMS("Fallen Angels", "https://manga.fascans.com", "en") {
|
||||
|
||||
/**
|
||||
* Parses the response from the site and returns a list of chapters.
|
||||
*
|
||||
* Overriden to allow for null chapters
|
||||
*
|
||||
* @param response the response from the site.
|
||||
*/
|
||||
override fun chapterListParse(response: Response): List<SChapter> {
|
||||
val document = response.asJsoup()
|
||||
return document.select(chapterListSelector()).mapNotNull { nullableChapterFromElement(it) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a chapter from the given element.
|
||||
*
|
||||
* @param element an element obtained from [chapterListSelector].
|
||||
*/
|
||||
private fun nullableChapterFromElement(element: Element): SChapter? {
|
||||
val chapter = SChapter.create()
|
||||
|
||||
val titleWrapper = element.select("[class^=chapter-title-rtl]").first()
|
||||
val chapterElement = titleWrapper.getElementsByTag("a")
|
||||
val url = chapterElement.attr("href")
|
||||
|
||||
chapter.url = getUrlWithoutBaseUrl(url)
|
||||
|
||||
// Construct chapter names
|
||||
// before -> <mangaName> <chapterNumber> : <chapterTitle>
|
||||
// after -> Chapter <chapterNumber> : <chapterTitle>
|
||||
val chapterText = chapterElement.text()
|
||||
val numberRegex = Regex("""\d+""")
|
||||
val chapterNumber = numberRegex.find(chapterText)?.value.orEmpty()
|
||||
val chapterTitle = titleWrapper.getElementsByTag("em").text()
|
||||
chapter.name = "Chapter $chapterNumber : $chapterTitle"// titleWrapper.text()
|
||||
|
||||
// Parse date
|
||||
val dateText = element.getElementsByClass("date-chapter-title-rtl").text().trim()
|
||||
val dateFormat = SimpleDateFormat("d MMM. yyyy", Locale.US)
|
||||
chapter.date_upload = dateFormat.parse(dateText)?.time ?: 0L
|
||||
|
||||
return chapter
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.multisrc.mmrcms
|
|||
|
||||
import java.util.Locale
|
||||
|
||||
|
||||
class MMRCMSSources {
|
||||
companion object {
|
||||
sealed class SourceData {
|
||||
|
@ -37,7 +36,7 @@ class MMRCMSSources {
|
|||
val sourceList: List<SourceData.Single> = listOf(
|
||||
SourceData.Single("مانجا اون لاين", "https://onma.me", "ar", className = "onma"),
|
||||
SourceData.Single("Read Comics Online", "https://readcomicsonline.ru", "en"),
|
||||
SourceData.Single("Fallen Angels", "https://manga.fascans.com", "en"),
|
||||
SourceData.Single("Fallen Angels", "https://manga.fascans.com", "en", overrideVersionCode = 1),
|
||||
SourceData.Single("Zahard", "https://zahard.top", "en", overrideVersionCode = 1),
|
||||
SourceData.Single("Manhwas Men", "https://manhwas.men", "en", isNsfw = true, overrideVersionCode = 1),
|
||||
SourceData.Single("Scan FR", "https://www.scan-fr.cc", "fr"),
|
||||
|
@ -74,8 +73,6 @@ class MMRCMSSources {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//SingleLang("Mangás Yuri", "https://mangasyuri.net", "pt-BR", className = "MangasYuri"), override val id: Long = 6456162511058446409
|
||||
//SingleLang("FR Scan", "https://www.frscan.me", "fr"),
|
||||
// Reference from old Factory Source
|
||||
|
|
Loading…
Reference in New Issue