zh/BoyLove: Fix chapter list parsing and enable upload dates display in chapters (#8754)

* zh/BoyLove: Fix chapter list parsing and Enable upload dates

* import and use tryParse
This commit is contained in:
morallkat 2025-05-10 22:24:19 +08:00 committed by Draff
parent 0b3628f24e
commit 3e1688e565
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
3 changed files with 8 additions and 4 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'BoyLove' extName = 'BoyLove'
extClass = '.BoyLove' extClass = '.BoyLove'
extVersionCode = 13 extVersionCode = 14
isNsfw = true isNsfw = true
} }

View File

@ -92,10 +92,11 @@ class BoyLove : HttpSource(), ConfigurableSource {
override fun mangaDetailsParse(response: Response) = throw UnsupportedOperationException() override fun mangaDetailsParse(response: Response) = throw UnsupportedOperationException()
override fun chapterListRequest(manga: SManga): Request = override fun chapterListRequest(manga: SManga): Request =
GET("$baseUrl/home/api/chapter_list/tp/${manga.url}-0-0-10", headers) GET("$baseUrl/home/api/chapter_list/tp/${manga.url}", headers)
override fun chapterListParse(response: Response): List<SChapter> = override fun chapterListParse(response: Response): List<SChapter> {
response.parseAs<ListPageDto<ChapterDto>>().list.map { it.toSChapter() } return response.parseAs<ListPageDto<ChapterDto>>().list.map { it.toSChapter() }.reversed()
}
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> { override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
val chapterUrl = chapter.url val chapterUrl = chapter.url

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.extension.zh.boylove
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import keiyoushi.utils.tryParse
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonPrimitive import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.long import kotlinx.serialization.json.long
@ -56,10 +57,12 @@ fun String.toImageUrl() =
class ChapterDto( class ChapterDto(
private val id: Int, private val id: Int,
private val title: String, private val title: String,
private val create_time: String,
) { ) {
fun toSChapter() = SChapter.create().apply { fun toSChapter() = SChapter.create().apply {
url = "/home/book/capter/id/$id" url = "/home/book/capter/id/$id"
name = title.trim() name = title.trim()
date_upload = dateFormat.tryParse(create_time)
} }
} }