From 7a71a9d6fda95ab4cc929927c90426ae7a6e7850 Mon Sep 17 00:00:00 2001 From: Grafcube Date: Mon, 2 Sep 2024 04:21:00 +0530 Subject: [PATCH] fix(all/torrentioanime): Fix fetching episode list (#192) --- src/all/torrentioanime/build.gradle | 2 +- .../animeextension/all/torrentioanime/Torrentio.kt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/all/torrentioanime/build.gradle b/src/all/torrentioanime/build.gradle index 1c3a03be..c7de4b40 100644 --- a/src/all/torrentioanime/build.gradle +++ b/src/all/torrentioanime/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Torrentio Anime (Torrent / Debrid)' extClass = '.Torrentio' - extVersionCode = 7 + extVersionCode = 8 containsNsfw = false } diff --git a/src/all/torrentioanime/src/eu/kanade/tachiyomi/animeextension/all/torrentioanime/Torrentio.kt b/src/all/torrentioanime/src/eu/kanade/tachiyomi/animeextension/all/torrentioanime/Torrentio.kt index 21a386f0..dcc8c677 100644 --- a/src/all/torrentioanime/src/eu/kanade/tachiyomi/animeextension/all/torrentioanime/Torrentio.kt +++ b/src/all/torrentioanime/src/eu/kanade/tachiyomi/animeextension/all/torrentioanime/Torrentio.kt @@ -29,9 +29,11 @@ import kotlinx.serialization.json.Json import okhttp3.FormBody import okhttp3.Request import okhttp3.Response +import org.json.JSONObject import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy +import java.net.URL import java.text.SimpleDateFormat import java.util.Locale @@ -358,7 +360,9 @@ class Torrentio : ConfigurableAnimeSource, AnimeHttpSource() { // ============================== Episodes ============================== override fun episodeListRequest(anime: SAnime): Request { - return GET("https://anime-kitsu.strem.fun/meta/series/anilist%3A${anime.url}.json") + val res = URL("https://api.ani.zip/mappings?anilist_id=${anime.url}").readText() + val kitsuId = JSONObject(res).getJSONObject("mappings").getInt("kitsu_id").toString() + return GET("https://anime-kitsu.strem.fun/meta/series/kitsu%3A$kitsuId.json") } override fun episodeListParse(response: Response): List {