fix(en/9anime): Switch from Consumet's 9anime API (#1722)
This commit is contained in:
@ -6,7 +6,7 @@ ext {
|
|||||||
extName = 'FMovies'
|
extName = 'FMovies'
|
||||||
pkgNameSuffix = 'en.fmovies'
|
pkgNameSuffix = 'en.fmovies'
|
||||||
extClass = '.FMovies'
|
extClass = '.FMovies'
|
||||||
extVersionCode = 2
|
extVersionCode = 3
|
||||||
libVersion = '13'
|
libVersion = '13'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,10 +249,11 @@ class FMovies : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
)
|
)
|
||||||
val vidId = decrypted.substringAfterLast("/").substringBefore("?")
|
val vidId = decrypted.substringAfterLast("/").substringBefore("?")
|
||||||
val (serverName, action) = when (name) {
|
val (serverName, action) = when (name) {
|
||||||
"Vidstream" -> Pair("Vidstream", "vizcloud")
|
"Vidstream" -> Pair("Vidstream", "rawVizcloud")
|
||||||
"MyCloud" -> Pair("MyCloud", "mcloud")
|
"MyCloud" -> Pair("MyCloud", "rawMcloud")
|
||||||
else -> return@parallelMap null
|
else -> return@parallelMap null
|
||||||
}
|
}
|
||||||
|
|
||||||
val playlistUrl = callConsumet(vidId, action)
|
val playlistUrl = callConsumet(vidId, action)
|
||||||
val playlist = client.newCall(GET(playlistUrl, embedReferer)).execute()
|
val playlist = client.newCall(GET(playlistUrl, embedReferer)).execute()
|
||||||
|
|
||||||
@ -289,11 +290,19 @@ class FMovies : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
|
|
||||||
private fun callConsumet(query: String, action: String): String {
|
private fun callConsumet(query: String, action: String): String {
|
||||||
return client.newCall(
|
return client.newCall(
|
||||||
GET("https://api.consumet.org/anime/9anime/helper?query=$query&action=$action"),
|
GET("https://9anime.eltik.net/$action?query=$query&apikey=aniyomi"),
|
||||||
).execute().body.string().let {
|
).execute().body.string().let {
|
||||||
when (action) {
|
when (action) {
|
||||||
"vizcloud", "mcloud" -> {
|
"rawVizcloud", "rawMcloud" -> {
|
||||||
it.substringAfter("file\":\"").substringBefore("\"")
|
val rawURL = json.decodeFromString<RawResponse>(it).rawURL
|
||||||
|
val referer = if (action == "rawVizcloud") "https://vidstream.pro/" else "https://mcloud.to/"
|
||||||
|
val apiResponse = client.newCall(
|
||||||
|
GET(
|
||||||
|
url = rawURL,
|
||||||
|
headers = Headers.headersOf("Referer", referer),
|
||||||
|
),
|
||||||
|
).execute().body.string()
|
||||||
|
apiResponse.substringAfter("file\":\"").substringBefore("\"")
|
||||||
}
|
}
|
||||||
"fmovies-decrypt" -> {
|
"fmovies-decrypt" -> {
|
||||||
json.decodeFromString<VrfResponse>(it).url
|
json.decodeFromString<VrfResponse>(it).url
|
||||||
@ -411,7 +420,6 @@ class FMovies : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
private const val PREF_HOSTER_TITLE = "Enable/Disable Hosts"
|
private const val PREF_HOSTER_TITLE = "Enable/Disable Hosts"
|
||||||
private val PREF_HOSTER_DEFAULT = setOf("Vidstream", "Filemoon")
|
private val PREF_HOSTER_DEFAULT = setOf("Vidstream", "Filemoon")
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================== Settings ==============================
|
// ============================== Settings ==============================
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
|
@ -34,3 +34,8 @@ data class FMoviesSubs(
|
|||||||
val file: String,
|
val file: String,
|
||||||
val label: String,
|
val label: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class RawResponse(
|
||||||
|
val rawURL: String,
|
||||||
|
)
|
||||||
|
@ -6,7 +6,7 @@ ext {
|
|||||||
extName = '9anime'
|
extName = '9anime'
|
||||||
pkgNameSuffix = 'en.nineanime'
|
pkgNameSuffix = 'en.nineanime'
|
||||||
extClass = '.NineAnime'
|
extClass = '.NineAnime'
|
||||||
extVersionCode = 43
|
extVersionCode = 44
|
||||||
libVersion = '13'
|
libVersion = '13'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
throw Exception("Not used")
|
throw Exception("Not used")
|
||||||
|
|
||||||
private fun searchAnimeRequest(page: Int, query: String, filters: NineAnimeFilters.FilterSearchParams): Request {
|
private fun searchAnimeRequest(page: Int, query: String, filters: NineAnimeFilters.FilterSearchParams): Request {
|
||||||
val vrf = if (query.isNotBlank()) callConsumet(query, "searchVrf") else ""
|
val vrf = if (query.isNotBlank()) callConsumet(query, "vrf") else ""
|
||||||
var url = "$baseUrl/filter?keyword=$query"
|
var url = "$baseUrl/filter?keyword=$query"
|
||||||
|
|
||||||
if (filters.genre.isNotBlank()) url += filters.genre
|
if (filters.genre.isNotBlank()) url += filters.genre
|
||||||
@ -282,8 +282,8 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
)
|
)
|
||||||
val vidId = embedLink.substringAfterLast("/").substringBefore("?")
|
val vidId = embedLink.substringAfterLast("/").substringBefore("?")
|
||||||
val (serverName, action) = when (server.third) {
|
val (serverName, action) = when (server.third) {
|
||||||
"vidstream" -> Pair("Vidstream", "vizcloud")
|
"vidstream" -> Pair("Vidstream", "rawVizcloud")
|
||||||
"mycloud" -> Pair("MyCloud", "mcloud")
|
"mycloud" -> Pair("MyCloud", "rawMcloud")
|
||||||
else -> return emptyList()
|
else -> return emptyList()
|
||||||
}
|
}
|
||||||
val playlistUrl = callConsumet(vidId, action)
|
val playlistUrl = callConsumet(vidId, action)
|
||||||
@ -333,11 +333,20 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
|
|
||||||
private fun callConsumet(query: String, action: String): String {
|
private fun callConsumet(query: String, action: String): String {
|
||||||
return client.newCall(
|
return client.newCall(
|
||||||
GET("https://api.consumet.org/anime/9anime/helper?query=$query&action=$action"),
|
GET("https://9anime.eltik.net/$action?query=$query&apikey=aniyomi"),
|
||||||
).execute().body.string().let {
|
).execute().body.string().let {
|
||||||
when (action) {
|
when (action) {
|
||||||
"vizcloud", "mcloud" -> {
|
"rawVizcloud", "rawMcloud" -> {
|
||||||
it.substringAfter("file\":\"").substringBefore("\"")
|
val rawURL = json.decodeFromString<RawResponse>(it).rawURL
|
||||||
|
val referer = if (action == "rawVizcloud") "https://vidstream.pro/" else "https://mcloud.to/"
|
||||||
|
val apiResponse = client.newCall(
|
||||||
|
GET(
|
||||||
|
url = rawURL,
|
||||||
|
headers = Headers.headersOf("Referer", referer),
|
||||||
|
),
|
||||||
|
).execute().body.string()
|
||||||
|
|
||||||
|
apiResponse.substringAfter("file\":\"").substringBefore("\"")
|
||||||
}
|
}
|
||||||
"decrypt" -> {
|
"decrypt" -> {
|
||||||
json.decodeFromString<VrfResponse>(it).url
|
json.decodeFromString<VrfResponse>(it).url
|
||||||
@ -389,6 +398,11 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
val vrfQuery: String? = null,
|
val vrfQuery: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class RawResponse(
|
||||||
|
val rawURL: String,
|
||||||
|
)
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
val domainPref = ListPreference(screen.context).apply {
|
val domainPref = ListPreference(screen.context).apply {
|
||||||
key = "preferred_domain"
|
key = "preferred_domain"
|
||||||
|
Reference in New Issue
Block a user