LectorMoe(SenshiManga/Taikutsu): Filter out paid chapters and update api url (#7845)

* filter out chapters and update urls

* suscribersOnly
This commit is contained in:
bapeey 2025-02-28 22:26:17 -05:00 committed by Draff
parent 7b52dd532e
commit cd28f381bf
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
5 changed files with 15 additions and 5 deletions

View File

@ -2,4 +2,4 @@ plugins {
id("lib-multisrc") id("lib-multisrc")
} }
baseVersionCode = 1 baseVersionCode = 2

View File

@ -111,7 +111,11 @@ abstract class LectorMoe(
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val result = json.decodeFromString<Data<SeriesDto>>(response.body.string()) val result = json.decodeFromString<Data<SeriesDto>>(response.body.string())
val seriesSlug = result.data.slug 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 { override fun pageListRequest(chapter: SChapter): Request {

View File

@ -7,6 +7,7 @@ import kotlinx.serialization.Serializable
import java.text.ParseException import java.text.ParseException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import java.util.TimeZone
@Serializable @Serializable
class Data<T>(val data: T) class Data<T>(val data: T)
@ -53,18 +54,21 @@ class SeriesAuthorDto(
val name: String, 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 @Serializable
class SeriesChapterDto( class SeriesChapterDto(
private val title: String, private val title: String,
private val number: Float, private val number: Float,
private val createdAt: String, private val releasedAt: String,
val subscribersOnly: Boolean,
) { ) {
fun toSChapter(seriesSlug: String) = SChapter.create().apply { fun toSChapter(seriesSlug: String) = SChapter.create().apply {
name = "Capítulo ${number.toString().removeSuffix(".0")} - $title" name = "Capítulo ${number.toString().removeSuffix(".0")} - $title"
date_upload = try { date_upload = try {
dateFormat.parse(createdAt)?.time ?: 0L dateFormat.parse(releasedAt)?.time ?: 0L
} catch (_: ParseException) { } catch (_: ParseException) {
0L 0L
} }

View File

@ -6,4 +6,5 @@ class SenshiManga : LectorMoe(
"Senshi Manga", "Senshi Manga",
"https://senshimanga.capibaratraductor.com", "https://senshimanga.capibaratraductor.com",
"es", "es",
apiBaseUrl = "https://api.capibaratraductor.com",
) )

View File

@ -6,4 +6,5 @@ class Taikutsu : LectorMoe(
"Taikutsu", "Taikutsu",
"https://taikutsutl.capibaratraductor.com", "https://taikutsutl.capibaratraductor.com",
"es", "es",
apiBaseUrl = "https://api.capibaratraductor.com",
) )