Try fix crunchy
This commit is contained in:
parent
c874e063ce
commit
ec1ed7957a
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 1
|
version = 2
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
@ -19,5 +19,4 @@ cloudstream {
|
||||||
status = 1 // will be 3 if unspecified
|
status = 1 // will be 3 if unspecified
|
||||||
tvTypes = listOf("AnimeMovie", "Anime", "OVA")
|
tvTypes = listOf("AnimeMovie", "Anime", "OVA")
|
||||||
iconUrl = "https://www.google.com/s2/favicons?domain=crunchyroll.com&sz=%size%"
|
iconUrl = "https://www.google.com/s2/favicons?domain=crunchyroll.com&sz=%size%"
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,110 +1,50 @@
|
||||||
package com.lagradost
|
package com.lagradost
|
||||||
////Credits https://github.com/ArjixWasTaken/CloudStream-3/blob/master/app/src/main/java/com/ArjixWasTaken/cloudstream3/utils/HttpSession.kt
|
//Credits https://github.com/ArjixWasTaken/CloudStream-3/blob/master/app/src/main/java/com/ArjixWasTaken/cloudstream3/utils/HttpSession.kt
|
||||||
//import com.lagradost.KrunchyProvider
|
import com.lagradost.cloudstream3.app
|
||||||
//import khttp.responses.Response
|
import com.lagradost.nicehttp.NiceResponse
|
||||||
//import khttp.structures.authorization.Authorization
|
|
||||||
//import khttp.structures.cookie.Cookie
|
/**
|
||||||
//import khttp.structures.cookie.CookieJar
|
* An HTTP session manager.
|
||||||
//import khttp.structures.files.FileLike
|
*
|
||||||
//import okhttp3.CookieJar
|
* This class simply keeps cookies across requests.
|
||||||
//import java.util.ArrayList
|
*
|
||||||
//
|
* @property sessionCookies A cookie jar.
|
||||||
///**
|
*
|
||||||
// * An HTTP session manager.
|
* TODO: be replaced with built in Session once that works as it should.
|
||||||
// *
|
*/
|
||||||
// * This class simply keeps cookies across requests.
|
class HttpSession {
|
||||||
// *
|
private val sessionCookies: MutableMap<String, String> = mutableMapOf()
|
||||||
// * @property sessionCookies A cookie jar.
|
|
||||||
// */
|
suspend fun get(
|
||||||
//class HttpSession {
|
url: String,
|
||||||
// companion object {
|
headers: Map<String, String> = mapOf(),
|
||||||
// const val DEFAULT_TIMEOUT = 30.0
|
cookies: Map<String, String> = mapOf(),
|
||||||
//
|
): NiceResponse {
|
||||||
// fun mergeCookies(cookie1: CookieJar, cookie2: Map<String, String>?): Map<String, String> {
|
sessionCookies.putAll(cookies)
|
||||||
// if (!cookie2.isNullOrEmpty()) {
|
val res =
|
||||||
// cookie1.putAll(cookie2)
|
app.get(
|
||||||
// }
|
url,
|
||||||
// return a
|
headers,
|
||||||
// }
|
cookies = sessionCookies,
|
||||||
// }
|
)
|
||||||
//
|
sessionCookies.putAll(res.headers.filter { it.first.lowercase() == "set-cookie" })
|
||||||
// val sessionCookies = CookieJar()
|
return res
|
||||||
//
|
}
|
||||||
// fun get(
|
|
||||||
// url: String,
|
suspend fun post(
|
||||||
// headers: Map<String, String?> = mapOf(),
|
url: String,
|
||||||
// params: Map<String, String> = mapOf(),
|
headers: Map<String, String> = mapOf(),
|
||||||
// data: Any? = null,
|
cookies: Map<String, String> = mapOf(),
|
||||||
// json: Any? = null,
|
): NiceResponse {
|
||||||
// auth: Authorization? = null,
|
sessionCookies.putAll(cookies)
|
||||||
// cookies: Map<String, String>? = null,
|
val res =
|
||||||
// timeout: Double = DEFAULT_TIMEOUT,
|
app.post(
|
||||||
// allowRedirects: Boolean? = null,
|
url,
|
||||||
// stream: Boolean = false,
|
headers,
|
||||||
// files: List<FileLike> = listOf(),
|
cookies = sessionCookies,
|
||||||
// ): Response {
|
)
|
||||||
// val res =
|
|
||||||
// khttp.get(
|
sessionCookies.putAll(res.headers.filter { it.first.lowercase() == "set-cookie" })
|
||||||
// url,
|
return res
|
||||||
// headers,
|
}
|
||||||
// params,
|
}
|
||||||
// data,
|
|
||||||
// json,
|
|
||||||
// auth,
|
|
||||||
// mergeCookies(sessionCookies, cookies),
|
|
||||||
// timeout,
|
|
||||||
// allowRedirects,
|
|
||||||
// stream,
|
|
||||||
// files
|
|
||||||
// )
|
|
||||||
// sessionCookies.putAll(res.cookies)
|
|
||||||
// sessionCookies.putAll(
|
|
||||||
// CookieJar(
|
|
||||||
// *res.headers
|
|
||||||
// .filter { it.key.toLowerCase() == "set-cookie" }
|
|
||||||
// .map { Cookie(it.value) }
|
|
||||||
// .toTypedArray()
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
// return res
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// fun post(
|
|
||||||
// url: String,
|
|
||||||
// headers: Map<String, String?> = mapOf(),
|
|
||||||
// params: Map<String, String> = mapOf(),
|
|
||||||
// data: Any? = null,
|
|
||||||
// json: Any? = null,
|
|
||||||
// auth: Authorization? = null,
|
|
||||||
// cookies: Map<String, String>? = null,
|
|
||||||
// timeout: Double = DEFAULT_TIMEOUT,
|
|
||||||
// allowRedirects: Boolean? = null,
|
|
||||||
// stream: Boolean = false,
|
|
||||||
// files: List<FileLike> = listOf()
|
|
||||||
// ): Response {
|
|
||||||
// val res =
|
|
||||||
// khttp.post(
|
|
||||||
// url,
|
|
||||||
// headers,
|
|
||||||
// params,
|
|
||||||
// data,
|
|
||||||
// json,
|
|
||||||
// auth,
|
|
||||||
// mergeCookies(sessionCookies, cookies),
|
|
||||||
// timeout,
|
|
||||||
// allowRedirects,
|
|
||||||
// stream,
|
|
||||||
// files
|
|
||||||
// )
|
|
||||||
// sessionCookies.putAll(res.cookies)
|
|
||||||
// sessionCookies.putAll(
|
|
||||||
// CookieJar(
|
|
||||||
// *res.headers
|
|
||||||
// .filter { it.key.toLowerCase() == "set-cookie" }
|
|
||||||
// .map { Cookie(it.value) }
|
|
||||||
// .toTypedArray()
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
// return res
|
|
||||||
// }
|
|
||||||
//}
|
|
|
@ -1,14 +1,13 @@
|
||||||
package com.lagradost
|
package com.lagradost
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature
|
|
||||||
import com.fasterxml.jackson.databind.json.JsonMapper
|
|
||||||
import com.fasterxml.jackson.module.kotlin.KotlinModule
|
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.utils.*
|
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||||
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
import com.lagradost.nicehttp.NiceResponse
|
import com.lagradost.nicehttp.NiceResponse
|
||||||
import com.lagradost.nicehttp.Session
|
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -26,7 +25,7 @@ class KrunchyGeoBypasser {
|
||||||
"User-Agent" to "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36".toAscii()
|
"User-Agent" to "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36".toAscii()
|
||||||
)
|
)
|
||||||
var sessionId: String? = null
|
var sessionId: String? = null
|
||||||
val session = Session(app.baseClient)
|
val session = HttpSession()
|
||||||
}
|
}
|
||||||
|
|
||||||
data class KrunchySession(
|
data class KrunchySession(
|
||||||
|
@ -68,8 +67,6 @@ class KrunchyProvider : MainAPI() {
|
||||||
companion object {
|
companion object {
|
||||||
val crUnblock = KrunchyGeoBypasser()
|
val crUnblock = KrunchyGeoBypasser()
|
||||||
val episodeNumRegex = Regex("""Episode (\d+)""")
|
val episodeNumRegex = Regex("""Episode (\d+)""")
|
||||||
val mapper: JsonMapper = JsonMapper.builder().addModule(KotlinModule())
|
|
||||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).build()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override var mainUrl = "http://www.crunchyroll.com"
|
override var mainUrl = "http://www.crunchyroll.com"
|
||||||
|
|
Loading…
Reference in New Issue