diff --git a/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt b/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt index 543132dd0..879e8018e 100644 --- a/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt +++ b/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt @@ -139,13 +139,17 @@ open class MyReadingManga(override val lang: String) : ParsedHttpSource() { val chapters = mutableListOf() val date = parseDate(document.select(".entry-time").attr("datetime").substringBefore("T")) + val mangaUrl = document.baseUri() + val chfirstname = document.select(".chapter-class a[href*=$mangaUrl]")?.first()?.text()?.ifEmpty { "Ch. 1" }?.capitalize() ?:"Ch. 1" //create first chapter since its on main manga page - chapters.add(createChapter("1", document.baseUri(), date)) + chapters.add(createChapter("1", document.baseUri(), date, chfirstname)) //see if there are multiple chapters or not document.select(chapterListSelector())?.let { it -> it.forEach { if (!it.text().contains("Next ยป", true)) { - chapters.add(createChapter(it.text(), document.baseUri(), date)) + val pageNumber = it.text() + val chname = document.select(".chapter-class a[href$=/$pageNumber/]")?.text()?.ifEmpty { "Ch. $pageNumber" }?.capitalize() ?:"Ch. $pageNumber" + chapters.add(createChapter(it.text(), document.baseUri(), date, chname)) } } } @@ -158,10 +162,10 @@ open class MyReadingManga(override val lang: String) : ParsedHttpSource() { return SimpleDateFormat("yyyy-MM-dd").parse(date).time } - private fun createChapter(pageNumber: String, mangaUrl: String, date: Long): SChapter { + private fun createChapter(pageNumber: String, mangaUrl: String, date: Long, chname: String): SChapter { val chapter = SChapter.create() chapter.setUrlWithoutDomain("$mangaUrl/$pageNumber") - chapter.name = "Ch. $pageNumber" + chapter.name = chname chapter.date_upload = date return chapter }