From 402c70c80fbc0430e44766564bfbd96df2fa1e8f Mon Sep 17 00:00:00 2001 From: 4JX <79868816+4JX@users.noreply.github.com> Date: Fri, 21 Oct 2022 23:17:51 +0200 Subject: [PATCH] Fix AllAnime yet again (#433) * Fix AllAnime yet again * Fix anime image preview * Switch from graphql to allanimeapi for anime too --- .../java/ani/saikou/parsers/anime/AllAnime.kt | 15 +++++++++++++-- .../java/ani/saikou/parsers/manga/AllAnime.kt | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/ani/saikou/parsers/anime/AllAnime.kt b/app/src/main/java/ani/saikou/parsers/anime/AllAnime.kt index ac9d6b773..75ba0925d 100644 --- a/app/src/main/java/ani/saikou/parsers/anime/AllAnime.kt +++ b/app/src/main/java/ani/saikou/parsers/anime/AllAnime.kt @@ -34,7 +34,18 @@ class AllAnime : AnimeParser() { episodeInfos?.sortedBy { it.episodeIdNum }?.forEach { epInfo -> val link = """${hostUrl}/anime/$showId/episodes/${if (selectDub) "dub" else "sub"}/${epInfo.episodeIdNum}""" val epNum = format.format(epInfo.episodeIdNum).toString() - val thumbnail = epInfo.thumbnails?.let { if (it.isNotEmpty()) FileUrl(it[0]) else null } + val thumbnail = epInfo.thumbnails?.let { + + if (it.isNotEmpty()) { + var url = it[0]; + if (!url.startsWith("https")) { + url = "https://wp.youtube-anime.com/aln.youtube-anime.com" + url; + } + FileUrl(url) + } else { + null + } + } responseArray.add(Episode(epNum, link = link, epInfo.notes, thumbnail)) } } @@ -126,7 +137,7 @@ class AllAnime : AnimeParser() { private suspend fun graphqlQuery(variables: String, persistHash: String): Query { val extensions = """{"persistedQuery":{"version":1,"sha256Hash":"$persistHash"}}""" - val graphqlUrl = ("$hostUrl/graphql").toHttpUrl().newBuilder() + val graphqlUrl = ("$hostUrl/allanimeapi").toHttpUrl().newBuilder() .addQueryParameter("variables", variables) .addQueryParameter("extensions", extensions) .build().toString() diff --git a/app/src/main/java/ani/saikou/parsers/manga/AllAnime.kt b/app/src/main/java/ani/saikou/parsers/manga/AllAnime.kt index b27addf53..924f73689 100644 --- a/app/src/main/java/ani/saikou/parsers/manga/AllAnime.kt +++ b/app/src/main/java/ani/saikou/parsers/manga/AllAnime.kt @@ -63,7 +63,7 @@ class AllAnime : MangaParser() { private suspend fun graphqlQuery(variables: String, persistHash: String): Query? { val extensions = """{"persistedQuery":{"version":1,"sha256Hash":"$persistHash"}}""" - val graphqlUrl = ("$hostUrl/graphql").toHttpUrl().newBuilder().addQueryParameter("variables", variables) + val graphqlUrl = ("$hostUrl/allanimeapi").toHttpUrl().newBuilder().addQueryParameter("variables", variables) .addQueryParameter("extensions", extensions).build() println(variables) val headers = mutableMapOf()