LectorMoe(SenshiManga/Taikutsu): Filter out paid chapters and update api url (#7845)
* filter out chapters and update urls * suscribersOnly
This commit is contained in:
parent
7b52dd532e
commit
cd28f381bf
@ -2,4 +2,4 @@ plugins {
|
||||
id("lib-multisrc")
|
||||
}
|
||||
|
||||
baseVersionCode = 1
|
||||
baseVersionCode = 2
|
||||
|
@ -111,7 +111,11 @@ abstract class LectorMoe(
|
||||
override fun chapterListParse(response: Response): List<SChapter> {
|
||||
val result = json.decodeFromString<Data<SeriesDto>>(response.body.string())
|
||||
val seriesSlug = result.data.slug
|
||||
return result.data.chapters?.map { it.toSChapter(seriesSlug) } ?: emptyList()
|
||||
return result.data.chapters
|
||||
?.filter { it.subscribersOnly.not() }
|
||||
?.map { it.toSChapter(seriesSlug) }
|
||||
?.filter { it.date_upload < System.currentTimeMillis() }
|
||||
?: emptyList()
|
||||
}
|
||||
|
||||
override fun pageListRequest(chapter: SChapter): Request {
|
||||
|
@ -7,6 +7,7 @@ import kotlinx.serialization.Serializable
|
||||
import java.text.ParseException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import java.util.TimeZone
|
||||
|
||||
@Serializable
|
||||
class Data<T>(val data: T)
|
||||
@ -53,18 +54,21 @@ class SeriesAuthorDto(
|
||||
val name: String,
|
||||
)
|
||||
|
||||
private val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US)
|
||||
private val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US).apply {
|
||||
timeZone = TimeZone.getTimeZone("UTC")
|
||||
}
|
||||
|
||||
@Serializable
|
||||
class SeriesChapterDto(
|
||||
private val title: String,
|
||||
private val number: Float,
|
||||
private val createdAt: String,
|
||||
private val releasedAt: String,
|
||||
val subscribersOnly: Boolean,
|
||||
) {
|
||||
fun toSChapter(seriesSlug: String) = SChapter.create().apply {
|
||||
name = "Capítulo ${number.toString().removeSuffix(".0")} - $title"
|
||||
date_upload = try {
|
||||
dateFormat.parse(createdAt)?.time ?: 0L
|
||||
dateFormat.parse(releasedAt)?.time ?: 0L
|
||||
} catch (_: ParseException) {
|
||||
0L
|
||||
}
|
||||
|
@ -6,4 +6,5 @@ class SenshiManga : LectorMoe(
|
||||
"Senshi Manga",
|
||||
"https://senshimanga.capibaratraductor.com",
|
||||
"es",
|
||||
apiBaseUrl = "https://api.capibaratraductor.com",
|
||||
)
|
||||
|
@ -6,4 +6,5 @@ class Taikutsu : LectorMoe(
|
||||
"Taikutsu",
|
||||
"https://taikutsutl.capibaratraductor.com",
|
||||
"es",
|
||||
apiBaseUrl = "https://api.capibaratraductor.com",
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user