mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
cookie fix aka Tenshi fix
This commit is contained in:
parent
99717ef1f1
commit
f9e3e5a2bf
4 changed files with 11 additions and 9 deletions
|
@ -42,12 +42,12 @@ object APIHolder {
|
|||
WatchCartoonOnlineProvider(),
|
||||
AllMoviesForYouProvider(),
|
||||
AsiaFlixProvider(),
|
||||
TrailersToProvider(), // be aware that this is fuckery
|
||||
VidEmbedProvider(),
|
||||
VfFilm()
|
||||
VfFilmProvider()
|
||||
)
|
||||
|
||||
val restrictedApis = arrayListOf(
|
||||
TrailersToProvider(), // be aware that this is fuckery
|
||||
//NyaaProvider(), //torrents in cs3 is wack
|
||||
ThenosProvider(),
|
||||
)
|
||||
|
|
|
@ -212,6 +212,7 @@ class TenshiProvider : MainAPI() {
|
|||
val url = "$mainUrl/anime"
|
||||
var response = get(url, params = mapOf("q" to query), cookies = mapOf("loop-view" to "thumb")).text
|
||||
var document = Jsoup.parse(response)
|
||||
|
||||
val returnValue = parseSearchPage(document)
|
||||
|
||||
while (!document.select("""a.page-link[rel="next"]""").isEmpty()) {
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
package com.lagradost.cloudstream3.movieproviders
|
||||
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.post
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.network.url
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
import okio.Buffer
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
// referer = https://vf-film.org, USERAGENT ALSO REQUIRED
|
||||
class VfFilm : MainAPI() {
|
||||
class VfFilmProvider : MainAPI() {
|
||||
override val mainUrl: String
|
||||
get() = "https://vf-film.org"
|
||||
override val name: String
|
|
@ -3,7 +3,6 @@ package com.lagradost.cloudstream3.network
|
|||
import com.lagradost.cloudstream3.USER_AGENT
|
||||
import okhttp3.*
|
||||
import okhttp3.Headers.Companion.toHeaders
|
||||
import okio.Buffer
|
||||
import java.net.URI
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
@ -73,7 +72,12 @@ fun getCache(cacheTime: Int, cacheUnit: TimeUnit): CacheControl {
|
|||
*/
|
||||
fun getHeaders(headers: Map<String, String>, referer: String?, cookie: Map<String, String>): Headers {
|
||||
val refererMap = (referer ?: DEFAULT_REFERER)?.let { mapOf("referer" to it) } ?: mapOf()
|
||||
return (DEFAULT_COOKIES + DEFAULT_HEADERS + cookie + headers + refererMap).toHeaders()
|
||||
val cookieHeaders = (DEFAULT_COOKIES + cookie)
|
||||
val cookieMap = if(cookieHeaders.isNotEmpty()) mapOf("Cookie" to cookieHeaders.entries.joinToString(separator = "; ") {
|
||||
"${it.key}=${it.value};"
|
||||
}) else mapOf()
|
||||
val tempHeaders = (DEFAULT_HEADERS + cookieMap + headers + refererMap)
|
||||
return tempHeaders.toHeaders()
|
||||
}
|
||||
|
||||
fun get(
|
||||
|
@ -92,6 +96,7 @@ fun get(
|
|||
.followSslRedirects(allowRedirects)
|
||||
.callTimeout(timeout, TimeUnit.SECONDS)
|
||||
.build()
|
||||
println("cookie2: " + cookies)
|
||||
val request = getRequestCreator(url, headers, referer, params, cookies, cacheTime, cacheUnit)
|
||||
return client.newCall(request).execute()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue