Skip to content

Commit

Permalink
Fix AllAnime yet again (#433)
Browse files Browse the repository at this point in the history
* Fix AllAnime yet again

* Fix anime image preview

* Switch from graphql to allanimeapi for anime too
  • Loading branch information
4JX authored Oct 21, 2022
1 parent e7fa45d commit 402c70c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions app/src/main/java/ani/saikou/parsers/anime/AllAnime.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/ani/saikou/parsers/manga/AllAnime.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String>()
Expand Down

0 comments on commit 402c70c

Please sign in to comment.