SlimeRead: Update API url ()

Update apiurl
This commit is contained in:
bapeey 2024-02-17 10:20:50 -05:00 committed by Draff
parent ca8faa3a7e
commit 0d2056cabf
2 changed files with 11 additions and 11 deletions
src/pt/slimeread
build.gradle
src/eu/kanade/tachiyomi/extension/pt/slimeread

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'SlimeRead' extName = 'SlimeRead'
extClass = '.SlimeRead' extClass = '.SlimeRead'
extVersionCode = 2 extVersionCode = 3
isNsfw = true isNsfw = true
} }

View File

@ -30,6 +30,8 @@ class SlimeRead : HttpSource() {
override val baseUrl = "https://slimeread.com" override val baseUrl = "https://slimeread.com"
private val apiUrl = "https://free.slimeread.com:8443"
override val lang = "pt-BR" override val lang = "pt-BR"
override val supportsLatest = true override val supportsLatest = true
@ -37,7 +39,7 @@ class SlimeRead : HttpSource() {
override val client by lazy { override val client by lazy {
network.client.newBuilder() network.client.newBuilder()
.rateLimitHost(baseUrl.toHttpUrl(), 2) .rateLimitHost(baseUrl.toHttpUrl(), 2)
.rateLimitHost(API_URL.toHttpUrl(), 1) .rateLimitHost(apiUrl.toHttpUrl(), 1)
.build() .build()
} }
@ -46,7 +48,7 @@ class SlimeRead : HttpSource() {
private val json: Json by injectLazy() private val json: Json by injectLazy()
// ============================== Popular =============================== // ============================== Popular ===============================
override fun popularMangaRequest(page: Int) = GET("$API_URL/ranking/semana?nsfw=false", headers) override fun popularMangaRequest(page: Int) = GET("$apiUrl/ranking/semana?nsfw=false", headers)
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val items = response.parseAs<List<PopularMangaDto>>() val items = response.parseAs<List<PopularMangaDto>>()
@ -55,7 +57,7 @@ class SlimeRead : HttpSource() {
} }
// =============================== Latest =============================== // =============================== Latest ===============================
override fun latestUpdatesRequest(page: Int) = GET("$API_URL/books?page=$page", headers) override fun latestUpdatesRequest(page: Int) = GET("$apiUrl/books?page=$page", headers)
override fun latestUpdatesParse(response: Response): MangasPage { override fun latestUpdatesParse(response: Response): MangasPage {
val dto = response.parseAs<LatestResponseDto>() val dto = response.parseAs<LatestResponseDto>()
@ -68,7 +70,7 @@ class SlimeRead : HttpSource() {
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> { override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
return if (query.startsWith(PREFIX_SEARCH)) { // URL intent handler return if (query.startsWith(PREFIX_SEARCH)) { // URL intent handler
val id = query.removePrefix(PREFIX_SEARCH) val id = query.removePrefix(PREFIX_SEARCH)
client.newCall(GET("$API_URL/book/$id", headers)) client.newCall(GET("$apiUrl/book/$id", headers))
.asObservableSuccess() .asObservableSuccess()
.map(::searchMangaByIdParse) .map(::searchMangaByIdParse)
} else { } else {
@ -86,7 +88,7 @@ class SlimeRead : HttpSource() {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val params = SlimeReadFilters.getSearchParameters(filters) val params = SlimeReadFilters.getSearchParameters(filters)
val url = "$API_URL/book_search".toHttpUrl().newBuilder() val url = "$apiUrl/book_search".toHttpUrl().newBuilder()
.addIfNotBlank("query", query) .addIfNotBlank("query", query)
.addIfNotBlank("genre[]", params.genre) .addIfNotBlank("genre[]", params.genre)
.addIfNotBlank("status", params.status) .addIfNotBlank("status", params.status)
@ -105,7 +107,7 @@ class SlimeRead : HttpSource() {
// =========================== Manga Details ============================ // =========================== Manga Details ============================
override fun getMangaUrl(manga: SManga) = baseUrl + manga.url.replace("/book/", "/manga/") override fun getMangaUrl(manga: SManga) = baseUrl + manga.url.replace("/book/", "/manga/")
override fun mangaDetailsRequest(manga: SManga) = GET(API_URL + manga.url, headers) override fun mangaDetailsRequest(manga: SManga) = GET(apiUrl + manga.url, headers)
override fun mangaDetailsParse(response: Response) = SManga.create().apply { override fun mangaDetailsParse(response: Response) = SManga.create().apply {
val info = response.parseAs<MangaInfoDto>() val info = response.parseAs<MangaInfoDto>()
@ -124,7 +126,7 @@ class SlimeRead : HttpSource() {
// ============================== Chapters ============================== // ============================== Chapters ==============================
override fun chapterListRequest(manga: SManga) = override fun chapterListRequest(manga: SManga) =
GET("$API_URL/book_cap_units_all?manga_id=${manga.url.substringAfterLast("/")}", headers) GET("$apiUrl/book_cap_units_all?manga_id=${manga.url.substringAfterLast("/")}", headers)
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val items = response.parseAs<List<ChapterDto>>() val items = response.parseAs<List<ChapterDto>>()
@ -157,7 +159,7 @@ class SlimeRead : HttpSource() {
} }
// =============================== Pages ================================ // =============================== Pages ================================
override fun pageListRequest(chapter: SChapter) = GET(API_URL + chapter.url, headers) override fun pageListRequest(chapter: SChapter) = GET(apiUrl + chapter.url, headers)
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val pages = response.parseAs<List<PageListDto>>().flatMap { it.pages } val pages = response.parseAs<List<PageListDto>>().flatMap { it.pages }
@ -183,7 +185,5 @@ class SlimeRead : HttpSource() {
companion object { companion object {
const val PREFIX_SEARCH = "id:" const val PREFIX_SEARCH = "id:"
private const val API_URL = "https://ai3.slimeread.com:8443"
} }
} }