forked from recloudstream/cloudstream
Made the requests nicer and added sessions
This commit is contained in:
parent
1d1485a4ed
commit
a50cb9a08d
49 changed files with 434 additions and 423 deletions
|
@ -5,7 +5,6 @@ import android.content.Context
|
|||
import android.widget.Toast
|
||||
import com.google.auto.service.AutoService
|
||||
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
||||
import com.lagradost.cloudstream3.network.post
|
||||
import com.lagradost.cloudstream3.utils.Coroutines.runOnMainThread
|
||||
import org.acra.ReportField
|
||||
import org.acra.config.CoreConfiguration
|
||||
|
@ -29,7 +28,7 @@ class CustomReportSender : ReportSender {
|
|||
|
||||
thread { // to not run it on main thread
|
||||
normalSafeApiCall {
|
||||
val post = post(url, data = data)
|
||||
val post = app.post(url, data = data)
|
||||
println("Report response: $post")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.lagradost.cloudstream3.APIHolder.apis
|
|||
import com.lagradost.cloudstream3.APIHolder.getApiDubstatusSettings
|
||||
import com.lagradost.cloudstream3.APIHolder.restrictedApis
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.network.initRequestClient
|
||||
import com.lagradost.cloudstream3.network.Requests
|
||||
import com.lagradost.cloudstream3.receivers.VideoDownloadRestartReceiver
|
||||
import com.lagradost.cloudstream3.syncproviders.OAuth2API.Companion.OAuth2Apis
|
||||
import com.lagradost.cloudstream3.syncproviders.OAuth2API.Companion.OAuth2accountApis
|
||||
|
@ -71,6 +71,9 @@ const val VLC_FROM_PROGRESS = -2
|
|||
const val VLC_EXTRA_POSITION_OUT = "extra_position"
|
||||
const val VLC_EXTRA_DURATION_OUT = "extra_duration"
|
||||
const val VLC_LAST_ID_KEY = "vlc_last_open_id"
|
||||
// Short name for requests client to make it nicer to use
|
||||
var app = Requests()
|
||||
|
||||
|
||||
class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||
override fun onColorSelected(dialogId: Int, color: Int) {
|
||||
|
@ -509,7 +512,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
) // THEME IS SET BEFORE VIEW IS CREATED TO APPLY THE THEME TO THE MAIN VIEW
|
||||
|
||||
updateLocale()
|
||||
initRequestClient()
|
||||
app.initClient(this)
|
||||
super.onCreate(savedInstanceState)
|
||||
try {
|
||||
if (isCastApiAvailable()) {
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.lagradost.cloudstream3.animeproviders
|
|||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||
|
@ -95,9 +94,9 @@ class AllAnimeProvider : MainAPI() {
|
|||
override fun search(query: String): ArrayList<SearchResponse> {
|
||||
val link =
|
||||
"""$mainUrl/graphql?variables=%7B%22search%22%3A%7B%22allowAdult%22%3Afalse%2C%22query%22%3A%22$query%22%7D%2C%22limit%22%3A26%2C%22page%22%3A1%2C%22translationType%22%3A%22sub%22%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%229343797cc3d9e3f444e2d3b7db9a84d759b816a4d84512ea72d079f85bb96e98%22%7D%7D"""
|
||||
var res = get(link).text
|
||||
var res = app.get(link).text
|
||||
if (res.contains("PERSISTED_QUERY_NOT_FOUND")) {
|
||||
res = get(link).text
|
||||
res = app.get(link).text
|
||||
if (res.contains("PERSISTED_QUERY_NOT_FOUND")) return ArrayList()
|
||||
}
|
||||
val response = mapper.readValue<AllAnimeQuery>(res)
|
||||
|
@ -136,7 +135,7 @@ class AllAnimeProvider : MainAPI() {
|
|||
rhino.optimizationLevel = -1
|
||||
val scope: Scriptable = rhino.initStandardObjects()
|
||||
|
||||
val html = get(url).text
|
||||
val html = app.get(url).text
|
||||
val soup = Jsoup.parse(html)
|
||||
|
||||
val script = soup.select("script").firstOrNull {
|
||||
|
@ -251,10 +250,10 @@ class AllAnimeProvider : MainAPI() {
|
|||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
var apiEndPoint = mapper.readValue<ApiEndPoint>(get("$mainUrl/getVersion").text).episodeIframeHead
|
||||
var apiEndPoint = mapper.readValue<ApiEndPoint>(app.get("$mainUrl/getVersion").text).episodeIframeHead
|
||||
if (apiEndPoint.endsWith("/")) apiEndPoint = apiEndPoint.slice(0 until apiEndPoint.length - 1)
|
||||
|
||||
val html = get(data).text
|
||||
val html = app.get(data).text
|
||||
|
||||
val sources = Regex("""sourceUrl[:=]"(.+?)"""").findAll(html).toList()
|
||||
.map { URLDecoder.decode(it.destructured.component1().sanitize(), "UTF-8") }
|
||||
|
@ -283,7 +282,7 @@ class AllAnimeProvider : MainAPI() {
|
|||
}
|
||||
} else {
|
||||
link = apiEndPoint + URI(link).path + ".json?" + URI(link).query
|
||||
val response = get(link)
|
||||
val response = app.get(link)
|
||||
|
||||
if (response.code < 400) {
|
||||
val links = mapper.readValue<AllAnimeVideoApiResponse>(response.text).links
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.lagradost.cloudstream3.animeproviders
|
||||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
|
@ -37,7 +36,7 @@ class AnimeFlickProvider : MainAPI() {
|
|||
|
||||
override fun search(query: String): ArrayList<SearchResponse> {
|
||||
val link = "https://animeflick.net/search.php?search=$query"
|
||||
val html = get(link).text
|
||||
val html = app.get(link).text
|
||||
val doc = Jsoup.parse(html)
|
||||
|
||||
return ArrayList(doc.select(".row.mt-2").map {
|
||||
|
@ -57,7 +56,7 @@ class AnimeFlickProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override fun load(url: String): LoadResponse {
|
||||
val html = get(url).text
|
||||
val html = app.get(url).text
|
||||
val doc = Jsoup.parse(html)
|
||||
|
||||
val poster = mainUrl + doc.selectFirst("img.rounded").attr("src")
|
||||
|
@ -93,7 +92,7 @@ class AnimeFlickProvider : MainAPI() {
|
|||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
val html = get(data).text
|
||||
val html = app.get(data).text
|
||||
|
||||
val episodeRegex = Regex("""(https://.*?\.mp4)""")
|
||||
val links = episodeRegex.findAll(html).map {
|
||||
|
|
|
@ -27,7 +27,7 @@ class AnimePaheProvider : MainAPI() {
|
|||
fun generateSession(): Boolean {
|
||||
if (cookies.isNotEmpty()) return true
|
||||
return try {
|
||||
val response = get("$MAIN_URL/")
|
||||
val response = app.get("$MAIN_URL/")
|
||||
cookies = response.cookies
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
|
@ -84,7 +84,7 @@ class AnimePaheProvider : MainAPI() {
|
|||
val items = ArrayList<HomePageList>()
|
||||
for (i in urls) {
|
||||
try {
|
||||
val response = get(i.first).text
|
||||
val response = app.get(i.first).text
|
||||
val episodes = mapper.readValue<AnimePaheLatestReleases>(response).data.map {
|
||||
|
||||
AnimeSearchResponse(
|
||||
|
@ -134,7 +134,7 @@ class AnimePaheProvider : MainAPI() {
|
|||
val url = "$mainUrl/api?m=search&l=8&q=$title"
|
||||
val headers = mapOf("referer" to "$mainUrl/")
|
||||
|
||||
val req = get(url, headers = headers).text
|
||||
val req = app.get(url, headers = headers).text
|
||||
val data = req.let { mapper.readValue<AnimePaheSearch>(it) }
|
||||
for (anime in data.data) {
|
||||
if (anime.id == animeId) {
|
||||
|
@ -149,7 +149,7 @@ class AnimePaheProvider : MainAPI() {
|
|||
val url = "$mainUrl/api?m=search&l=8&q=$query"
|
||||
val headers = mapOf("referer" to "$mainUrl/")
|
||||
|
||||
val req = get(url, headers = headers).text
|
||||
val req = app.get(url, headers = headers).text
|
||||
val data = req.let { mapper.readValue<AnimePaheSearch>(it) }
|
||||
|
||||
return ArrayList(data.data.map {
|
||||
|
@ -200,7 +200,7 @@ class AnimePaheProvider : MainAPI() {
|
|||
val uri = "$mainUrl/api?m=release&id=$id&sort=episode_asc&page=1"
|
||||
val headers = mapOf("referer" to "$mainUrl/")
|
||||
|
||||
val req = get(uri, headers = headers).text
|
||||
val req = app.get(uri, headers = headers).text
|
||||
val data = req.let { mapper.readValue<AnimePaheAnimeData>(it) }
|
||||
|
||||
val lastPage = data.lastPage
|
||||
|
@ -255,7 +255,7 @@ class AnimePaheProvider : MainAPI() {
|
|||
val (animeId, animeTitle) = regex.find(url)!!.destructured
|
||||
val link = getAnimeByIdAndTitle(animeTitle, animeId.toInt())!!
|
||||
|
||||
val html = get(link).text
|
||||
val html = app.get(link).text
|
||||
val doc = Jsoup.parse(html)
|
||||
|
||||
val japTitle = doc.selectFirst("h2.japanese")?.text()
|
||||
|
@ -270,14 +270,16 @@ class AnimePaheProvider : MainAPI() {
|
|||
}
|
||||
|
||||
val episodes = generateListOfEpisodes(url)
|
||||
val year = """<strong>Aired:</strong>[^,]*, (\d+)""".toRegex().find(html)!!.destructured.component1()
|
||||
val year = """<strong>Aired:</strong>[^,]*, (\d+)""".toRegex()
|
||||
.find(html)!!.destructured.component1()
|
||||
.toIntOrNull()
|
||||
val status = when ("""<strong>Status:</strong>[^a]*a href=["']/anime/(.*?)["']""".toRegex()
|
||||
.find(html)!!.destructured.component1()) {
|
||||
"airing" -> ShowStatus.Ongoing
|
||||
"completed" -> ShowStatus.Completed
|
||||
else -> null
|
||||
}
|
||||
val status =
|
||||
when ("""<strong>Status:</strong>[^a]*a href=["']/anime/(.*?)["']""".toRegex()
|
||||
.find(html)!!.destructured.component1()) {
|
||||
"airing" -> ShowStatus.Ongoing
|
||||
"completed" -> ShowStatus.Completed
|
||||
else -> null
|
||||
}
|
||||
val synopsis = doc.selectFirst(".anime-synopsis").text()
|
||||
|
||||
var anilistId: Int? = null
|
||||
|
@ -446,12 +448,12 @@ class AnimePaheProvider : MainAPI() {
|
|||
}
|
||||
|
||||
var responseCode = 302
|
||||
var adflyContent: Response? = null
|
||||
var adflyContent: AppResponse? = null
|
||||
var tries = 0
|
||||
|
||||
while (responseCode != 200 && tries < 20) {
|
||||
adflyContent = get(
|
||||
get(adflyUri, cookies = cookies, allowRedirects = false).url,
|
||||
adflyContent = app.get(
|
||||
app.get(adflyUri, cookies = cookies, allowRedirects = false).url,
|
||||
cookies = cookies,
|
||||
allowRedirects = false
|
||||
)
|
||||
|
@ -467,20 +469,24 @@ class AnimePaheProvider : MainAPI() {
|
|||
|
||||
private fun getStreamUrlFromKwik(adflyUri: String): String {
|
||||
val fContent =
|
||||
get(bypassAdfly(adflyUri), headers = mapOf("referer" to "https://kwik.cx/"), cookies = cookies)
|
||||
app.get(
|
||||
bypassAdfly(adflyUri),
|
||||
headers = mapOf("referer" to "https://kwik.cx/"),
|
||||
cookies = cookies
|
||||
)
|
||||
cookies = cookies + fContent.cookies
|
||||
|
||||
val (fullString, key, v1, v2) = KWIK_PARAMS_RE.find(fContent.text)!!.destructured
|
||||
val decrypted = decrypt(fullString, key, v1.toInt(), v2.toInt())
|
||||
val uri = KWIK_D_URL.find(decrypted)!!.destructured.component1()
|
||||
val tok = KWIK_D_TOKEN.find(decrypted)!!.destructured.component1()
|
||||
var content: Response? = null
|
||||
var content: AppResponse? = null
|
||||
|
||||
var code = 419
|
||||
var tries = 0
|
||||
|
||||
while (code != 302 && tries < 20) {
|
||||
content = post(
|
||||
content = app.post(
|
||||
uri,
|
||||
allowRedirects = false,
|
||||
data = mapOf("_token" to tok),
|
||||
|
@ -508,7 +514,7 @@ class AnimePaheProvider : MainAPI() {
|
|||
link = link.replace(regex, "")
|
||||
|
||||
|
||||
val req = get(link, headers = headers).text
|
||||
val req = app.get(link, headers = headers).text
|
||||
val jsonResponse = req.let { mapper.readValue<AnimePaheAnimeData>(it) }
|
||||
val ep = ((jsonResponse.data.map {
|
||||
if (it.episode == episodeNum) {
|
||||
|
@ -519,7 +525,7 @@ class AnimePaheProvider : MainAPI() {
|
|||
}).filterNotNull())[0]
|
||||
link = "$mainUrl/api?m=links&id=${ep.animeId}&session=${ep.session}&p=kwik"
|
||||
}
|
||||
val req = get(link, headers = headers).text
|
||||
val req = app.get(link, headers = headers).text
|
||||
val data = mapper.readValue<AnimePaheEpisodeLoadLinks>(req)
|
||||
|
||||
val qualities = ArrayList<ExtractorLink>()
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.fasterxml.jackson.module.kotlin.readValue
|
|||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.APIHolder.unixTime
|
||||
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||
|
@ -62,7 +61,7 @@ class DubbedAnimeProvider : MainAPI() {
|
|||
)
|
||||
|
||||
private fun parseDocumentTrending(url: String): List<SearchResponse> {
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
return document.select("li > a").map {
|
||||
val href = fixUrl(it.attr("href"))
|
||||
|
@ -81,7 +80,7 @@ class DubbedAnimeProvider : MainAPI() {
|
|||
}
|
||||
|
||||
private fun parseDocument(url: String, trimEpisode: Boolean = false): List<SearchResponse> {
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
return document.select("a.grid__link").map {
|
||||
val href = fixUrl(it.attr("href"))
|
||||
|
@ -119,7 +118,7 @@ class DubbedAnimeProvider : MainAPI() {
|
|||
private fun getAnimeEpisode(slug: String, isMovie: Boolean): EpisodeInfo {
|
||||
val url =
|
||||
mainUrl + (if (isMovie) "/movies/jsonMovie" else "/xz/v3/jsonEpi") + ".php?slug=$slug&_=$unixTime"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val mapped = mapper.readValue<QueryEpisodeResultRoot>(response)
|
||||
return mapped.result.anime.first()
|
||||
}
|
||||
|
@ -135,7 +134,7 @@ class DubbedAnimeProvider : MainAPI() {
|
|||
|
||||
override fun quickSearch(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/xz/searchgrid.php?p=1&limit=12&s=$query&_=$unixTime"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val items = document.select("div.grid__item > a")
|
||||
if (items.isEmpty()) return ArrayList()
|
||||
|
@ -167,7 +166,7 @@ class DubbedAnimeProvider : MainAPI() {
|
|||
|
||||
override fun search(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/search/$query"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val items = document.select("div.resultinner > a.resulta")
|
||||
if (items.isEmpty()) return ArrayList()
|
||||
|
@ -216,7 +215,7 @@ class DubbedAnimeProvider : MainAPI() {
|
|||
}.toList())
|
||||
for (hl in hls) {
|
||||
try {
|
||||
val sources = get("$mainUrl/xz/api/playeri.php?url=$hl&_=$unixTime").text
|
||||
val sources = app.get("$mainUrl/xz/api/playeri.php?url=$hl&_=$unixTime").text
|
||||
val find = "src=\"(.*?)\".*?label=\"(.*?)\"".toRegex().find(sources)
|
||||
if (find != null) {
|
||||
val quality = find.groupValues[2]
|
||||
|
@ -254,12 +253,13 @@ class DubbedAnimeProvider : MainAPI() {
|
|||
null
|
||||
)
|
||||
} else {
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val title = document.selectFirst("h4").text()
|
||||
val descriptHeader = document.selectFirst("div.animeDescript")
|
||||
val descript = descriptHeader.selectFirst("> p").text()
|
||||
val year = descriptHeader.selectFirst("> div.distatsx > div.sroverd").text().replace("Released: ", "")
|
||||
val year = descriptHeader.selectFirst("> div.distatsx > div.sroverd").text()
|
||||
.replace("Released: ", "")
|
||||
.toIntOrNull()
|
||||
|
||||
val episodes = document.select("a.epibloks").map {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.lagradost.cloudstream3.animeproviders
|
||||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.network.url
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
|
@ -72,12 +71,12 @@ class GogoanimeProvider : MainAPI() {
|
|||
for (i in urls) {
|
||||
try {
|
||||
val params = mapOf("page" to "1", "type" to i.first)
|
||||
val html = get(
|
||||
val html = app.get(
|
||||
"https://ajax.gogo-load.com/ajax/page-recent-release.html",
|
||||
headers = headers,
|
||||
params = params
|
||||
).text
|
||||
items.add(HomePageList(i.second, (parseRegex.findAll(html).map {
|
||||
)
|
||||
items.add(HomePageList(i.second, (parseRegex.findAll(html.text).map {
|
||||
val (link, epNum, title, poster) = it.destructured
|
||||
val isSub = listOf(1, 3).contains(i.first.toInt())
|
||||
AnimeSearchResponse(
|
||||
|
@ -105,7 +104,7 @@ class GogoanimeProvider : MainAPI() {
|
|||
|
||||
override fun search(query: String): ArrayList<SearchResponse> {
|
||||
val link = "$mainUrl/search.html?keyword=$query"
|
||||
val html = get(link).text
|
||||
val html = app.get(link).text
|
||||
val doc = Jsoup.parse(html)
|
||||
|
||||
val episodes = doc.select(""".last_episodes li""").map {
|
||||
|
@ -137,7 +136,7 @@ class GogoanimeProvider : MainAPI() {
|
|||
override fun load(url: String): LoadResponse {
|
||||
val link = getProperAnimeLink(url)
|
||||
val episodeloadApi = "https://ajax.gogo-load.com/ajax/load-list-episode"
|
||||
val html = get(link).text
|
||||
val html = app.get(link).text
|
||||
val doc = Jsoup.parse(html)
|
||||
|
||||
val animeBody = doc.selectFirst(".anime_info_body_bg")
|
||||
|
@ -177,7 +176,7 @@ class GogoanimeProvider : MainAPI() {
|
|||
|
||||
val animeId = doc.selectFirst("#movie_id").attr("value")
|
||||
val params = mapOf("ep_start" to "0", "ep_end" to "2000", "id" to animeId)
|
||||
val responseHTML = get(episodeloadApi, params = params).text
|
||||
val responseHTML = app.get(episodeloadApi, params = params).text
|
||||
val epiDoc = Jsoup.parse(responseHTML)
|
||||
val episodes = epiDoc.select("a").map {
|
||||
AnimeEpisode(
|
||||
|
@ -200,13 +199,13 @@ class GogoanimeProvider : MainAPI() {
|
|||
}
|
||||
|
||||
private fun extractVideos(uri: String): List<ExtractorLink> {
|
||||
val html = get(uri).text
|
||||
val html = app.get(uri).text
|
||||
val doc = Jsoup.parse(html)
|
||||
|
||||
val iframe = "https:" + doc.selectFirst("div.play-video > iframe").attr("src")
|
||||
val link = iframe.replace("streaming.php", "download")
|
||||
|
||||
val page = get(link, headers = mapOf("Referer" to iframe))
|
||||
val page = app.get(link, headers = mapOf("Referer" to iframe))
|
||||
val pageDoc = Jsoup.parse(page.text)
|
||||
|
||||
return pageDoc.select(".dowload > a").pmap {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.lagradost.cloudstream3.animeproviders
|
||||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||
|
@ -24,7 +23,7 @@ class KawaiifuProvider : MainAPI() {
|
|||
|
||||
override fun getMainPage(): HomePageResponse {
|
||||
val items = ArrayList<HomePageList>()
|
||||
val resp = get(mainUrl).text
|
||||
val resp = app.get(mainUrl).text
|
||||
|
||||
val soup = Jsoup.parse(resp)
|
||||
|
||||
|
@ -68,7 +67,7 @@ class KawaiifuProvider : MainAPI() {
|
|||
|
||||
override fun search(query: String): ArrayList<SearchResponse> {
|
||||
val link = "$mainUrl/search-movie?keyword=${query}"
|
||||
val html = get(link).text
|
||||
val html = app.get(link).text
|
||||
val soup = Jsoup.parse(html)
|
||||
|
||||
return ArrayList(soup.select(".item").map {
|
||||
|
@ -89,7 +88,7 @@ class KawaiifuProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override fun load(url: String): LoadResponse {
|
||||
val html = get(url).text
|
||||
val html = app.get(url).text
|
||||
val soup = Jsoup.parse(html)
|
||||
|
||||
val title = soup.selectFirst(".title").text()
|
||||
|
@ -98,7 +97,7 @@ class KawaiifuProvider : MainAPI() {
|
|||
.filter { it.select("strong").isEmpty() && it.select("iframe").isEmpty() }.joinToString("\n") { it.text() }
|
||||
val year = url.split("/").filter { it.contains("-") }[0].split("-")[1].toIntOrNull()
|
||||
val episodes = Jsoup.parse(
|
||||
get(
|
||||
app.get(
|
||||
soup.selectFirst("a[href*=\".html-episode\"]").attr("href")
|
||||
).text
|
||||
).selectFirst(".list-ep").select("li").map {
|
||||
|
@ -124,7 +123,7 @@ class KawaiifuProvider : MainAPI() {
|
|||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
val htmlSource = get(data).text
|
||||
val htmlSource = app.get(data).text
|
||||
val soupa = Jsoup.parse(htmlSource)
|
||||
|
||||
val episodeNum = if (data.contains("ep=")) data.split("ep=")[1].split("&")[0].toIntOrNull() else null
|
||||
|
@ -144,7 +143,7 @@ class KawaiifuProvider : MainAPI() {
|
|||
.map { source -> Pair(source.attr("src"), source.attr("data-quality")) }
|
||||
Triple(it.first, sources, it.second.second)
|
||||
} else {
|
||||
val html = get(it.second.first).text
|
||||
val html = app.get(it.second.first).text
|
||||
val soup = Jsoup.parse(html)
|
||||
|
||||
val sources = soup.select("video > source")
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.annotation.SuppressLint
|
|||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||
|
@ -52,7 +51,7 @@ class TenshiProvider : MainAPI() {
|
|||
|
||||
override fun getMainPage(): HomePageResponse {
|
||||
val items = ArrayList<HomePageList>()
|
||||
val soup = Jsoup.parse(get(mainUrl).text)
|
||||
val soup = Jsoup.parse(app.get(mainUrl).text)
|
||||
for (section in soup.select("#content > section")) {
|
||||
try {
|
||||
if (section.attr("id") == "toplist-tabs") {
|
||||
|
@ -200,7 +199,7 @@ class TenshiProvider : MainAPI() {
|
|||
|
||||
override fun search(query: String): ArrayList<SearchResponse> {
|
||||
val url = "$mainUrl/anime"
|
||||
var response = get(url, params = mapOf("q" to query), cookies = mapOf("loop-view" to "thumb")).text
|
||||
var response = app.get(url, params = mapOf("q" to query), cookies = mapOf("loop-view" to "thumb")).text
|
||||
var document = Jsoup.parse(response)
|
||||
|
||||
val returnValue = parseSearchPage(document)
|
||||
|
@ -208,7 +207,7 @@ class TenshiProvider : MainAPI() {
|
|||
while (!document.select("""a.page-link[rel="next"]""").isEmpty()) {
|
||||
val link = document.select("""a.page-link[rel="next"]""")
|
||||
if (link != null && !link.isEmpty()) {
|
||||
response = get(link[0].attr("href"), cookies = mapOf("loop-view" to "thumb")).text
|
||||
response = app.get(link[0].attr("href"), cookies = mapOf("loop-view" to "thumb")).text
|
||||
document = Jsoup.parse(response)
|
||||
returnValue.addAll(parseSearchPage(document))
|
||||
} else {
|
||||
|
@ -220,7 +219,7 @@ class TenshiProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override fun load(url: String): LoadResponse {
|
||||
var response = get(url, cookies = mapOf("loop-view" to "thumb")).text
|
||||
var response = app.get(url, cookies = mapOf("loop-view" to "thumb")).text
|
||||
var document = Jsoup.parse(response)
|
||||
|
||||
val englishTitle = document.selectFirst("span.value > span[title=\"English\"]")?.parent()?.text()?.trim()
|
||||
|
@ -234,7 +233,7 @@ class TenshiProvider : MainAPI() {
|
|||
|
||||
if (totalEpisodePages != null && totalEpisodePages > 1) {
|
||||
for (pageNum in 2..totalEpisodePages) {
|
||||
response = get("$url?page=$pageNum", cookies = mapOf("loop-view" to "thumb")).text
|
||||
response = app.get("$url?page=$pageNum", cookies = mapOf("loop-view" to "thumb")).text
|
||||
document = Jsoup.parse(response)
|
||||
episodeNodes.addAll(document.select("li[class*=\"episode\"] > a"))
|
||||
}
|
||||
|
@ -290,7 +289,7 @@ class TenshiProvider : MainAPI() {
|
|||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
val response = get(data).text
|
||||
val response = app.get(data).text
|
||||
val soup = Jsoup.parse(response)
|
||||
|
||||
data class Quality(
|
||||
|
@ -301,7 +300,7 @@ class TenshiProvider : MainAPI() {
|
|||
val sources = ArrayList<ExtractorLink>()
|
||||
for (source in soup.select("""[aria-labelledby="mirror-dropdown"] > li > a.dropdown-item""")) {
|
||||
val release = source.text().replace("/", "").trim()
|
||||
val sourceHTML = get(
|
||||
val sourceHTML = app.get(
|
||||
"https://tenshi.moe/embed?v=${source.attr("href").split("v=")[1].split("&")[0]}",
|
||||
headers = mapOf("Referer" to data)
|
||||
).text
|
||||
|
|
|
@ -3,8 +3,6 @@ package com.lagradost.cloudstream3.animeproviders
|
|||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
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.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
|
@ -32,7 +30,7 @@ class WatchCartoonOnlineProvider : MainAPI() {
|
|||
val url = "https://www.wcostream.com/search"
|
||||
|
||||
var response =
|
||||
post(
|
||||
app.post(
|
||||
url,
|
||||
headers = mapOf("Referer" to url),
|
||||
data = mapOf("catara" to query, "konuara" to "series")
|
||||
|
@ -71,7 +69,7 @@ class WatchCartoonOnlineProvider : MainAPI() {
|
|||
|
||||
// "episodes-search", is used for finding movies, anime episodes should be filtered out
|
||||
response =
|
||||
post(
|
||||
app.post(
|
||||
url,
|
||||
headers = mapOf("Referer" to url),
|
||||
data = mapOf("catara" to query, "konuara" to "episodes")
|
||||
|
@ -105,7 +103,7 @@ class WatchCartoonOnlineProvider : MainAPI() {
|
|||
|
||||
override fun load(url: String): LoadResponse {
|
||||
val isMovie = !url.contains("/anime/")
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
|
||||
return if (!isMovie) {
|
||||
|
@ -195,7 +193,7 @@ class WatchCartoonOnlineProvider : MainAPI() {
|
|||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
val response = get(data).text
|
||||
val response = app.get(data).text
|
||||
/*val embedUrl = fixUrl(
|
||||
Regex("itemprop=\"embedURL\" content=\"(.*?)\"").find(response.text)?.groupValues?.get(1) ?: return false
|
||||
)*/
|
||||
|
@ -223,7 +221,7 @@ class WatchCartoonOnlineProvider : MainAPI() {
|
|||
val jsEval = scope.get("returnValue", scope) ?: return false
|
||||
val src = fixUrl(Regex("src=\"(.*?)\"").find(jsEval as String)?.groupValues?.get(1) ?: return false)
|
||||
|
||||
val embedResponse = get(
|
||||
val embedResponse = app.get(
|
||||
(src),
|
||||
headers = mapOf("Referer" to data)
|
||||
)
|
||||
|
@ -231,7 +229,7 @@ class WatchCartoonOnlineProvider : MainAPI() {
|
|||
val getVidLink = fixUrl(
|
||||
Regex("get\\(\"(.*?)\"").find(embedResponse.text)?.groupValues?.get(1) ?: return false
|
||||
)
|
||||
val linkResponse = get(
|
||||
val linkResponse = app.get(
|
||||
getVidLink, headers = mapOf(
|
||||
"sec-ch-ua" to "\"Chromium\";v=\"91\", \" Not;A Brand\";v=\"99\"",
|
||||
"sec-ch-ua-mobile" to "?0",
|
||||
|
|
|
@ -2,8 +2,6 @@ package com.lagradost.cloudstream3.animeproviders
|
|||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.extractors.WcoStream
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.post
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import org.json.JSONObject
|
||||
|
@ -48,7 +46,7 @@ class WcoProvider : MainAPI() {
|
|||
val items = ArrayList<HomePageList>()
|
||||
for (i in urls) {
|
||||
try {
|
||||
val response = JSONObject(get(
|
||||
val response = JSONObject(app.get(
|
||||
i.first,
|
||||
).text).getString("html") // I won't make a dataclass for this shit
|
||||
val document = Jsoup.parse(response)
|
||||
|
@ -117,14 +115,14 @@ class WcoProvider : MainAPI() {
|
|||
override fun search(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/search"
|
||||
val response =
|
||||
get(url, params = mapOf("keyword" to query))
|
||||
app.get(url, params = mapOf("keyword" to query))
|
||||
var document = Jsoup.parse(response.text)
|
||||
val returnValue = parseSearchPage(document)
|
||||
|
||||
while (!document.select(".pagination").isEmpty()) {
|
||||
val link = document.select("a.page-link[rel=\"next\"]")
|
||||
if (!link.isEmpty()) {
|
||||
val extraResponse = get(fixUrl(link[0].attr("href"))).text
|
||||
val extraResponse = app.get(fixUrl(link[0].attr("href"))).text
|
||||
document = Jsoup.parse(extraResponse)
|
||||
returnValue.addAll(parseSearchPage(document))
|
||||
} else {
|
||||
|
@ -137,7 +135,7 @@ class WcoProvider : MainAPI() {
|
|||
override fun quickSearch(query: String): List<SearchResponse> {
|
||||
val returnValue: ArrayList<SearchResponse> = ArrayList()
|
||||
|
||||
val response = JSONObject(post(
|
||||
val response = JSONObject(app.post(
|
||||
"https://wcostream.cc/ajax/search",
|
||||
data = mapOf("keyword" to query)
|
||||
).text).getString("html") // I won't make a dataclass for this shit
|
||||
|
@ -175,7 +173,7 @@ class WcoProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override fun load(url: String): LoadResponse {
|
||||
val response = get(url, timeout = 120).text
|
||||
val response = app.get(url, timeout = 120).text
|
||||
val document = Jsoup.parse(response)
|
||||
|
||||
val japaneseTitle = document.selectFirst("div.elements div.row > div:nth-child(1) > div.row-line:nth-child(1)")
|
||||
|
@ -226,7 +224,7 @@ class WcoProvider : MainAPI() {
|
|||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
val response = get(data).text
|
||||
val response = app.get(data).text
|
||||
val servers = Jsoup.parse(response).select("#servers-list > ul > li").map {
|
||||
mapOf(
|
||||
"link" to it?.selectFirst("a")?.attr("data-embed"),
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.lagradost.cloudstream3.movieproviders.SflixProvider
|
|||
import com.lagradost.cloudstream3.movieproviders.SflixProvider.Companion.toExtractorLink
|
||||
import com.lagradost.cloudstream3.movieproviders.SflixProvider.Companion.toSubtitleFile
|
||||
import com.lagradost.cloudstream3.network.WebViewResolver
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import org.jsoup.Jsoup
|
||||
|
@ -84,7 +83,7 @@ class ZoroProvider : MainAPI() {
|
|||
|
||||
|
||||
override fun getMainPage(): HomePageResponse {
|
||||
val html = get("$mainUrl/home").text
|
||||
val html = app.get("$mainUrl/home").text
|
||||
val document = Jsoup.parse(html)
|
||||
|
||||
val homePageList = ArrayList<HomePageList>()
|
||||
|
@ -142,7 +141,7 @@ class ZoroProvider : MainAPI() {
|
|||
|
||||
override fun search(query: String): List<SearchResponse> {
|
||||
val link = "$mainUrl/search?keyword=$query"
|
||||
val html = get(link).text
|
||||
val html = app.get(link).text
|
||||
val document = Jsoup.parse(html)
|
||||
|
||||
return document.select(".flw-item").map {
|
||||
|
@ -186,7 +185,7 @@ class ZoroProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override fun load(url: String): LoadResponse {
|
||||
val html = get(url).text
|
||||
val html = app.get(url).text
|
||||
val document = Jsoup.parse(html)
|
||||
|
||||
val title = document.selectFirst(".anisc-detail > .film-name")?.text().toString()
|
||||
|
@ -217,7 +216,7 @@ class ZoroProvider : MainAPI() {
|
|||
|
||||
val episodes = Jsoup.parse(
|
||||
mapper.readValue<Response>(
|
||||
get(
|
||||
app.get(
|
||||
"$mainUrl/ajax/v2/episode/list/$animeId"
|
||||
).text
|
||||
).html
|
||||
|
@ -247,7 +246,7 @@ class ZoroProvider : MainAPI() {
|
|||
}
|
||||
|
||||
private fun getM3u8FromRapidCloud(url: String): String {
|
||||
return get(
|
||||
return app.get(
|
||||
"$url&autoPlay=1&oa=0",
|
||||
headers = mapOf(
|
||||
"Referer" to "https://zoro.to/",
|
||||
|
@ -274,13 +273,13 @@ class ZoroProvider : MainAPI() {
|
|||
|
||||
val servers: List<Pair<DubStatus, String>> = Jsoup.parse(
|
||||
mapper.readValue<Response>(
|
||||
get("$mainUrl/ajax/v2/episode/servers?episodeId=" + data.split("=")[1]).text
|
||||
app.get("$mainUrl/ajax/v2/episode/servers?episodeId=" + data.split("=")[1]).text
|
||||
).html
|
||||
).select(".server-item[data-type][data-id]").map {
|
||||
Pair(if (it.attr("data-type") == "sub") DubStatus.Subbed else DubStatus.Dubbed, it.attr("data-id")!!)
|
||||
}
|
||||
|
||||
val res = get(
|
||||
val res = app.get(
|
||||
data,
|
||||
interceptor = WebViewResolver(
|
||||
Regex("""/getSources""")
|
||||
|
@ -288,7 +287,7 @@ class ZoroProvider : MainAPI() {
|
|||
)
|
||||
// println("RES TEXT ${res.text}")
|
||||
|
||||
val recaptchaToken = res.request.url.queryParameter("_token")
|
||||
val recaptchaToken = res.response.request.url.queryParameter("_token")
|
||||
|
||||
val responses = servers.map {
|
||||
val link = "$mainUrl/ajax/v2/episode/sources?id=${it.second}&_token=$recaptchaToken"
|
||||
|
@ -296,9 +295,9 @@ class ZoroProvider : MainAPI() {
|
|||
it.first,
|
||||
getM3u8FromRapidCloud(
|
||||
mapper.readValue<RapidCloudResponse>(
|
||||
get(
|
||||
app.get(
|
||||
link,
|
||||
res.request.headers.toMap()
|
||||
res.headers.toMap()
|
||||
).text
|
||||
).link
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.network.url
|
||||
import com.lagradost.cloudstream3.utils.*
|
||||
|
@ -17,7 +17,7 @@ class AsianLoad : ExtractorApi() {
|
|||
private val sourceRegex = Regex("""sources:[\W\w]*?file:\s*?["'](.*?)["']""")
|
||||
override fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
||||
val extractedLinksList: MutableList<ExtractorLink> = mutableListOf()
|
||||
with(get(url, referer = referer)) {
|
||||
with(app.get(url, referer = referer)) {
|
||||
sourceRegex.findAll(this.text).forEach { sourceMatch ->
|
||||
val extractedUrl = sourceMatch.groupValues[1]
|
||||
// Trusting this isn't mp4, may fuck up stuff
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
|
@ -32,12 +32,12 @@ open class DoodLaExtractor : ExtractorApi() {
|
|||
override fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||
val id = url.removePrefix("$mainUrl/e/").removePrefix("$mainUrl/d/")
|
||||
val trueUrl = getExtractorUrl(id)
|
||||
val response = get(trueUrl).text
|
||||
val response = app.get(trueUrl).text
|
||||
Regex("href=\".*/download/(.*?)\"").find(response)?.groupValues?.get(1)?.let { link ->
|
||||
if (link.isEmpty()) return null
|
||||
sleep(5000) // might need this to not trigger anti bot
|
||||
val downloadLink = "$mainUrl/download/$link"
|
||||
val downloadResponse = get(downloadLink).text
|
||||
val downloadResponse = app.get(downloadLink).text
|
||||
Regex("onclick=\"window\\.open\\((['\"])(.*?)(['\"])").find(downloadResponse)?.groupValues?.get(2)
|
||||
?.let { trueLink ->
|
||||
return listOf(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.*
|
||||
|
||||
|
@ -15,7 +15,7 @@ class MixDrop : ExtractorApi() {
|
|||
}
|
||||
|
||||
override fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||
with(get(url)) {
|
||||
with(app.get(url)) {
|
||||
getAndUnpack(this.text).let { unpackedText ->
|
||||
srcRegex.find(unpackedText)?.groupValues?.get(1)?.let { link ->
|
||||
return listOf(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.*
|
||||
|
||||
|
@ -11,7 +11,7 @@ class Mp4Upload : ExtractorApi() {
|
|||
override val requiresReferer = true
|
||||
|
||||
override fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||
with(get(url)) {
|
||||
with(app.get(url)) {
|
||||
getAndUnpack(this.text).let { unpackedText ->
|
||||
srcRegex.find(unpackedText)?.groupValues?.get(1)?.let { link ->
|
||||
return listOf(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.network.url
|
||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||
|
@ -23,12 +23,12 @@ class MultiQuality : ExtractorApi() {
|
|||
|
||||
override fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
||||
val extractedLinksList: MutableList<ExtractorLink> = mutableListOf()
|
||||
with(get(url)) {
|
||||
with(app.get(url)) {
|
||||
sourceRegex.findAll(this.text).forEach { sourceMatch ->
|
||||
val extractedUrl = sourceMatch.groupValues[1]
|
||||
// Trusting this isn't mp4, may fuck up stuff
|
||||
if (URI(extractedUrl).path.endsWith(".m3u8")) {
|
||||
with(get(extractedUrl)) {
|
||||
with(app.get(extractedUrl)) {
|
||||
m3u8Regex.findAll(this.text).forEach { match ->
|
||||
extractedLinksList.add(
|
||||
ExtractorLink(
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.post
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
|
@ -20,7 +19,7 @@ class SBPlay : ExtractorApi() {
|
|||
get() = false
|
||||
|
||||
override fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
||||
val response = get(url, referer = referer).text
|
||||
val response = app.get(url, referer = referer).text
|
||||
val document = Jsoup.parse(response)
|
||||
|
||||
val links = ArrayList<ExtractorLink>()
|
||||
|
@ -35,8 +34,8 @@ class SBPlay : ExtractorApi() {
|
|||
val mode = it.groupValues[2]
|
||||
val hash = it.groupValues[3]
|
||||
val href = "https://sbplay.one/dl?op=download_orig&id=$id&mode=$mode&hash=$hash"
|
||||
val hrefResponse = get(href).text
|
||||
post("https://sbplay.one/?op=notifications&open=&_=$unixTimeMS", referer = href)
|
||||
val hrefResponse = app.get(href).text
|
||||
app.post("https://sbplay.one/?op=notifications&open=&_=$unixTimeMS", referer = href)
|
||||
val hrefDocument = Jsoup.parse(hrefResponse)
|
||||
val hrefSpan = hrefDocument.selectFirst("span > a")
|
||||
if (hrefSpan == null) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
|
@ -23,12 +23,12 @@ class StreamSB : ExtractorApi() {
|
|||
override fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
||||
val extractedLinksList: MutableList<ExtractorLink> = mutableListOf()
|
||||
val newUrl = url.replace("sbplay.org/embed-", "sbplay.org/play/").removeSuffix(".html")
|
||||
with(get(newUrl, timeout = 10)) {
|
||||
with(app.get(newUrl, timeout = 10)) {
|
||||
getAndUnpack(this.text).let {
|
||||
sourceRegex.findAll(it).forEach { sourceMatch ->
|
||||
val extractedUrl = sourceMatch.groupValues[1]
|
||||
if (extractedUrl.contains(".m3u8")) {
|
||||
with(get(extractedUrl)) {
|
||||
with(app.get(extractedUrl)) {
|
||||
m3u8UrlRegex.findAll(this.text).forEach { match ->
|
||||
val extractedUrlM3u8 = match.groupValues[2]
|
||||
val extractedRes = match.groupValues[1]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
|
@ -15,7 +15,7 @@ class StreamTape : ExtractorApi() {
|
|||
Regex("""'robotlink'\)\.innerHTML = '(.+?)'\+ \('(.+?)'\)""")
|
||||
|
||||
override fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||
with(get(url)) {
|
||||
with(app.get(url)) {
|
||||
linkRegex.find(this.text)?.let {
|
||||
val extractedUrl = "https:${it.groups[1]!!.value + it.groups[2]!!.value.substring(3,)}"
|
||||
return listOf(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
|
@ -21,7 +21,7 @@ class Streamhub : ExtractorApi() {
|
|||
}
|
||||
|
||||
override fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
Regex("eval((.|\\n)*?)</script>").find(response)?.groupValues?.get(1)?.let { jsEval ->
|
||||
JsUnpacker("eval$jsEval" ).unpack()?.let { unPacked ->
|
||||
Regex("sources:\\[\\{src:\"(.*?)\"").find(unPacked)?.groupValues?.get(1)?.let { link ->
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.network.url
|
||||
import com.lagradost.cloudstream3.pmap
|
||||
|
@ -41,7 +41,7 @@ class Vidstream(val mainUrl: String) {
|
|||
normalSafeApiCall {
|
||||
val link = getDownloadUrl(id)
|
||||
println("Generated vidstream download link: $link")
|
||||
val page = get(link, referer = extractorUrl)
|
||||
val page = app.get(link, referer = extractorUrl)
|
||||
|
||||
val pageDoc = Jsoup.parse(page.text)
|
||||
val qualityRegex = Regex("(\\d+)P")
|
||||
|
@ -64,7 +64,7 @@ class Vidstream(val mainUrl: String) {
|
|||
}
|
||||
}
|
||||
|
||||
with(get(extractorUrl)) {
|
||||
with(app.get(extractorUrl)) {
|
||||
val document = Jsoup.parse(this.text)
|
||||
val primaryLinks = document.select("ul.list-server-items > li.linkserver")
|
||||
//val extractedLinksList: MutableList<ExtractorLink> = mutableListOf()
|
||||
|
|
|
@ -2,9 +2,9 @@ package com.lagradost.cloudstream3.extractors
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.utils.*
|
||||
import com.lagradost.cloudstream3.mapper
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
|
||||
class WcoStream : ExtractorApi() {
|
||||
|
@ -16,14 +16,14 @@ class WcoStream : ExtractorApi() {
|
|||
override fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
||||
val baseUrl = url.split("/e/")[0]
|
||||
|
||||
val html = get(url, headers = mapOf("Referer" to "https://wcostream.cc/")).text
|
||||
val html = app.get(url, headers = mapOf("Referer" to "https://wcostream.cc/")).text
|
||||
val (Id) = "/e/(.*?)?domain".toRegex().find(url)!!.destructured
|
||||
val (skey) = """skey\s=\s['"](.*?)['"];""".toRegex().find(html)!!.destructured
|
||||
|
||||
val apiLink = "$baseUrl/info/$Id?domain=wcostream.cc&skey=$skey"
|
||||
val referrer = "$baseUrl/e/$Id?domain=wcostream.cc"
|
||||
|
||||
val response = get(apiLink, headers = mapOf("Referer" to referrer)).text
|
||||
val response = app.get(apiLink, headers = mapOf("Referer" to referrer)).text
|
||||
|
||||
data class Sources(
|
||||
@JsonProperty("file") val file: String,
|
||||
|
|
|
@ -2,9 +2,8 @@ package com.lagradost.cloudstream3.extractors
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.mapper
|
||||
import com.lagradost.cloudstream3.network.post
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
|
@ -46,7 +45,7 @@ class XStreamCdn : ExtractorApi() {
|
|||
)
|
||||
val newUrl = url.replace("$mainUrl/v/", "$mainUrl/api/source/")
|
||||
val extractedLinksList: MutableList<ExtractorLink> = mutableListOf()
|
||||
with(post(newUrl, headers = headers)) {
|
||||
with(app.post(newUrl, headers = headers)) {
|
||||
val text = this.text
|
||||
if (text == """{"success":false,"data":"Video not found or has been removed"}""") return listOf()
|
||||
mapper.readValue<ResponseJson?>(text)?.let {
|
||||
|
|
|
@ -2,9 +2,6 @@ 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.text
|
||||
import com.lagradost.cloudstream3.network.url
|
||||
import com.lagradost.cloudstream3.utils.*
|
||||
import okio.Buffer
|
||||
import org.jsoup.Jsoup
|
||||
|
@ -35,7 +32,7 @@ class AllMoviesForYouProvider : MainAPI() {
|
|||
|
||||
override fun search(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/?s=$query"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
|
||||
val items = document.select("ul.MovieList > li > article > a")
|
||||
|
@ -75,7 +72,7 @@ class AllMoviesForYouProvider : MainAPI() {
|
|||
override fun load(url: String): LoadResponse {
|
||||
val type = getType(url)
|
||||
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
|
||||
val title = document.selectFirst("h1.Title").text()
|
||||
|
@ -101,7 +98,7 @@ class AllMoviesForYouProvider : MainAPI() {
|
|||
val episodeList = ArrayList<TvSeriesEpisode>()
|
||||
|
||||
for (season in list) {
|
||||
val seasonResponse = get(season.second).text
|
||||
val seasonResponse = app.get(season.second).text
|
||||
val seasonDocument = Jsoup.parse(seasonResponse)
|
||||
val episodes = seasonDocument.select("table > tbody > tr")
|
||||
if (episodes.isNotEmpty()) {
|
||||
|
@ -166,7 +163,7 @@ class AllMoviesForYouProvider : MainAPI() {
|
|||
): Boolean {
|
||||
if (data == "about:blank") return false
|
||||
if (data.startsWith("$mainUrl/episode/")) {
|
||||
val response = get(data).text
|
||||
val response = app.get(data).text
|
||||
getLink(Jsoup.parse(response))?.let { links ->
|
||||
for (link in links) {
|
||||
if (link == data) continue
|
||||
|
@ -178,7 +175,7 @@ class AllMoviesForYouProvider : MainAPI() {
|
|||
} else if (data.startsWith(mainUrl) && data != mainUrl) {
|
||||
val realDataUrl = URLDecoder.decode(data, "UTF-8")
|
||||
if (data.contains("trdownload")) {
|
||||
val request = get(data)
|
||||
val request = app.get(data)
|
||||
val requestUrl = request.url
|
||||
if (requestUrl.startsWith("https://streamhub.to/d/")) {
|
||||
val buffer = Buffer()
|
||||
|
@ -213,7 +210,7 @@ class AllMoviesForYouProvider : MainAPI() {
|
|||
}
|
||||
return true
|
||||
}
|
||||
val response = get(realDataUrl).text
|
||||
val response = app.get(realDataUrl).text
|
||||
Regex("<iframe.*?src=\"(.*?)\"").find(response)?.groupValues?.get(1)?.let { url ->
|
||||
loadExtractor(url.trimStart(), realDataUrl, callback)
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.fasterxml.jackson.core.JsonParser
|
|||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.animeproviders.GogoanimeProvider.Companion.getStatus
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.DataStore.toKotlinObject
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
|
@ -122,7 +121,7 @@ class AsiaFlixProvider : MainAPI() {
|
|||
|
||||
override fun getMainPage(): HomePageResponse {
|
||||
val headers = mapOf("X-Requested-By" to "asiaflix-web")
|
||||
val response = get("$apiUrl/dashboard", headers = headers).text
|
||||
val response = app.get("$apiUrl/dashboard", headers = headers).text
|
||||
|
||||
val customMapper = mapper.copy().configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true)
|
||||
// Hack, because it can either be object or a list
|
||||
|
@ -154,7 +153,7 @@ class AsiaFlixProvider : MainAPI() {
|
|||
): Boolean {
|
||||
if (isCasting) return false
|
||||
val headers = mapOf("X-Requested-By" to "asiaflix-web")
|
||||
get("$apiUrl/utility/get-stream-links?url=$data", headers = headers).text.toKotlinObject<Link>().url?.let {
|
||||
app.get("$apiUrl/utility/get-stream-links?url=$data", headers = headers).text.toKotlinObject<Link>().url?.let {
|
||||
// val fixedUrl = "https://api.asiaflix.app/api/v2/utility/cors-proxy/playlist/${URLEncoder.encode(it, StandardCharsets.UTF_8.toString())}"
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
|
@ -173,14 +172,14 @@ class AsiaFlixProvider : MainAPI() {
|
|||
override fun search(query: String): List<SearchResponse>? {
|
||||
val headers = mapOf("X-Requested-By" to "asiaflix-web")
|
||||
val url = "$apiUrl/drama/search?q=$query"
|
||||
val response = get(url, headers = headers).text
|
||||
val response = app.get(url, headers = headers).text
|
||||
return mapper.readValue<List<Data>?>(response)?.map { it.toSearchResponse() }
|
||||
}
|
||||
|
||||
override fun load(url: String): LoadResponse {
|
||||
val headers = mapOf("X-Requested-By" to "asiaflix-web")
|
||||
val requestUrl = "$apiUrl/drama?id=${url.split("/").lastOrNull()}"
|
||||
val response = get(requestUrl, headers = headers).text
|
||||
val response = app.get(requestUrl, headers = headers).text
|
||||
val dramaPage = response.toKotlinObject<DramaPage>()
|
||||
return dramaPage.toLoadResponse()
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.lagradost.cloudstream3.movieproviders
|
||||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
|
@ -22,7 +21,7 @@ class HDMProvider : MainAPI() {
|
|||
|
||||
override fun search(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/search/$query"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val items = document.select("div.col-md-2 > article > a")
|
||||
if (items.isEmpty()) return ArrayList()
|
||||
|
@ -46,7 +45,7 @@ class HDMProvider : MainAPI() {
|
|||
): Boolean {
|
||||
if (data == "") return false
|
||||
val slug = ".*/(.*?)\\.mp4".toRegex().find(data)?.groupValues?.get(1) ?: return false
|
||||
val response = get(data).text
|
||||
val response = app.get(data).text
|
||||
val key = "playlist\\.m3u8(.*?)\"".toRegex().find(response)?.groupValues?.get(1) ?: return false
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
|
@ -62,7 +61,7 @@ class HDMProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override fun load(url: String): LoadResponse? {
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val title = document.selectFirst("h2.movieTitle")?.text() ?: throw ErrorLoadingException("No Data Found")
|
||||
val poster = document.selectFirst("div.post-thumbnail > img").attr("src")
|
||||
|
@ -78,7 +77,7 @@ class HDMProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override fun getMainPage(): HomePageResponse {
|
||||
val html = get("$mainUrl", timeout = 25).text
|
||||
val html = app.get("$mainUrl", timeout = 25).text
|
||||
val document = Jsoup.parse(html)
|
||||
val all = ArrayList<HomePageList>()
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.lagradost.cloudstream3.*
|
|||
import com.lagradost.cloudstream3.APIHolder.unixTime
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.extractors.M3u8Manifest
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||
import org.jsoup.Jsoup
|
||||
|
@ -73,11 +72,11 @@ class LookMovieProvider : MainAPI() {
|
|||
|
||||
override fun quickSearch(query: String): List<SearchResponse> {
|
||||
val movieUrl = "$mainUrl/api/v1/movies/search/?q=$query"
|
||||
val movieResponse = get(movieUrl).text
|
||||
val movieResponse = app.get(movieUrl).text
|
||||
val movies = mapper.readValue<LookMovieSearchResultRoot>(movieResponse).result
|
||||
|
||||
val showsUrl = "$mainUrl/api/v1/shows/search/?q=$query"
|
||||
val showsResponse = get(showsUrl).text
|
||||
val showsResponse = app.get(showsUrl).text
|
||||
val shows = mapper.readValue<LookMovieSearchResultRoot>(showsResponse).result
|
||||
|
||||
val returnValue = ArrayList<SearchResponse>()
|
||||
|
@ -119,7 +118,7 @@ class LookMovieProvider : MainAPI() {
|
|||
override fun search(query: String): List<SearchResponse> {
|
||||
fun search(query: String, isMovie: Boolean): ArrayList<SearchResponse> {
|
||||
val url = "$mainUrl/${if (isMovie) "movies" else "shows"}/search/?q=$query"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
|
||||
val items = document.select("div.flex-wrap-movielist > div.movie-item-style-1")
|
||||
|
@ -163,7 +162,7 @@ class LookMovieProvider : MainAPI() {
|
|||
}
|
||||
|
||||
private fun loadCurrentLinks(url: String, callback: (ExtractorLink) -> Unit) {
|
||||
val response = get(url.replace("\$unixtime", unixTime.toString())).text
|
||||
val response = app.get(url.replace("\$unixtime", unixTime.toString())).text
|
||||
M3u8Manifest.extractLinks(response).forEach {
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
|
@ -187,7 +186,7 @@ class LookMovieProvider : MainAPI() {
|
|||
val localData: LookMovieLinkLoad = mapper.readValue(data)
|
||||
|
||||
if (localData.isMovie) {
|
||||
val tokenResponse = get(localData.url).text
|
||||
val tokenResponse = app.get(localData.url).text
|
||||
val root = mapper.readValue<LookMovieTokenRoot>(tokenResponse)
|
||||
val accessToken = root.data?.accessToken ?: return false
|
||||
addSubtitles(root.data.subtitles, subtitleCallback)
|
||||
|
@ -195,7 +194,7 @@ class LookMovieProvider : MainAPI() {
|
|||
return true
|
||||
} else {
|
||||
loadCurrentLinks(localData.url, callback)
|
||||
val subResponse = get(localData.extraUrl).text
|
||||
val subResponse = app.get(localData.extraUrl).text
|
||||
val subs = mapper.readValue<List<LookMovieTokenSubtitle>>(subResponse)
|
||||
addSubtitles(subs, subtitleCallback)
|
||||
}
|
||||
|
@ -203,7 +202,7 @@ class LookMovieProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override fun load(url: String): LoadResponse? {
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val isMovie = url.contains("/movies/")
|
||||
|
||||
|
@ -245,7 +244,7 @@ class LookMovieProvider : MainAPI() {
|
|||
rating
|
||||
)
|
||||
} else {
|
||||
val tokenResponse = get(realUrl).text
|
||||
val tokenResponse = app.get(realUrl).text
|
||||
val root = mapper.readValue<LookMovieTokenRoot>(tokenResponse)
|
||||
val accessToken = root.data?.accessToken ?: return null
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.lagradost.cloudstream3.movieproviders
|
|||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.Session
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||
|
@ -40,7 +40,7 @@ class MeloMovieProvider : MainAPI() {
|
|||
override fun search(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/movie/search/?name=$query"
|
||||
val returnValue: ArrayList<SearchResponse> = ArrayList()
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val mapped = response.let { mapper.readValue<List<MeloMovieSearchResult>>(it) }
|
||||
if (mapped.isEmpty()) return returnValue
|
||||
|
||||
|
@ -117,7 +117,7 @@ class MeloMovieProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override fun load(url: String): LoadResponse? {
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
|
||||
//backdrop = imgurl
|
||||
fun findUsingRegex(src: String): String? {
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
|||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.network.WebViewResolver
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||
|
@ -69,7 +68,7 @@ class SflixProvider(private val providerUrl: String, private val providerName: S
|
|||
}
|
||||
|
||||
override fun getMainPage(): HomePageResponse {
|
||||
val html = get("$mainUrl/home").text
|
||||
val html = app.get("$mainUrl/home").text
|
||||
val document = Jsoup.parse(html)
|
||||
|
||||
val all = ArrayList<HomePageList>()
|
||||
|
@ -103,7 +102,7 @@ class SflixProvider(private val providerUrl: String, private val providerName: S
|
|||
|
||||
override fun search(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/search/${query.replace(" ", "-")}"
|
||||
val html = get(url).text
|
||||
val html = app.get(url).text
|
||||
val document = Jsoup.parse(html)
|
||||
|
||||
return document.select("div.flw-item").map {
|
||||
|
@ -137,7 +136,7 @@ class SflixProvider(private val providerUrl: String, private val providerName: S
|
|||
}
|
||||
|
||||
override fun load(url: String): LoadResponse {
|
||||
val html = get(url).text
|
||||
val html = app.get(url).text
|
||||
val document = Jsoup.parse(html)
|
||||
|
||||
val details = document.select("div.detail_page-watch")
|
||||
|
@ -167,7 +166,7 @@ class SflixProvider(private val providerUrl: String, private val providerName: S
|
|||
if (isMovie) {
|
||||
// Movies
|
||||
val episodesUrl = "$mainUrl/ajax/movie/episodes/$id"
|
||||
val episodes = get(episodesUrl).text
|
||||
val episodes = app.get(episodesUrl).text
|
||||
|
||||
// Supported streams, they're identical
|
||||
val sourceId = Jsoup.parse(episodes).select("a").firstOrNull {
|
||||
|
@ -194,7 +193,7 @@ class SflixProvider(private val providerUrl: String, private val providerName: S
|
|||
null
|
||||
)
|
||||
} else {
|
||||
val seasonsHtml = get("$mainUrl/ajax/v2/tv/seasons/$id").text
|
||||
val seasonsHtml = app.get("$mainUrl/ajax/v2/tv/seasons/$id").text
|
||||
val seasonsDocument = Jsoup.parse(seasonsHtml)
|
||||
val episodes = arrayListOf<TvSeriesEpisode>()
|
||||
|
||||
|
@ -202,7 +201,7 @@ class SflixProvider(private val providerUrl: String, private val providerName: S
|
|||
val seasonId = element.attr("data-id")
|
||||
if (seasonId.isNullOrBlank()) return@forEachIndexed
|
||||
|
||||
val seasonHtml = get("$mainUrl/ajax/v2/season/episodes/$seasonId").text
|
||||
val seasonHtml = app.get("$mainUrl/ajax/v2/season/episodes/$seasonId").text
|
||||
val seasonDocument = Jsoup.parse(seasonHtml)
|
||||
seasonDocument.select("div.flw-item.film_single-item.episode-item.eps-item")
|
||||
.forEachIndexed { _, it ->
|
||||
|
@ -279,7 +278,7 @@ class SflixProvider(private val providerUrl: String, private val providerName: S
|
|||
// Only used for tv series
|
||||
val url = if (split.size == 2) {
|
||||
val episodesUrl = "$mainUrl/ajax/v2/episode/servers/${split[1]}"
|
||||
val episodes = get(episodesUrl).text
|
||||
val episodes = app.get(episodesUrl).text
|
||||
|
||||
// Supported streams, they're identical
|
||||
val sourceId = Jsoup.parse(episodes).select("a").firstOrNull {
|
||||
|
@ -292,7 +291,7 @@ class SflixProvider(private val providerUrl: String, private val providerName: S
|
|||
data
|
||||
}
|
||||
|
||||
val sources = get(
|
||||
val sources = app.get(
|
||||
url,
|
||||
interceptor = WebViewResolver(
|
||||
Regex("""/getSources""")
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.lagradost.cloudstream3.movieproviders
|
|||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||
|
@ -43,7 +42,7 @@ class ThenosProvider : MainAPI() {
|
|||
val list = ArrayList<HomePageList>()
|
||||
map.entries.forEach {
|
||||
val url = "$apiUrl/library/${it.value}"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val mapped = mapper.readValue<ThenosLoadResponse>(response)
|
||||
|
||||
mapped.Metadata?.mapNotNull { meta ->
|
||||
|
@ -211,7 +210,7 @@ class ThenosProvider : MainAPI() {
|
|||
}
|
||||
|
||||
private fun searchFromUrl(url: String): List<SearchResponse> {
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val test = mapper.readValue<ThenosSearchResponse>(response)
|
||||
val returnValue = ArrayList<SearchResponse>()
|
||||
|
||||
|
@ -257,12 +256,12 @@ class ThenosProvider : MainAPI() {
|
|||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
val url = "$apiUrl/library/watch/$data"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val mapped = mapper.readValue<ThenosSource>(response)
|
||||
|
||||
mapped.sources?.forEach { source ->
|
||||
val isM3u8 = source.type != "video/mp4"
|
||||
val token = get("https://token.noss.workers.dev/").text
|
||||
val token = app.get("https://token.noss.workers.dev/").text
|
||||
val authorization =
|
||||
base64Decode(token)
|
||||
|
||||
|
@ -425,11 +424,11 @@ class ThenosProvider : MainAPI() {
|
|||
private fun getAllEpisodes(id: String): List<TvSeriesEpisode> {
|
||||
val episodes = ArrayList<TvSeriesEpisode>()
|
||||
val url = "$apiUrl/library/metadata/$id/children"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val mapped = mapper.readValue<ThenosSeriesResponse>(response)
|
||||
mapped.Metadata?.forEach { series_meta ->
|
||||
val fixedUrl = apiUrl + series_meta.key
|
||||
val child = get(fixedUrl).text
|
||||
val child = app.get(fixedUrl).text
|
||||
val mappedSeason = mapper.readValue<SeasonResponse>(child)
|
||||
mappedSeason.Metadata?.forEach mappedSeason@{ meta ->
|
||||
episodes.add(
|
||||
|
@ -452,7 +451,7 @@ class ThenosProvider : MainAPI() {
|
|||
|
||||
override fun load(url: String): LoadResponse? {
|
||||
val fixedUrl = "$apiUrl/library/metadata/${url.split("/").last()}"
|
||||
val response = get(fixedUrl).text
|
||||
val response = app.get(fixedUrl).text
|
||||
val mapped = mapper.readValue<ThenosLoadResponse>(response)
|
||||
|
||||
val isShow = mapped.Metadata?.any { it?.type == "show" } == true
|
||||
|
|
|
@ -2,7 +2,6 @@ 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.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
|
@ -35,7 +34,7 @@ class TrailersToProvider : MainAPI() {
|
|||
get() = VPNStatus.MightBeNeeded
|
||||
|
||||
override fun getMainPage(): HomePageResponse? {
|
||||
val response = get(mainUrl).text
|
||||
val response = app.get(mainUrl).text
|
||||
val document = Jsoup.parse(response)
|
||||
val returnList = ArrayList<HomePageList>()
|
||||
val docs = document.select("section.section > div.container")
|
||||
|
@ -78,7 +77,7 @@ class TrailersToProvider : MainAPI() {
|
|||
|
||||
override fun quickSearch(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/en/quick-search?q=$query"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val items = document.select("div.group-post-minimal > a.post-minimal")
|
||||
if (items.isNullOrEmpty()) return ArrayList()
|
||||
|
@ -106,7 +105,7 @@ class TrailersToProvider : MainAPI() {
|
|||
|
||||
override fun search(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/en/popular/movies-tvshows-collections?q=$query"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val items = document.select("div.col-lg-8 > article.list-item")
|
||||
if (items.isNullOrEmpty()) return ArrayList()
|
||||
|
@ -135,7 +134,7 @@ class TrailersToProvider : MainAPI() {
|
|||
data: String,
|
||||
callback: (ExtractorLink) -> Unit,
|
||||
): Boolean {
|
||||
val response = get(data).text
|
||||
val response = app.get(data).text
|
||||
val url = "<source src='(.*?)'".toRegex().find(response)?.groupValues?.get(1)
|
||||
if (url != null) {
|
||||
callback.invoke(ExtractorLink(this.name, this.name, url, mainUrl, Qualities.Unknown.value, false))
|
||||
|
@ -146,7 +145,7 @@ class TrailersToProvider : MainAPI() {
|
|||
private fun loadSubs(url: String, subtitleCallback: (SubtitleFile) -> Unit) {
|
||||
if (url.isEmpty()) return
|
||||
|
||||
val response = get(fixUrl(url)).text
|
||||
val response = app.get(fixUrl(url)).text
|
||||
val document = Jsoup.parse(response)
|
||||
|
||||
val items = document.select("div.list-group > a.list-group-item")
|
||||
|
@ -183,7 +182,7 @@ class TrailersToProvider : MainAPI() {
|
|||
|
||||
return isSucc
|
||||
} else if (url.contains("/episode/")) {
|
||||
val response = get(url, params = mapOf("preview" to "1")).text
|
||||
val response = app.get(url, params = mapOf("preview" to "1")).text
|
||||
val document = Jsoup.parse(response)
|
||||
// val qSub = document.select("subtitle-content")
|
||||
val subUrl = document.select("subtitle-content")?.attr("data-url") ?: ""
|
||||
|
@ -200,7 +199,7 @@ class TrailersToProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override fun load(url: String): LoadResponse {
|
||||
val response = get(if (url.endsWith("?preview=1")) url else "$url?preview=1").text
|
||||
val response = app.get(if (url.endsWith("?preview=1")) url else "$url?preview=1").text
|
||||
val document = Jsoup.parse(response)
|
||||
var title = document?.selectFirst("h2.breadcrumbs-custom-title > a")?.text()
|
||||
?: throw ErrorLoadingException("Service might be unavailable")
|
||||
|
|
|
@ -2,13 +2,9 @@ package com.lagradost.cloudstream3.movieproviders
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.ProviderType
|
||||
import com.lagradost.cloudstream3.SubtitleFile
|
||||
import com.lagradost.cloudstream3.TvType
|
||||
import com.lagradost.cloudstream3.mapper
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.metaproviders.TmdbLink
|
||||
import com.lagradost.cloudstream3.metaproviders.TmdbProvider
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
|
@ -82,7 +78,7 @@ class TrailersTwoProvider : TmdbProvider() {
|
|||
}
|
||||
|
||||
val subtitles =
|
||||
get(subtitleUrl).text
|
||||
app.get(subtitleUrl).text
|
||||
val subtitlesMapped = mapper.readValue<List<TrailersSubtitleFile>>(subtitles)
|
||||
subtitlesMapped.forEach {
|
||||
subtitleCallback.invoke(
|
||||
|
|
|
@ -3,8 +3,6 @@ package com.lagradost.cloudstream3.movieproviders
|
|||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
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
|
||||
|
@ -25,7 +23,7 @@ class VMoveeProvider : MainAPI() {
|
|||
|
||||
override fun search(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/?s=$query"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val searchItems = document.select("div.search-page > div.result-item > article")
|
||||
if (searchItems.size == 0) return ArrayList()
|
||||
|
@ -79,7 +77,7 @@ class VMoveeProvider : MainAPI() {
|
|||
|
||||
val url = "$mainUrl/dashboard/admin-ajax.php"
|
||||
val post =
|
||||
post(
|
||||
app.post(
|
||||
url,
|
||||
headers = mapOf("referer" to url),
|
||||
data = mapOf("action" to "doo_player_ajax", "post" to data, "nume" to "2", "type" to "movie")
|
||||
|
@ -91,11 +89,11 @@ class VMoveeProvider : MainAPI() {
|
|||
realUrl = "https:$realUrl"
|
||||
}
|
||||
|
||||
val request = get(realUrl)
|
||||
val request = app.get(realUrl)
|
||||
val prefix = "https://reeoov.tube/v/"
|
||||
if (request.url.startsWith(prefix)) {
|
||||
val apiUrl = "https://reeoov.tube/api/source/${request.url.removePrefix(prefix)}"
|
||||
val apiResponse = post(apiUrl,headers = mapOf("Referer" to request.url),data = mapOf("r" to "https://www.vmovee.watch/", "d" to "reeoov.tube")).text
|
||||
val apiResponse = app.post(apiUrl,headers = mapOf("Referer" to request.url),data = mapOf("r" to "https://www.vmovee.watch/", "d" to "reeoov.tube")).text
|
||||
val apiData = mapper.readValue<ReeoovAPI>(apiResponse)
|
||||
for (d in apiData.data) {
|
||||
callback.invoke(
|
||||
|
@ -115,7 +113,7 @@ class VMoveeProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override fun load(url: String): LoadResponse {
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
|
||||
val sheader = document.selectFirst("div.sheader")
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.lagradost.cloudstream3.movieproviders
|
||||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
|
@ -33,7 +32,7 @@ class VfFilmProvider : MainAPI() {
|
|||
|
||||
override fun search(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/?s=$query"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val items = document.select("ul.MovieList > li > article > a")
|
||||
if (items.isNullOrEmpty()) return ArrayList()
|
||||
|
@ -42,7 +41,8 @@ class VfFilmProvider : MainAPI() {
|
|||
for (item in items) {
|
||||
val href = item.attr("href")
|
||||
|
||||
val poster = item.selectFirst("> div.Image > figure > img").attr("src").replace("//image", "https://image")
|
||||
val poster = item.selectFirst("> div.Image > figure > img").attr("src")
|
||||
.replace("//image", "https://image")
|
||||
|
||||
val name = item.selectFirst("> h3.Title").text()
|
||||
|
||||
|
@ -76,22 +76,23 @@ class VfFilmProvider : MainAPI() {
|
|||
|
||||
|
||||
private fun getDirect(original: String): String { // original data, https://vf-film.org/?trembed=1&trid=55313&trtype=1 for example
|
||||
val response = get(original).text
|
||||
val url = "iframe .*src=\"(.*?)\"".toRegex().find(response)?.groupValues?.get(1).toString() // https://vudeo.net/embed-uweno86lzx8f.html for example
|
||||
val vudoResponse = get(url).text
|
||||
val response = app.get(original).text
|
||||
val url = "iframe .*src=\"(.*?)\"".toRegex().find(response)?.groupValues?.get(1)
|
||||
.toString() // https://vudeo.net/embed-uweno86lzx8f.html for example
|
||||
val vudoResponse = app.get(url).text
|
||||
val document = Jsoup.parse(vudoResponse)
|
||||
val vudoUrl = Regex("sources: \\[\"(.*?)\"]").find(document.html())?.groupValues?.get(1).toString() // direct mp4 link, https://m11.vudeo.net/2vp3ukyw2avjdohilpebtzuct42q5jwvpmpsez3xjs6d7fbs65dpuey2rbra/v.mp4 for exemple
|
||||
val vudoUrl = Regex("sources: \\[\"(.*?)\"]").find(document.html())?.groupValues?.get(1)
|
||||
.toString() // direct mp4 link, https://m11.vudeo.net/2vp3ukyw2avjdohilpebtzuct42q5jwvpmpsez3xjs6d7fbs65dpuey2rbra/v.mp4 for exemple
|
||||
return vudoUrl
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun load(url: String): LoadResponse {
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val title = document?.selectFirst("div.SubTitle")?.text()
|
||||
?: throw ErrorLoadingException("Service might be unavailable")
|
||||
|
||||
|
||||
|
||||
val year = document.select("span.Date").text()?.toIntOrNull()
|
||||
|
||||
|
@ -99,7 +100,8 @@ class VfFilmProvider : MainAPI() {
|
|||
|
||||
val duration = document.select("span.Time").text()?.toIntOrNull()
|
||||
|
||||
val poster = document.selectFirst("div.Image > figure > img").attr("src").replace("//image", "https://image")
|
||||
val poster = document.selectFirst("div.Image > figure > img").attr("src")
|
||||
.replace("//image", "https://image")
|
||||
|
||||
val descript = document.selectFirst("div.Description > p").text()
|
||||
|
||||
|
|
|
@ -2,10 +2,7 @@ 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
|
||||
|
@ -37,7 +34,7 @@ class VfSerieProvider : MainAPI() {
|
|||
|
||||
override fun search(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/?s=$query"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val items = document.select("ul.MovieList > li > article > a")
|
||||
if (items.isNullOrEmpty()) return ArrayList()
|
||||
|
@ -65,9 +62,9 @@ class VfSerieProvider : MainAPI() {
|
|||
|
||||
|
||||
private fun getDirect(original: String): String { // original data, https://vf-serie.org/?trembed=1&trid=80467&trtype=2 for example
|
||||
val response = get(original).text
|
||||
val response = app.get(original).text
|
||||
val url = "iframe .*src=\\\"(.*?)\\\"".toRegex().find(response)?.groupValues?.get(1).toString() // https://vudeo.net/embed-7jdb1t5b2mvo.html for example
|
||||
val vudoResponse = get(url).text
|
||||
val vudoResponse = app.get(url).text
|
||||
val document = Jsoup.parse(vudoResponse)
|
||||
val vudoUrl = Regex("sources: \\[\"(.*?)\"\\]").find(document.html())?.groupValues?.get(1).toString() // direct mp4 link, https://m5.vudeo.net/2vp3xgpw2avjdohilpfbtyuxzzrqzuh4z5yxvztral5k3rjnba6f4byj3saa/v.mp4 for exemple
|
||||
return vudoUrl
|
||||
|
@ -81,7 +78,7 @@ class VfSerieProvider : MainAPI() {
|
|||
): Boolean {
|
||||
if (data == "") return false
|
||||
|
||||
val response = get(data).text
|
||||
val response = app.get(data).text
|
||||
val document = Jsoup.parse(response)
|
||||
val players = document.select("ul.TPlayerNv > li")
|
||||
val trembed_url = document.selectFirst("div.TPlayerTb > iframe").attr("src")
|
||||
|
@ -117,7 +114,7 @@ class VfSerieProvider : MainAPI() {
|
|||
|
||||
|
||||
override fun load(url: String): LoadResponse {
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val title = document?.selectFirst(".Title")?.text()?.replace("Regarder Serie ","")?.replace(" En Streaming", "")
|
||||
?: throw ErrorLoadingException("Service might be unavailable")
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.lagradost.cloudstream3.movieproviders
|
|||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.extractors.Vidstream
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||
|
@ -52,7 +51,7 @@ open class VidstreamProviderTemplate : MainAPI() {
|
|||
// Simply looking at devtools network is enough to spot a request like:
|
||||
// https://vidembed.cc/search.html?keyword=neverland where neverland is the query, can be written as below.
|
||||
val link = "$mainUrl/search.html?keyword=$query"
|
||||
val html = get(link).text
|
||||
val html = app.get(link).text
|
||||
val soup = Jsoup.parse(html)
|
||||
|
||||
return ArrayList(soup.select(".listing.items > .video-block").map { li ->
|
||||
|
@ -83,7 +82,7 @@ open class VidstreamProviderTemplate : MainAPI() {
|
|||
// Like search you should return either of: AnimeLoadResponse, MovieLoadResponse, TorrentLoadResponse, TvSeriesLoadResponse.
|
||||
override fun load(url: String): LoadResponse? {
|
||||
// Gets the url returned from searching.
|
||||
val html = get(url).text
|
||||
val html = app.get(url).text
|
||||
val soup = Jsoup.parse(html)
|
||||
|
||||
var title = soup.selectFirst("h1,h2,h3").text()
|
||||
|
@ -164,7 +163,7 @@ open class VidstreamProviderTemplate : MainAPI() {
|
|||
val homePageList = ArrayList<HomePageList>()
|
||||
// .pmap {} is used to fetch the different pages in parallel
|
||||
urls.pmap { url ->
|
||||
val response = get(url, timeout = 20).text
|
||||
val response = app.get(url, timeout = 20).text
|
||||
val document = Jsoup.parse(response)
|
||||
document.select("div.main-inner")?.forEach { inner ->
|
||||
// Always trim your text unless you want the risk of spaces at the start or end.
|
||||
|
@ -221,7 +220,7 @@ open class VidstreamProviderTemplate : MainAPI() {
|
|||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
// "?: return" is a very useful statement which returns if the iframe link isn't found.
|
||||
val iframeLink = Jsoup.parse(get(data).text).selectFirst("iframe")?.attr("src") ?: return false
|
||||
val iframeLink = Jsoup.parse(app.get(data).text).selectFirst("iframe")?.attr("src") ?: return false
|
||||
|
||||
// In this case the video player is a vidstream clone and can be handled by the vidstream extractor.
|
||||
// This case is a both unorthodox and you normally do not call extractors as they detect the url returned and does the rest.
|
||||
|
@ -233,7 +232,7 @@ open class VidstreamProviderTemplate : MainAPI() {
|
|||
vidstreamObject.getUrl(id, isCasting, callback)
|
||||
}
|
||||
|
||||
val html = get(fixUrl(iframeLink)).text
|
||||
val html = app.get(fixUrl(iframeLink)).text
|
||||
val soup = Jsoup.parse(html)
|
||||
|
||||
val servers = soup.select(".list-server-items > .linkserver").mapNotNull { li ->
|
||||
|
@ -253,7 +252,7 @@ open class VidstreamProviderTemplate : MainAPI() {
|
|||
|
||||
// Having a referer is often required. It's a basic security check most providers have.
|
||||
// Try to replicate what your browser does.
|
||||
val serverHtml = get(it.second, headers = mapOf("referer" to iframeLink)).text
|
||||
val serverHtml = app.get(it.second, headers = mapOf("referer" to iframeLink)).text
|
||||
sourceRegex.findAll(serverHtml).forEach { match ->
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
|
|
|
@ -2,8 +2,11 @@ package com.lagradost.cloudstream3.network
|
|||
|
||||
import android.content.Context
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.USER_AGENT
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.mapper
|
||||
import okhttp3.*
|
||||
import okhttp3.Headers.Companion.toHeaders
|
||||
import java.io.File
|
||||
|
@ -11,7 +14,30 @@ import java.net.URI
|
|||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
var baseClient = OkHttpClient()
|
||||
|
||||
class Session(
|
||||
client: OkHttpClient = app.baseClient
|
||||
) : Requests() {
|
||||
init {
|
||||
this.baseClient = client
|
||||
.newBuilder()
|
||||
.cookieJar(CustomCookieJar())
|
||||
.build()
|
||||
}
|
||||
|
||||
inner class CustomCookieJar : CookieJar {
|
||||
private var cookies = mapOf<String, Cookie>()
|
||||
|
||||
override fun loadForRequest(url: HttpUrl): List<Cookie> {
|
||||
return this.cookies.values.toList()
|
||||
}
|
||||
|
||||
override fun saveFromResponse(url: HttpUrl, cookies: List<Cookie>) {
|
||||
this.cookies += cookies.map { it.name to it }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private const val DEFAULT_TIME = 10
|
||||
private val DEFAULT_TIME_UNIT = TimeUnit.MINUTES
|
||||
private const val DEFAULT_USER_AGENT = USER_AGENT
|
||||
|
@ -20,30 +46,6 @@ private val DEFAULT_DATA: Map<String, String> = mapOf()
|
|||
private val DEFAULT_COOKIES: Map<String, String> = mapOf()
|
||||
private val DEFAULT_REFERER: String? = null
|
||||
|
||||
fun Context.initRequestClient(): OkHttpClient {
|
||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
val dns = settingsManager.getInt(this.getString(R.string.dns_pref), 0)
|
||||
baseClient = OkHttpClient.Builder()
|
||||
.cache(
|
||||
// Note that you need to add a ResponseInterceptor to make this 100% active.
|
||||
// The server response dictates if and when stuff should be cached.
|
||||
Cache(
|
||||
directory = File(cacheDir, "http_cache"),
|
||||
maxSize = 50L * 1024L * 1024L // 50 MiB
|
||||
)
|
||||
).apply {
|
||||
when (dns) {
|
||||
1 -> addGoogleDns()
|
||||
2 -> addCloudFlareDns()
|
||||
// 3 -> addOpenDns()
|
||||
4 -> addAdGuardDns()
|
||||
}
|
||||
}
|
||||
// Needs to be build as otherwise the other builders will change this object
|
||||
.build()
|
||||
return baseClient
|
||||
}
|
||||
|
||||
/** WARNING! CAN ONLY BE READ ONCE */
|
||||
val Response.text: String
|
||||
get() {
|
||||
|
@ -58,14 +60,32 @@ val Response.url: String
|
|||
val Response.cookies: Map<String, String>
|
||||
get() {
|
||||
val cookieList =
|
||||
this.headers.filter { it.first.toLowerCase(Locale.ROOT) == "set-cookie" }.getOrNull(0)?.second?.split(";")
|
||||
this.headers.filter { it.first.toLowerCase(Locale.ROOT) == "set-cookie" }
|
||||
.getOrNull(0)?.second?.split(";")
|
||||
return cookieList?.associate {
|
||||
val split = it.split("=")
|
||||
(split.getOrNull(0)?.trim() ?: "") to (split.getOrNull(1)?.trim() ?: "")
|
||||
}?.filter { it.key.isNotBlank() && it.value.isNotBlank() } ?: mapOf()
|
||||
}
|
||||
|
||||
fun getData(data: Map<String, String?>): RequestBody {
|
||||
class AppResponse(
|
||||
val response: Response
|
||||
) {
|
||||
/** Lazy, initialized on use. */
|
||||
val text by lazy { response.text }
|
||||
val url by lazy { response.url }
|
||||
val cookies by lazy { response.cookies }
|
||||
val body by lazy { response.body }
|
||||
val code = response.code
|
||||
val headers = response.headers
|
||||
|
||||
/** Same as using mapper.readValue<T>() */
|
||||
inline fun <reified T : Any> mapped(): T {
|
||||
return mapper.readValue(this.text)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getData(data: Map<String, String?>): RequestBody {
|
||||
val builder = FormBody.Builder()
|
||||
data.forEach {
|
||||
it.value?.let { value ->
|
||||
|
@ -76,16 +96,19 @@ fun getData(data: Map<String, String?>): RequestBody {
|
|||
}
|
||||
|
||||
// https://github.com, id=test -> https://github.com?id=test
|
||||
fun appendUri(uri: String, appendQuery: String): String {
|
||||
private fun appendUri(uri: String, appendQuery: String): String {
|
||||
val oldUri = URI(uri)
|
||||
return URI(
|
||||
oldUri.scheme, oldUri.authority, oldUri.path,
|
||||
if (oldUri.query == null) appendQuery else oldUri.query + "&" + appendQuery, oldUri.fragment
|
||||
oldUri.scheme,
|
||||
oldUri.authority,
|
||||
oldUri.path,
|
||||
if (oldUri.query == null) appendQuery else oldUri.query + "&" + appendQuery,
|
||||
oldUri.fragment
|
||||
).toString()
|
||||
}
|
||||
|
||||
// Can probably be done recursively
|
||||
fun addParamsToUrl(url: String, params: Map<String, String?>): String {
|
||||
private fun addParamsToUrl(url: String, params: Map<String, String?>): String {
|
||||
var appendedUrl = url
|
||||
params.forEach {
|
||||
it.value?.let { value ->
|
||||
|
@ -95,87 +118,31 @@ fun addParamsToUrl(url: String, params: Map<String, String?>): String {
|
|||
return appendedUrl
|
||||
}
|
||||
|
||||
fun getCache(cacheTime: Int, cacheUnit: TimeUnit): CacheControl {
|
||||
return CacheControl.Builder().maxAge(cacheTime, cacheUnit).build()
|
||||
private fun getCache(cacheTime: Int, cacheUnit: TimeUnit): CacheControl {
|
||||
return CacheControl.Builder().maxStale(cacheTime, cacheUnit).build()
|
||||
}
|
||||
|
||||
/**
|
||||
* Referer > Set headers > Set cookies > Default headers > Default Cookies
|
||||
*/
|
||||
fun getHeaders(headers: Map<String, String>, referer: String?, cookie: Map<String, String>): Headers {
|
||||
private fun getHeaders(
|
||||
headers: Map<String, String>,
|
||||
referer: String?,
|
||||
cookie: Map<String, String>
|
||||
): Headers {
|
||||
val refererMap = (referer ?: DEFAULT_REFERER)?.let { mapOf("referer" to it) } ?: mapOf()
|
||||
val cookieHeaders = (DEFAULT_COOKIES + cookie)
|
||||
val cookieMap =
|
||||
if (cookieHeaders.isNotEmpty()) mapOf("Cookie" to cookieHeaders.entries.joinToString(separator = "; ") {
|
||||
"${it.key}=${it.value};"
|
||||
}) else mapOf()
|
||||
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(
|
||||
url: String,
|
||||
headers: Map<String, String> = mapOf(),
|
||||
referer: String? = null,
|
||||
params: Map<String, String> = mapOf(),
|
||||
cookies: Map<String, String> = mapOf(),
|
||||
allowRedirects: Boolean = true,
|
||||
cacheTime: Int = DEFAULT_TIME,
|
||||
cacheUnit: TimeUnit = DEFAULT_TIME_UNIT,
|
||||
timeout: Long = 0L,
|
||||
interceptor: Interceptor? = null
|
||||
): Response {
|
||||
val client = baseClient
|
||||
.newBuilder()
|
||||
.followRedirects(allowRedirects)
|
||||
.followSslRedirects(allowRedirects)
|
||||
.callTimeout(timeout, TimeUnit.SECONDS)
|
||||
|
||||
if (interceptor != null) client.addInterceptor(interceptor)
|
||||
val request = getRequestCreator(url, headers, referer, params, cookies, cacheTime, cacheUnit)
|
||||
return client.build().newCall(request).execute()
|
||||
}
|
||||
|
||||
|
||||
fun post(
|
||||
url: String,
|
||||
headers: Map<String, String> = mapOf(),
|
||||
referer: String? = null,
|
||||
params: Map<String, String> = mapOf(),
|
||||
cookies: Map<String, String> = mapOf(),
|
||||
data: Map<String, String> = DEFAULT_DATA,
|
||||
allowRedirects: Boolean = true,
|
||||
cacheTime: Int = DEFAULT_TIME,
|
||||
cacheUnit: TimeUnit = DEFAULT_TIME_UNIT,
|
||||
timeout: Long = 0L
|
||||
): Response {
|
||||
val client = baseClient
|
||||
.newBuilder()
|
||||
.followRedirects(allowRedirects)
|
||||
.followSslRedirects(allowRedirects)
|
||||
.callTimeout(timeout, TimeUnit.SECONDS)
|
||||
.build()
|
||||
val request = postRequestCreator(url, headers, referer, params, cookies, data, cacheTime, cacheUnit)
|
||||
return client.newCall(request).execute()
|
||||
}
|
||||
|
||||
|
||||
fun getRequestCreator(
|
||||
url: String,
|
||||
headers: Map<String, String>,
|
||||
referer: String?,
|
||||
params: Map<String, String>,
|
||||
cookies: Map<String, String>,
|
||||
cacheTime: Int,
|
||||
cacheUnit: TimeUnit
|
||||
): Request {
|
||||
return Request.Builder()
|
||||
.url(addParamsToUrl(url, params))
|
||||
.cacheControl(getCache(cacheTime, cacheUnit))
|
||||
.headers(getHeaders(headers, referer, cookies))
|
||||
.build()
|
||||
}
|
||||
|
||||
fun postRequestCreator(
|
||||
url: String,
|
||||
headers: Map<String, String>,
|
||||
|
@ -194,6 +161,22 @@ fun postRequestCreator(
|
|||
.build()
|
||||
}
|
||||
|
||||
fun getRequestCreator(
|
||||
url: String,
|
||||
headers: Map<String, String>,
|
||||
referer: String?,
|
||||
params: Map<String, String>,
|
||||
cookies: Map<String, String>,
|
||||
cacheTime: Int,
|
||||
cacheUnit: TimeUnit
|
||||
): Request {
|
||||
return Request.Builder()
|
||||
.url(addParamsToUrl(url, params))
|
||||
.cacheControl(getCache(cacheTime, cacheUnit))
|
||||
.headers(getHeaders(headers, referer, cookies))
|
||||
.build()
|
||||
}
|
||||
|
||||
fun putRequestCreator(
|
||||
url: String,
|
||||
headers: Map<String, String>,
|
||||
|
@ -212,25 +195,103 @@ fun putRequestCreator(
|
|||
.build()
|
||||
}
|
||||
|
||||
open class Requests {
|
||||
var baseClient = OkHttpClient()
|
||||
|
||||
fun put(
|
||||
url: String,
|
||||
headers: Map<String, String> = mapOf(),
|
||||
referer: String? = null,
|
||||
params: Map<String, String> = mapOf(),
|
||||
cookies: Map<String, String> = mapOf(),
|
||||
data: Map<String, String?> = DEFAULT_DATA,
|
||||
allowRedirects: Boolean = true,
|
||||
cacheTime: Int = DEFAULT_TIME,
|
||||
cacheUnit: TimeUnit = DEFAULT_TIME_UNIT,
|
||||
timeout: Long = 0L
|
||||
): Response {
|
||||
val client = baseClient
|
||||
.newBuilder()
|
||||
.followRedirects(allowRedirects)
|
||||
.followSslRedirects(allowRedirects)
|
||||
.callTimeout(timeout, TimeUnit.SECONDS)
|
||||
.build()
|
||||
val request = putRequestCreator(url, headers, referer, params, cookies, data, cacheTime, cacheUnit)
|
||||
return client.newCall(request).execute()
|
||||
fun initClient(context: Context): OkHttpClient {
|
||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val dns = settingsManager.getInt(context.getString(R.string.dns_pref), 0)
|
||||
baseClient = OkHttpClient.Builder()
|
||||
.cache(
|
||||
// Note that you need to add a ResponseInterceptor to make this 100% active.
|
||||
// The server response dictates if and when stuff should be cached.
|
||||
Cache(
|
||||
directory = File(context.cacheDir, "http_cache"),
|
||||
maxSize = 50L * 1024L * 1024L // 50 MiB
|
||||
)
|
||||
).apply {
|
||||
when (dns) {
|
||||
1 -> addGoogleDns()
|
||||
2 -> addCloudFlareDns()
|
||||
// 3 -> addOpenDns()
|
||||
4 -> addAdGuardDns()
|
||||
}
|
||||
}
|
||||
// Needs to be build as otherwise the other builders will change this object
|
||||
.build()
|
||||
return baseClient
|
||||
}
|
||||
|
||||
fun get(
|
||||
url: String,
|
||||
headers: Map<String, String> = mapOf(),
|
||||
referer: String? = null,
|
||||
params: Map<String, String> = mapOf(),
|
||||
cookies: Map<String, String> = mapOf(),
|
||||
allowRedirects: Boolean = true,
|
||||
cacheTime: Int = DEFAULT_TIME,
|
||||
cacheUnit: TimeUnit = DEFAULT_TIME_UNIT,
|
||||
timeout: Long = 0L,
|
||||
interceptor: Interceptor? = null,
|
||||
): AppResponse {
|
||||
val client = baseClient
|
||||
.newBuilder()
|
||||
.followRedirects(allowRedirects)
|
||||
.followSslRedirects(allowRedirects)
|
||||
.callTimeout(timeout, TimeUnit.SECONDS)
|
||||
|
||||
if (interceptor != null) client.addInterceptor(interceptor)
|
||||
val request =
|
||||
getRequestCreator(url, headers, referer, params, cookies, cacheTime, cacheUnit)
|
||||
val response = client.build().newCall(request).execute()
|
||||
return AppResponse(response)
|
||||
}
|
||||
|
||||
fun post(
|
||||
url: String,
|
||||
headers: Map<String, String> = mapOf(),
|
||||
referer: String? = null,
|
||||
params: Map<String, String> = mapOf(),
|
||||
cookies: Map<String, String> = mapOf(),
|
||||
data: Map<String, String> = DEFAULT_DATA,
|
||||
allowRedirects: Boolean = true,
|
||||
cacheTime: Int = DEFAULT_TIME,
|
||||
cacheUnit: TimeUnit = DEFAULT_TIME_UNIT,
|
||||
timeout: Long = 0L,
|
||||
): AppResponse {
|
||||
val client = baseClient
|
||||
.newBuilder()
|
||||
.followRedirects(allowRedirects)
|
||||
.followSslRedirects(allowRedirects)
|
||||
.callTimeout(timeout, TimeUnit.SECONDS)
|
||||
.build()
|
||||
val request =
|
||||
postRequestCreator(url, headers, referer, params, cookies, data, cacheTime, cacheUnit)
|
||||
val response = client.newCall(request).execute()
|
||||
return AppResponse(response)
|
||||
}
|
||||
|
||||
fun put(
|
||||
url: String,
|
||||
headers: Map<String, String> = mapOf(),
|
||||
referer: String? = null,
|
||||
params: Map<String, String> = mapOf(),
|
||||
cookies: Map<String, String> = mapOf(),
|
||||
data: Map<String, String?> = DEFAULT_DATA,
|
||||
allowRedirects: Boolean = true,
|
||||
cacheTime: Int = DEFAULT_TIME,
|
||||
cacheUnit: TimeUnit = DEFAULT_TIME_UNIT,
|
||||
timeout: Long = 0L
|
||||
): AppResponse {
|
||||
val client = baseClient
|
||||
.newBuilder()
|
||||
.followRedirects(allowRedirects)
|
||||
.followSslRedirects(allowRedirects)
|
||||
.callTimeout(timeout, TimeUnit.SECONDS)
|
||||
.build()
|
||||
val request =
|
||||
putRequestCreator(url, headers, referer, params, cookies, data, cacheTime, cacheUnit)
|
||||
val response = client.newCall(request).execute()
|
||||
return AppResponse(response)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.net.http.SslError
|
|||
import android.webkit.*
|
||||
import com.lagradost.cloudstream3.AcraApplication
|
||||
import com.lagradost.cloudstream3.USER_AGENT
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.utils.Coroutines.main
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
@ -98,15 +99,15 @@ class WebViewResolver(val interceptUrl: Regex) : Interceptor {
|
|||
|
||||
webViewUrl.contains("recaptcha") -> super.shouldInterceptRequest(view, request)
|
||||
|
||||
request.method == "GET" -> get(
|
||||
request.method == "GET" -> app.get(
|
||||
webViewUrl,
|
||||
headers = request.requestHeaders
|
||||
).toWebResourceResponse()
|
||||
).response.toWebResourceResponse()
|
||||
|
||||
request.method == "POST" -> post(
|
||||
request.method == "POST" -> app.post(
|
||||
webViewUrl,
|
||||
headers = request.requestHeaders
|
||||
).toWebResourceResponse()
|
||||
).response.toWebResourceResponse()
|
||||
else -> return super.shouldInterceptRequest(view, request)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
@ -144,7 +145,7 @@ class WebViewResolver(val interceptUrl: Regex) : Interceptor {
|
|||
// 1. contentType. 2. charset
|
||||
val typeRegex = Regex("""(.*);(?:.*charset=(.*)(?:|;)|)""")
|
||||
return if (contentTypeValue != null) {
|
||||
val found = typeRegex.find(contentTypeValue ?: "")
|
||||
val found = typeRegex.find(contentTypeValue)
|
||||
val contentType = found?.groupValues?.getOrNull(1)?.ifBlank { null } ?: contentTypeValue
|
||||
val charset = found?.groupValues?.getOrNull(2)?.ifBlank { null }
|
||||
WebResourceResponse(contentType, charset, this.body?.byteStream())
|
||||
|
|
|
@ -7,9 +7,8 @@ import com.fasterxml.jackson.databind.json.JsonMapper
|
|||
import com.fasterxml.jackson.module.kotlin.KotlinModule
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.network.post
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.syncproviders.AccountManager
|
||||
import com.lagradost.cloudstream3.syncproviders.OAuth2API
|
||||
import com.lagradost.cloudstream3.syncproviders.OAuth2API.Companion.appString
|
||||
|
@ -217,7 +216,7 @@ class AniListApi(index: Int) : AccountManager(index), SyncAPI {
|
|||
)
|
||||
)
|
||||
|
||||
val res = post(
|
||||
val res = app.post(
|
||||
"https://graphql.anilist.co/",
|
||||
//headers = mapOf(),
|
||||
data = data,//(if (vars == null) mapOf("query" to q) else mapOf("query" to q, "variables" to vars))
|
||||
|
@ -323,7 +322,7 @@ class AniListApi(index: Int) : AccountManager(index), SyncAPI {
|
|||
}
|
||||
"""
|
||||
|
||||
val data = post(
|
||||
val data = app.post(
|
||||
"https://graphql.anilist.co",
|
||||
data = mapOf("query" to q),
|
||||
cacheTime = 0,
|
||||
|
@ -346,38 +345,10 @@ class AniListApi(index: Int) : AccountManager(index), SyncAPI {
|
|||
}
|
||||
|
||||
private fun Context.checkToken(): Boolean {
|
||||
if (unixTime > getKey(
|
||||
accountId,
|
||||
ANILIST_UNIXTIME_KEY, 0L
|
||||
)!!
|
||||
) {
|
||||
/*getCurrentActivity()?.runOnUiThread {
|
||||
val alertDialog: AlertDialog? = activity?.let {
|
||||
val builder = AlertDialog.Builder(it, R.style.AlertDialogCustom)
|
||||
builder.apply {
|
||||
setPositiveButton(
|
||||
"Login"
|
||||
) { dialog, id ->
|
||||
authenticateAniList()
|
||||
}
|
||||
setNegativeButton(
|
||||
"Cancel"
|
||||
) { dialog, id ->
|
||||
// User cancelled the dialog
|
||||
}
|
||||
}
|
||||
// Set other dialog properties
|
||||
builder.setTitle("AniList token has expired")
|
||||
|
||||
// Create the AlertDialog
|
||||
builder.create()
|
||||
}
|
||||
alertDialog?.show()
|
||||
}*/
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
return unixTime > getKey(
|
||||
accountId,
|
||||
ANILIST_UNIXTIME_KEY, 0L
|
||||
)!!
|
||||
}
|
||||
|
||||
fun Context.getDataAboutId(id: Int): AniListTitleHolder? {
|
||||
|
@ -443,7 +414,7 @@ class AniListApi(index: Int) : AccountManager(index), SyncAPI {
|
|||
return try {
|
||||
if (!checkToken()) {
|
||||
// println("VARS_ " + vars)
|
||||
post(
|
||||
app.post(
|
||||
"https://graphql.anilist.co/",
|
||||
headers = mapOf(
|
||||
"Authorization" to "Bearer " + getKey(
|
||||
|
|
|
@ -8,11 +8,8 @@ import com.fasterxml.jackson.databind.json.JsonMapper
|
|||
import com.fasterxml.jackson.module.kotlin.KotlinModule
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.post
|
||||
import com.lagradost.cloudstream3.network.put
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.syncproviders.AccountManager
|
||||
import com.lagradost.cloudstream3.syncproviders.OAuth2API
|
||||
import com.lagradost.cloudstream3.syncproviders.OAuth2API.Companion.appString
|
||||
|
@ -62,7 +59,7 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
|
|||
|
||||
override fun search(context: Context, name: String): List<SyncAPI.SyncSearchResult> {
|
||||
val url = "https://api.myanimelist.net/v2/anime?q=$name&limit=$MAL_MAX_SEARCH_LIMIT"
|
||||
var res = get(
|
||||
var res = app.get(
|
||||
url, headers = mapOf(
|
||||
"Authorization" to "Bearer " + context.getKey<String>(
|
||||
accountId,
|
||||
|
@ -130,7 +127,7 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
|
|||
var res = ""
|
||||
try {
|
||||
//println("cc::::: " + codeVerifier)
|
||||
res = post(
|
||||
res = app.post(
|
||||
"https://myanimelist.net/v1/oauth2/token",
|
||||
data = mapOf(
|
||||
"client_id" to key,
|
||||
|
@ -193,7 +190,7 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
|
|||
|
||||
private fun Context.refreshToken() {
|
||||
try {
|
||||
val res = post(
|
||||
val res = app.post(
|
||||
"https://myanimelist.net/v1/oauth2/token",
|
||||
data = mapOf(
|
||||
"client_id" to key,
|
||||
|
@ -337,7 +334,7 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
|
|||
// https://myanimelist.net/apiconfig/references/api/v2#operation/users_user_id_animelist_get
|
||||
val url =
|
||||
"https://api.myanimelist.net/v2/users/$user/animelist?fields=list_status,num_episodes,media_type,status,start_date,end_date,synopsis,alternative_titles,mean,genres,rank,num_list_users,nsfw,average_episode_duration,num_favorites,popularity,num_scoring_users,start_season,favorites_info,broadcast,created_at,updated_at&nsfw=1&limit=100&offset=$offset"
|
||||
val res = get(
|
||||
val res = app.get(
|
||||
url, headers = mapOf(
|
||||
"Authorization" to "Bearer " + getKey<String>(
|
||||
accountId,
|
||||
|
@ -356,7 +353,7 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
|
|||
return try {
|
||||
// https://myanimelist.net/apiconfig/references/api/v2#operation/anime_anime_id_get
|
||||
val url = "https://api.myanimelist.net/v2/anime/$id?fields=id,title,num_episodes,my_list_status"
|
||||
val res = get(
|
||||
val res = app.get(
|
||||
url, headers = mapOf(
|
||||
"Authorization" to "Bearer " + getKey<String>(
|
||||
accountId,
|
||||
|
@ -377,7 +374,7 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
|
|||
allTitles.clear()
|
||||
checkMalToken()
|
||||
while (!isDone) {
|
||||
val res = get(
|
||||
val res = app.get(
|
||||
"https://api.myanimelist.net/v2/users/$user/animelist?fields=list_status&limit=1000&offset=${index * 1000}",
|
||||
headers = mapOf(
|
||||
"Authorization" to "Bearer " + getKey<String>(
|
||||
|
@ -447,7 +444,7 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
|
|||
private fun Context.getMalUser(setSettings: Boolean = true): MalUser? {
|
||||
checkMalToken()
|
||||
return try {
|
||||
val res = get(
|
||||
val res = app.get(
|
||||
"https://api.myanimelist.net/v2/users/@me",
|
||||
headers = mapOf(
|
||||
"Authorization" to "Bearer " + getKey<String>(
|
||||
|
@ -529,7 +526,7 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
|
|||
num_watched_episodes: Int? = null,
|
||||
): String {
|
||||
return try {
|
||||
put(
|
||||
app.put(
|
||||
"https://api.myanimelist.net/v2/anime/$id/my_list_status",
|
||||
headers = mapOf(
|
||||
"Authorization" to "Bearer " + getKey<String>(
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.lagradost.cloudstream3.torrentproviders
|
||||
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
|
@ -25,7 +24,7 @@ class NyaaProvider : MainAPI() {
|
|||
|
||||
override fun search(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/?f=0&c=0_0&q=$query&s=seeders&o=desc"
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
|
||||
val returnValues = ArrayList<SearchResponse>()
|
||||
|
@ -45,7 +44,7 @@ class NyaaProvider : MainAPI() {
|
|||
}
|
||||
|
||||
override fun load(url: String): LoadResponse {
|
||||
val response = get(url).text
|
||||
val response = app.get(url).text
|
||||
val document = Jsoup.parse(response)
|
||||
val title = document.selectFirst("h3.panel-title").text()
|
||||
val description = document.selectFirst("div#torrent-description").text()
|
||||
|
|
|
@ -28,8 +28,8 @@ import com.lagradost.cloudstream3.DubStatus
|
|||
import com.lagradost.cloudstream3.MainActivity.Companion.setLocale
|
||||
import com.lagradost.cloudstream3.MainActivity.Companion.showToast
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.network.initRequestClient
|
||||
import com.lagradost.cloudstream3.syncproviders.AccountManager
|
||||
import com.lagradost.cloudstream3.syncproviders.OAuth2API
|
||||
import com.lagradost.cloudstream3.syncproviders.OAuth2API.Companion.aniListApi
|
||||
|
@ -350,9 +350,9 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
.putInt(getString(R.string.preferred_media_settings), prefValues[it])
|
||||
.apply()
|
||||
val apilist = AppUtils.filterProviderByPreferredMedia(apis, prefValues[it])
|
||||
val apiRandom = if (apilist?.size > 0) { apilist.random().name } else { "" }
|
||||
val apiRandom = if (apilist.size > 0) { apilist.random().name } else { "" }
|
||||
context?.setKey(HOMEPAGE_API, apiRandom)
|
||||
context?.initRequestClient()
|
||||
(context ?: AcraApplication.context)?.let { ctx -> app.initClient(ctx) }
|
||||
}
|
||||
return@setOnPreferenceClickListener true
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
true,
|
||||
{}) {
|
||||
settingsManager.edit().putInt(getString(R.string.dns_pref), prefValues[it]).apply()
|
||||
context?.initRequestClient()
|
||||
(context ?: AcraApplication.context)?.let { ctx -> app.initClient(ctx) }
|
||||
}
|
||||
return@setOnPreferenceClickListener true
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.lagradost.cloudstream3.utils
|
||||
|
||||
import com.lagradost.cloudstream3.USER_AGENT
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.extractors.*
|
||||
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
||||
import com.lagradost.cloudstream3.network.post
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
|
@ -126,7 +126,7 @@ fun getPostForm(requestUrl : String, html : String) : String? {
|
|||
}
|
||||
Thread.sleep(5000) // ye this is needed, wont work with 0 delay
|
||||
|
||||
val postResponse = post(
|
||||
val postResponse = app.post(
|
||||
requestUrl,
|
||||
headers = mapOf(
|
||||
"content-type" to "application/x-www-form-urlencoded",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.lagradost.cloudstream3.utils
|
||||
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import org.jsoup.Jsoup
|
||||
import java.util.*
|
||||
|
@ -18,7 +18,7 @@ object FillerEpisodeCheck {
|
|||
private fun getFillerList(): Boolean {
|
||||
if (list != null) return true
|
||||
try {
|
||||
val result = get("$MAIN_URL/shows").text
|
||||
val result = app.get("$MAIN_URL/shows").text
|
||||
val documented = Jsoup.parse(result)
|
||||
val localHTMLList = documented.select("div#ShowList > div.Group > ul > li > a")
|
||||
val localList = HashMap<String, String>()
|
||||
|
@ -73,7 +73,7 @@ object FillerEpisodeCheck {
|
|||
val realQuery = fixName(query.replace(blackListRegex, "")).replace("shippuuden", "shippuden")
|
||||
if (!localList.containsKey(realQuery)) return null
|
||||
val href = localList[realQuery]?.replace(MAIN_URL, "") ?: return null // JUST IN CASE
|
||||
val result = get("$MAIN_URL$href").text
|
||||
val result = app.get("$MAIN_URL$href").text
|
||||
val documented = Jsoup.parse(result) ?: return null
|
||||
val hashMap = HashMap<Int, Boolean>()
|
||||
documented.select("table.EpisodeList > tbody > tr").forEach {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.lagradost.cloudstream3.utils
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.GlideBuilder
|
||||
|
@ -9,13 +10,15 @@ import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader
|
|||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.bumptech.glide.load.model.GlideUrl
|
||||
import com.bumptech.glide.module.AppGlideModule
|
||||
import com.bumptech.glide.request.Request
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.bumptech.glide.signature.ObjectKey
|
||||
import com.lagradost.cloudstream3.network.initRequestClient
|
||||
import com.lagradost.cloudstream3.network.Requests
|
||||
import java.io.InputStream
|
||||
|
||||
@GlideModule
|
||||
class GlideModule : AppGlideModule() {
|
||||
@SuppressLint("CheckResult")
|
||||
override fun applyOptions(context: Context, builder: GlideBuilder) {
|
||||
super.applyOptions(context, builder)
|
||||
builder.apply {
|
||||
|
@ -28,7 +31,7 @@ class GlideModule : AppGlideModule() {
|
|||
// Needed for DOH
|
||||
// https://stackoverflow.com/a/61634041
|
||||
override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
|
||||
val client = context.initRequestClient()
|
||||
val client = Requests().initClient(context)
|
||||
registry.replace(
|
||||
GlideUrl::class.java,
|
||||
InputStream::class.java,
|
||||
|
|
|
@ -21,9 +21,9 @@ import com.fasterxml.jackson.module.kotlin.readValue
|
|||
import com.lagradost.cloudstream3.BuildConfig
|
||||
import com.lagradost.cloudstream3.MainActivity.Companion.showToast
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import java.io.File
|
||||
import kotlin.concurrent.thread
|
||||
|
@ -84,7 +84,7 @@ class InAppUpdater {
|
|||
val url = "https://api.github.com/repos/LagradOst/CloudStream-3/releases"
|
||||
val headers = mapOf("Accept" to "application/vnd.github.v3+json")
|
||||
val response =
|
||||
mapper.readValue<List<GithubRelease>>(get(url, headers = headers).text)
|
||||
mapper.readValue<List<GithubRelease>>(app.get(url, headers = headers).text)
|
||||
|
||||
val versionRegex = Regex("""(.*?((\d+)\.(\d+)\.(\d+))\.apk)""")
|
||||
val versionRegexLocal = Regex("""(.*?((\d+)\.(\d+)\.(\d+)).*)""")
|
||||
|
@ -140,7 +140,7 @@ class InAppUpdater {
|
|||
val releaseUrl = "https://api.github.com/repos/LagradOst/CloudStream-3/releases"
|
||||
val headers = mapOf("Accept" to "application/vnd.github.v3+json")
|
||||
val response =
|
||||
mapper.readValue<List<GithubRelease>>(get(releaseUrl, headers = headers).text)
|
||||
mapper.readValue<List<GithubRelease>>(app.get(releaseUrl, headers = headers).text)
|
||||
|
||||
val found =
|
||||
response.lastOrNull { rel ->
|
||||
|
@ -149,7 +149,7 @@ class InAppUpdater {
|
|||
val foundAsset = found?.assets?.getOrNull(0)
|
||||
|
||||
val tagResponse =
|
||||
mapper.readValue<GithubTag>(get(tagUrl, headers = headers).text)
|
||||
mapper.readValue<GithubTag>(app.get(tagUrl, headers = headers).text)
|
||||
|
||||
val shouldUpdate = (getString(R.string.prerelease_commit_hash) != tagResponse.github_object.sha)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.lagradost.cloudstream3.utils
|
||||
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import javax.crypto.Cipher
|
||||
import javax.crypto.spec.IvParameterSpec
|
||||
|
@ -82,7 +82,7 @@ class M3u8Helper {
|
|||
fun m3u8Generation(m3u8: M3u8Stream, returnThis: Boolean): List<M3u8Stream> {
|
||||
val generate = sequence {
|
||||
val m3u8Parent = getParentLink(m3u8.streamUrl)
|
||||
val response = get(m3u8.streamUrl, headers = m3u8.headers).text
|
||||
val response = app.get(m3u8.streamUrl, headers = m3u8.headers).text
|
||||
|
||||
for (match in QUALITY_REGEX.findAll(response)) {
|
||||
var (quality, m3u8Link, m3u8Link2) = match.destructured
|
||||
|
@ -146,7 +146,7 @@ class M3u8Helper {
|
|||
|
||||
val secondSelection = selectBest(streams.ifEmpty { listOf(selected) })
|
||||
if (secondSelection != null) {
|
||||
val m3u8Response = get(secondSelection.streamUrl, headers = headers).text
|
||||
val m3u8Response = app.get(secondSelection.streamUrl, headers = headers).text
|
||||
|
||||
var encryptionUri: String?
|
||||
var encryptionIv = byteArrayOf()
|
||||
|
@ -164,7 +164,7 @@ class M3u8Helper {
|
|||
}
|
||||
|
||||
encryptionIv = match.component3().toByteArray()
|
||||
val encryptionKeyResponse = get(encryptionUri, headers = headers)
|
||||
val encryptionKeyResponse = app.get(encryptionUri, headers = headers)
|
||||
encryptionData = encryptionKeyResponse.body?.bytes() ?: byteArrayOf()
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ class M3u8Helper {
|
|||
|
||||
while (lastYield != c) {
|
||||
try {
|
||||
val tsResponse = get(url, headers = headers)
|
||||
val tsResponse = app.get(url, headers = headers)
|
||||
var tsData = tsResponse.body?.bytes() ?: byteArrayOf()
|
||||
|
||||
if (encryptionState) {
|
||||
|
|
|
@ -2,9 +2,9 @@ package com.lagradost.cloudstream3.utils
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.fasterxml.jackson.module.kotlin.readValue
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.mapper
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.network.get
|
||||
import com.lagradost.cloudstream3.network.text
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
@ -16,7 +16,7 @@ object SyncUtil {
|
|||
//Gogoanime, Twistmoe and 9anime
|
||||
val url =
|
||||
"https://raw.githubusercontent.com/MALSync/MAL-Sync-Backup/master/data/pages/$site/$slug.json"
|
||||
val response = get(url, cacheTime = 1, cacheUnit = TimeUnit.DAYS).text
|
||||
val response = app.get(url, cacheTime = 1, cacheUnit = TimeUnit.DAYS).text
|
||||
val mapped = mapper.readValue<MalSyncPage?>(response)
|
||||
|
||||
val overrideMal = mapped?.malId ?: mapped?.Mal?.id ?: mapped?.Anilist?.malId
|
||||
|
|
Loading…
Reference in a new issue