Merge remote-tracking branch 'origin/master'

This commit is contained in:
LagradOst 2021-09-02 15:19:57 +02:00
commit 57811c0bf5
3 changed files with 79 additions and 3 deletions

View file

@ -157,7 +157,7 @@ class AsiaFlixProvider : MainAPI() {
name, name,
name, name,
it, it,
"https://asianload.me/", "https://asianload1.com/", /** <------ This provider should be added instead */
getQualityFromName(it), getQualityFromName(it),
it.endsWith(".m3u8") it.endsWith(".m3u8")
) )

View file

@ -0,0 +1,76 @@
package com.lagradost.cloudstream3.utils
import khttp.structures.authorization.Authorization
import khttp.structures.cookie.CookieJar
import khttp.structures.files.FileLike
import khttp.structures.cookie.Cookie
import khttp.responses.Response
/**
* An HTTP session manager.
*
* This class simply keeps cookies across requests.
*
* @property sessionCookies A cookie jar.
*/
class HttpSession {
companion object {
const val DEFAULT_TIMEOUT = 30.0
fun mergeCookies(cookie1: CookieJar, cookie2: Map<String, String>?): Map<String, String> {
val a = cookie1
if (!cookie2.isNullOrEmpty()) {
a.putAll(cookie2)
}
return a
}
}
public val sessionCookies = CookieJar()
fun get(
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.get(
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
}
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
}
}

View file

@ -115,8 +115,8 @@
<string name="player_subtitles_settings_des">Afspeler ondertiteling instellingen</string> <string name="player_subtitles_settings_des">Afspeler ondertiteling instellingen</string>
<string name="eigengraumode_setthings">Eigengrau modus</string> <string name="eigengraumode_setthings">Eigengrau modus</string>
<string name="eigengraumode_setthings_des">Voegt de snelheid optie toe in de speler</string> <string name="eigengraumode_setthings_des">Voegt de snelheid optie toe in de speler</string>
<string name="wipe_to_seek_setthings">Veeg om te zoeken</string> <string name="swipe_to_seek_setthings">Veeg om te zoeken</string>
<string name="wipe_to_seek_setthings_des">Veeg naar links of rechts om de tijd in de videoplayer te regelen</string> <string name="swipe_to_seek_setthings_des">Veeg naar links of rechts om de tijd in de videoplayer te regelen</string>
<string name="swipe_to_change_settings">wissen om instellingen te wijzigen</string> <string name="swipe_to_change_settings">wissen om instellingen te wijzigen</string>
<string name="swipe_to_change_settings_des">Veeg aan de linker- of rechterkant om de helderheid of het volume te wijzigen</string> <string name="swipe_to_change_settings_des">Veeg aan de linker- of rechterkant om de helderheid of het volume te wijzigen</string>
<string name="double_tap_to_seek_setthings">Dubbeltik om te zoeken</string> <string name="double_tap_to_seek_setthings">Dubbeltik om te zoeken</string>