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