Skip to content

Commit

Permalink
Anichi: removed dead source
Browse files Browse the repository at this point in the history
  • Loading branch information
olivia committed Jan 26, 2024
1 parent 25ab02c commit 2a24701
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 119 deletions.
4 changes: 2 additions & 2 deletions Anichi/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.konan.properties.Properties

// use an integer for version numbers
version = 9
version = 10

android {
defaultConfig {
Expand Down Expand Up @@ -38,5 +38,5 @@ cloudstream {
"OVA",
)

iconUrl = "https://media.discordapp.net/attachments/1059306855865782282/1123970193274712096/Anichi.png"
iconUrl = "https://cdn.discordapp.com/attachments/1109266606292488297/1200409381813100554/Untitled-removebg-preview.png"
}
27 changes: 6 additions & 21 deletions Anichi/src/main/kotlin/com/hexated/Anichi.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.hexated

import com.hexated.AnichiExtractors.invokeExternalSources
import com.hexated.AnichiExtractors.invokeInternalSources
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
Expand Down Expand Up @@ -214,25 +213,12 @@ open class Anichi : MainAPI() {

val loadData = parseJson<AnichiLoadData>(data)

argamap(
{
invokeInternalSources(
loadData.hash,
loadData.dubStatus,
loadData.episode,
subtitleCallback,
callback
)
},
{
invokeExternalSources(
loadData.idMal,
loadData.dubStatus,
loadData.episode,
subtitleCallback,
callback
)
}
invokeInternalSources(
loadData.hash,
loadData.dubStatus,
loadData.episode,
subtitleCallback,
callback
)

return true
Expand All @@ -245,7 +231,6 @@ open class Anichi : MainAPI() {

const val anilistApi = "https://graphql.anilist.co"
const val jikanApi = "https://api.jikan.moe/v4"
const val marinHost = "https://marin.moe"

private const val mainHash = "e42a4466d984b2c0a2cecae5dd13aa68867f634b16ee0f17b380047d14482406"
private const val popularHash = "31a117653812a2547fd981632e8c99fa8bf8a75c4ef1a77a1567ef1741a7ab9c"
Expand Down
61 changes: 0 additions & 61 deletions Anichi/src/main/kotlin/com/hexated/AnichiExtractors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -121,67 +121,6 @@ object AnichiExtractors : Anichi() {
}
}

suspend fun invokeExternalSources(
idMal: Int? = null,
dubStatus: String,
episode: String,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
) {
val ids = app.get("https://api.malsync.moe/mal/anime/${idMal ?: return}")
.parsedSafe<MALSyncResponses>()?.sites

if (dubStatus == "sub") invokeMarin(ids?.marin?.keys?.firstOrNull(), episode, callback)

}

private suspend fun invokeMarin(
id: String? = null,
episode: String,
callback: (ExtractorLink) -> Unit
) {
val url = "$marinHost/anime/${id ?: return}/$episode"
val cookies = app.get(
"$marinHost/anime",
headers = mapOf(
"Cookie" to "__ddg1_=;__ddg2_=;"
),
referer = "$marinHost/anime",
).cookies.let {
decode(it["XSRF-TOKEN"].toString()) to decode(it["marin_session"].toString())
}

val json = app.get(
url,
headers = mapOf(
"Accept" to "text/html, application/xhtml+xml",
"Cookie" to "__ddg1=;__ddg2_=;XSRF-TOKEN=${cookies.first};marin_session=${cookies.second};",
"X-XSRF-TOKEN" to cookies.first
),
referer = "$marinHost/anime/$id"
).document.selectFirst("div#app")?.attr("data-page")
tryParseJson<MarinResponses>(json)?.props?.video?.data?.mirror?.map { video ->
callback.invoke(
ExtractorLink(
"Marin",
"Marin",
video.code?.file ?: return@map,
url,
video.code.height ?: Qualities.Unknown.value,
headers = mapOf(
"Accept" to "video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5",
"Accept-Language" to "en-US,en;q=0.5",
"Cookie" to "__ddg1=;__ddg2_=; XSRF-TOKEN=${cookies.first}; marin_session=${cookies.second};",
"Connection" to "keep-alive",
"Sec-Fetch-Dest" to "video",
"Sec-Fetch-Mode" to "cors",
"Sec-Fetch-Site" to "cross-site",
)
)
)
}
}

private suspend fun invokeGogo(
link: String,
subtitleCallback: (SubtitleFile) -> Unit,
Expand Down
35 changes: 0 additions & 35 deletions Anichi/src/main/kotlin/com/hexated/AnichiParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ data class PageStatus(
@JsonProperty("__typename") val _typename: String? = null
)


data class Recommendations(
@JsonProperty("anyCard") val anyCard: AnyCard? = null,
@JsonProperty("pageStatus") val pageStatus: PageStatus? = PageStatus(),
Expand All @@ -255,38 +254,4 @@ data class QueryPopular(

data class DataPopular(
@JsonProperty("queryPopular") val queryPopular: QueryPopular? = QueryPopular()
)

data class MALSyncSites(
@JsonProperty("Zoro") val zoro: HashMap<String?, HashMap<String, String?>>? = hashMapOf(),
@JsonProperty("Marin") val marin: HashMap<String?, HashMap<String, String?>>? = hashMapOf(),
)

data class MALSyncResponses(
@JsonProperty("Sites") val sites: MALSyncSites? = null,
)

data class MarinCode(
@JsonProperty("file") val file: String? = null,
@JsonProperty("height") val height: Int? = null,
)

data class MarinMirror(
@JsonProperty("code") val code: MarinCode? = null,
)

data class MarinData(
@JsonProperty("mirror") val mirror: ArrayList<MarinMirror>? = arrayListOf(),
)

data class MarinVideos(
@JsonProperty("data") val data: MarinData? = null,
)

data class MarinProps(
@JsonProperty("video") val video: MarinVideos? = null,
)

data class MarinResponses(
@JsonProperty("props") val props: MarinProps? = null,
)

0 comments on commit 2a24701

Please sign in to comment.