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!!,
|
classLoader = this::class.java.classLoader!!,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
protected open val apiPath = "/api"
|
||||||
|
|
||||||
|
protected open val seriesPath = "/ver"
|
||||||
|
|
||||||
override val client: OkHttpClient = network.client.newBuilder()
|
override val client: OkHttpClient = network.client.newBuilder()
|
||||||
.rateLimitHost(baseUrl.toHttpUrl(), 2)
|
.rateLimitHost(baseUrl.toHttpUrl(), 2)
|
||||||
.build()
|
.build()
|
||||||
@ -49,7 +53,7 @@ abstract class MangaEsp(
|
|||||||
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
||||||
.add("Referer", "$baseUrl/")
|
.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 {
|
override fun popularMangaParse(response: Response): MangasPage {
|
||||||
val responseData = json.decodeFromString<TopSeriesDto>(response.body.string())
|
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 topWeekly = responseData.response.topWeekly.flatten().map { it.data }
|
||||||
val topMonthly = responseData.response.topMonthly.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)
|
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 {
|
override fun latestUpdatesParse(response: Response): MangasPage {
|
||||||
val responseData = json.decodeFromString<LastUpdatesDto>(response.body.string())
|
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)
|
return MangasPage(mangas, false)
|
||||||
}
|
}
|
||||||
@ -151,7 +155,7 @@ abstract class MangaEsp(
|
|||||||
|
|
||||||
return MangasPage(
|
return MangasPage(
|
||||||
filteredList.subList((page - 1) * MANGAS_PER_PAGE, min(page * MANGAS_PER_PAGE, filteredList.size))
|
filteredList.subList((page - 1) * MANGAS_PER_PAGE, min(page * MANGAS_PER_PAGE, filteredList.size))
|
||||||
.map { it.toSManga() },
|
.map { it.toSManga(seriesPath) },
|
||||||
hasNextPage,
|
hasNextPage,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -171,7 +175,7 @@ abstract class MangaEsp(
|
|||||||
?: throw Exception(intl["comic_data_error"])
|
?: throw Exception(intl["comic_data_error"])
|
||||||
val unescapedJson = mangaDetailsJson.unescape()
|
val unescapedJson = mangaDetailsJson.unescape()
|
||||||
val series = json.decodeFromString<SeriesDto>(unescapedJson)
|
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> {
|
override fun pageListParse(response: Response): List<Page> {
|
||||||
|
@ -48,11 +48,11 @@ class SeriesDto(
|
|||||||
@SerialName("idioma")
|
@SerialName("idioma")
|
||||||
val language: String? = null,
|
val language: String? = null,
|
||||||
) {
|
) {
|
||||||
fun toSManga(): SManga {
|
fun toSManga(seriesPath: String): SManga {
|
||||||
return SManga.create().apply {
|
return SManga.create().apply {
|
||||||
title = name
|
title = name
|
||||||
thumbnail_url = thumbnail
|
thumbnail_url = thumbnail
|
||||||
url = "/ver/$slug"
|
url = "$seriesPath/$slug"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ class ChapterDto(
|
|||||||
private val slug: String,
|
private val slug: String,
|
||||||
@SerialName("created_at") private val date: String,
|
@SerialName("created_at") private val date: String,
|
||||||
) {
|
) {
|
||||||
fun toSChapter(seriesSlug: String): SChapter {
|
fun toSChapter(seriesPath: String, seriesSlug: String): SChapter {
|
||||||
return SChapter.create().apply {
|
return SChapter.create().apply {
|
||||||
name = "Capítulo ${number.toString().removeSuffix(".0")}"
|
name = "Capítulo ${number.toString().removeSuffix(".0")}"
|
||||||
if (!this@ChapterDto.name.isNullOrBlank()) {
|
if (!this@ChapterDto.name.isNullOrBlank()) {
|
||||||
@ -115,7 +115,7 @@ class ChapterDto(
|
|||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
0L
|
0L
|
||||||
}
|
}
|
||||||
url = "/ver/$seriesSlug/$slug"
|
url = "$seriesPath/$seriesSlug/$slug"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,14 +32,14 @@ open class EternalMangas(
|
|||||||
|
|
||||||
val mangas = (topDaily + topWeekly + topMonthly).distinctBy { it.slug }
|
val mangas = (topDaily + topWeekly + topMonthly).distinctBy { it.slug }
|
||||||
.filter { it.language == internalLang }
|
.filter { it.language == internalLang }
|
||||||
.map { it.toSManga() }
|
.map { it.toSManga(seriesPath) }
|
||||||
|
|
||||||
return MangasPage(mangas, false)
|
return MangasPage(mangas, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun latestUpdatesParse(response: Response): MangasPage {
|
override fun latestUpdatesParse(response: Response): MangasPage {
|
||||||
val responseData = json.decodeFromString<LatestUpdatesDto>(response.body.string())
|
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)
|
return MangasPage(mangas, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ ext {
|
|||||||
extClass = '.FoyScan'
|
extClass = '.FoyScan'
|
||||||
themePkg = 'mangaesp'
|
themePkg = 'mangaesp'
|
||||||
baseUrl = 'https://foyscan.xyz'
|
baseUrl = 'https://foyscan.xyz'
|
||||||
overrideVersionCode = 0
|
overrideVersionCode = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
@ -2,4 +2,15 @@ package eu.kanade.tachiyomi.extension.es.foyscan
|
|||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.mangaesp.MangaEsp
|
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