mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-22 10:22:47 +01:00
parent
a115c794cf
commit
b908f79794
@ -42,6 +42,10 @@ abstract class MangaEsp(
|
||||
classLoader = this::class.java.classLoader!!,
|
||||
)
|
||||
|
||||
protected open val apiPath = "/api"
|
||||
|
||||
protected open val seriesPath = "/ver"
|
||||
|
||||
override val client: OkHttpClient = network.client.newBuilder()
|
||||
.rateLimitHost(baseUrl.toHttpUrl(), 2)
|
||||
.build()
|
||||
@ -49,7 +53,7 @@ abstract class MangaEsp(
|
||||
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
||||
.add("Referer", "$baseUrl/")
|
||||
|
||||
override fun popularMangaRequest(page: Int): Request = GET("$apiBaseUrl/api/topSerie", headers)
|
||||
override fun popularMangaRequest(page: Int): Request = GET("$apiBaseUrl$apiPath/topSerie", headers)
|
||||
|
||||
override fun popularMangaParse(response: Response): MangasPage {
|
||||
val responseData = json.decodeFromString<TopSeriesDto>(response.body.string())
|
||||
@ -58,17 +62,17 @@ abstract class MangaEsp(
|
||||
val topWeekly = responseData.response.topWeekly.flatten().map { it.data }
|
||||
val topMonthly = responseData.response.topMonthly.flatten().map { it.data }
|
||||
|
||||
val mangas = (topDaily + topWeekly + topMonthly).distinctBy { it.slug }.map { it.toSManga() }
|
||||
val mangas = (topDaily + topWeekly + topMonthly).distinctBy { it.slug }.map { it.toSManga(seriesPath) }
|
||||
|
||||
return MangasPage(mangas, false)
|
||||
}
|
||||
|
||||
override fun latestUpdatesRequest(page: Int): Request = GET("$apiBaseUrl/api/lastUpdates", headers)
|
||||
override fun latestUpdatesRequest(page: Int): Request = GET("$apiBaseUrl$apiPath/lastUpdates", headers)
|
||||
|
||||
override fun latestUpdatesParse(response: Response): MangasPage {
|
||||
val responseData = json.decodeFromString<LastUpdatesDto>(response.body.string())
|
||||
|
||||
val mangas = responseData.response.map { it.toSManga() }
|
||||
val mangas = responseData.response.map { it.toSManga(seriesPath) }
|
||||
|
||||
return MangasPage(mangas, false)
|
||||
}
|
||||
@ -151,7 +155,7 @@ abstract class MangaEsp(
|
||||
|
||||
return MangasPage(
|
||||
filteredList.subList((page - 1) * MANGAS_PER_PAGE, min(page * MANGAS_PER_PAGE, filteredList.size))
|
||||
.map { it.toSManga() },
|
||||
.map { it.toSManga(seriesPath) },
|
||||
hasNextPage,
|
||||
)
|
||||
}
|
||||
@ -171,7 +175,7 @@ abstract class MangaEsp(
|
||||
?: throw Exception(intl["comic_data_error"])
|
||||
val unescapedJson = mangaDetailsJson.unescape()
|
||||
val series = json.decodeFromString<SeriesDto>(unescapedJson)
|
||||
return series.chapters.map { it.toSChapter(series.slug) }
|
||||
return series.chapters.map { it.toSChapter(seriesPath, series.slug) }
|
||||
}
|
||||
|
||||
override fun pageListParse(response: Response): List<Page> {
|
||||
|
@ -48,11 +48,11 @@ class SeriesDto(
|
||||
@SerialName("idioma")
|
||||
val language: String? = null,
|
||||
) {
|
||||
fun toSManga(): SManga {
|
||||
fun toSManga(seriesPath: String): SManga {
|
||||
return SManga.create().apply {
|
||||
title = name
|
||||
thumbnail_url = thumbnail
|
||||
url = "/ver/$slug"
|
||||
url = "$seriesPath/$slug"
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ class ChapterDto(
|
||||
private val slug: String,
|
||||
@SerialName("created_at") private val date: String,
|
||||
) {
|
||||
fun toSChapter(seriesSlug: String): SChapter {
|
||||
fun toSChapter(seriesPath: String, seriesSlug: String): SChapter {
|
||||
return SChapter.create().apply {
|
||||
name = "Capítulo ${number.toString().removeSuffix(".0")}"
|
||||
if (!this@ChapterDto.name.isNullOrBlank()) {
|
||||
@ -115,7 +115,7 @@ class ChapterDto(
|
||||
} catch (e: Exception) {
|
||||
0L
|
||||
}
|
||||
url = "/ver/$seriesSlug/$slug"
|
||||
url = "$seriesPath/$seriesSlug/$slug"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,14 +32,14 @@ open class EternalMangas(
|
||||
|
||||
val mangas = (topDaily + topWeekly + topMonthly).distinctBy { it.slug }
|
||||
.filter { it.language == internalLang }
|
||||
.map { it.toSManga() }
|
||||
.map { it.toSManga(seriesPath) }
|
||||
|
||||
return MangasPage(mangas, false)
|
||||
}
|
||||
|
||||
override fun latestUpdatesParse(response: Response): MangasPage {
|
||||
val responseData = json.decodeFromString<LatestUpdatesDto>(response.body.string())
|
||||
val mangas = responseData.updates[internalLang]?.flatten()?.map { it.toSManga() } ?: emptyList()
|
||||
val mangas = responseData.updates[internalLang]?.flatten()?.map { it.toSManga(seriesPath) } ?: emptyList()
|
||||
return MangasPage(mangas, false)
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ ext {
|
||||
extClass = '.FoyScan'
|
||||
themePkg = 'mangaesp'
|
||||
baseUrl = 'https://foyscan.xyz'
|
||||
overrideVersionCode = 0
|
||||
overrideVersionCode = 1
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
@ -2,4 +2,15 @@ package eu.kanade.tachiyomi.extension.es.foyscan
|
||||
|
||||
import eu.kanade.tachiyomi.multisrc.mangaesp.MangaEsp
|
||||
|
||||
class FoyScan : MangaEsp("Foy Scan", "https://foyscan.xyz", "es")
|
||||
class FoyScan : MangaEsp(
|
||||
"Foy Scan",
|
||||
"https://foyscan.xyz",
|
||||
"es",
|
||||
"https://foyscan.xyz",
|
||||
) {
|
||||
// Series path changes from /ver to /serie
|
||||
override val versionId = 2
|
||||
|
||||
override val apiPath = "/apiv1"
|
||||
override val seriesPath = "/serie"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user