forked from recloudstream/cloudstream
fixed nicehttp
This commit is contained in:
parent
d4d083b3c3
commit
eb36315b04
6 changed files with 75 additions and 68 deletions
|
@ -156,7 +156,7 @@ dependencies {
|
|||
// Networking
|
||||
// implementation "com.squareup.okhttp3:okhttp:4.9.2"
|
||||
// implementation "com.squareup.okhttp3:okhttp-dnsoverhttps:4.9.1"
|
||||
implementation 'com.github.Blatzar:NiceHttp:0.1.8'
|
||||
implementation 'com.github.Blatzar:NiceHttp:0.2.0'
|
||||
|
||||
// Util to skip the URI file fuckery 🙏
|
||||
implementation "com.github.tachiyomiorg:unifile:17bec43"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <!-- Used for player vertical slide-->
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <!--Used for app update-->
|
||||
<!--<uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" /> not used atm, but code exist that requires it that are not run-->
|
||||
<permission android:name="android.permission.QUERY_ALL_PACKAGES" /> <!-- Used for getting if vlc is installed -->
|
||||
<!-- <permission android:name="android.permission.QUERY_ALL_PACKAGES" /> <!– Used for getting if vlc is installed –>-->
|
||||
|
||||
<!-- Fixes android tv fuckery -->
|
||||
<uses-feature
|
||||
|
|
|
@ -478,7 +478,7 @@ open class SflixProvider : MainAPI() {
|
|||
val data = negotiateNewSid(extractorData) ?: return null to null
|
||||
app.post(
|
||||
"$extractorData&t=${generateTimeStamp()}&sid=${data.sid}",
|
||||
data = 40, headers = headers
|
||||
json = "40", headers = headers
|
||||
)
|
||||
|
||||
// This makes the second get request work, and re-connect work.
|
||||
|
@ -542,7 +542,7 @@ open class SflixProvider : MainAPI() {
|
|||
val url = "${extractorData}&t=${generateTimeStamp()}&sid=${data.sid}"
|
||||
|
||||
getUpdatedData(
|
||||
app.post(url, data = authData, headers = headers),
|
||||
app.post(url, json = authData, headers = headers),
|
||||
data,
|
||||
extractorData
|
||||
).also {
|
||||
|
@ -655,7 +655,7 @@ open class SflixProvider : MainAPI() {
|
|||
extractorData?.let { negotiateNewSid(it) }?.also {
|
||||
app.post(
|
||||
"$extractorData&t=${generateTimeStamp()}&sid=${it.sid}",
|
||||
data = "40",
|
||||
json = "40",
|
||||
timeout = 60
|
||||
)
|
||||
val text = app.get(
|
||||
|
|
|
@ -3,12 +3,12 @@ package com.lagradost.cloudstream3.movieproviders
|
|||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.utils.*
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
import org.jsoup.Jsoup
|
||||
import java.util.*
|
||||
|
||||
class SoaptwoDayProvider:MainAPI() {
|
||||
class SoaptwoDayProvider : MainAPI() {
|
||||
override var mainUrl = "https://secretlink.xyz" //Probably a rip off, but it has no captcha
|
||||
override var name = "Soap2Day"
|
||||
override val hasMainPage = true
|
||||
|
@ -18,6 +18,7 @@ class SoaptwoDayProvider:MainAPI() {
|
|||
TvType.Movie,
|
||||
TvType.TvSeries,
|
||||
)
|
||||
|
||||
override suspend fun getMainPage(): HomePageResponse {
|
||||
val items = ArrayList<HomePageList>()
|
||||
val urls = listOf(
|
||||
|
@ -27,7 +28,9 @@ class SoaptwoDayProvider:MainAPI() {
|
|||
for ((url, name) in urls) {
|
||||
try {
|
||||
val soup = app.get(url).document
|
||||
val home = soup.select("div.container div.row div.col-sm-12.col-lg-12 div.row div.col-sm-12.col-lg-12 .col-xs-6").map {
|
||||
val home =
|
||||
soup.select("div.container div.row div.col-sm-12.col-lg-12 div.row div.col-sm-12.col-lg-12 .col-xs-6")
|
||||
.map {
|
||||
val title = it.selectFirst("h5 a")!!.text()
|
||||
val link = it.selectFirst("a")!!.attr("href")
|
||||
TvSeriesSearchResponse(
|
||||
|
@ -51,7 +54,8 @@ class SoaptwoDayProvider:MainAPI() {
|
|||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val doc = app.get("$mainUrl/search/keyword/$query").document
|
||||
return doc.select("div.container div.row div.col-sm-12.col-lg-12 div.row div.col-sm-12.col-lg-12 .col-xs-6").map {
|
||||
return doc.select("div.container div.row div.col-sm-12.col-lg-12 div.row div.col-sm-12.col-lg-12 .col-xs-6")
|
||||
.map {
|
||||
val title = it.selectFirst("h5 a")!!.text()
|
||||
val image = fixUrl(it.selectFirst("img")!!.attr("src"))
|
||||
val href = fixUrl(it.selectFirst("a")!!.attr("href"))
|
||||
|
@ -71,14 +75,15 @@ class SoaptwoDayProvider:MainAPI() {
|
|||
val soup = app.get(url).document
|
||||
val title = soup.selectFirst(".hidden-lg > div:nth-child(1) > h4")?.text() ?: ""
|
||||
val description = soup.selectFirst("p#wrap")?.text()?.trim()
|
||||
val poster = soup.selectFirst(".col-md-5 > div:nth-child(1) > div:nth-child(1) > img")?.attr("src")
|
||||
val poster =
|
||||
soup.selectFirst(".col-md-5 > div:nth-child(1) > div:nth-child(1) > img")?.attr("src")
|
||||
val episodes = mutableListOf<Episode>()
|
||||
soup.select("div.alert").forEach {
|
||||
val season = it?.selectFirst("h4")?.text()?.filter { c -> c.isDigit() }?.toIntOrNull()
|
||||
it?.select("div > div > a")?.forEach { entry ->
|
||||
val link = fixUrlNull(entry?.attr("href")) ?: return@forEach
|
||||
val text = entry?.text() ?: ""
|
||||
val name = text.replace(Regex("(^(\\d+)\\.)"),"")
|
||||
val name = text.replace(Regex("(^(\\d+)\\.)"), "")
|
||||
val epNum = text.substring(0, text.indexOf(".")).toIntOrNull()
|
||||
episodes.add(
|
||||
Episode(
|
||||
|
@ -149,7 +154,7 @@ class SoaptwoDayProvider:MainAPI() {
|
|||
}
|
||||
}
|
||||
|
||||
data class ServerJson (
|
||||
data class ServerJson(
|
||||
@JsonProperty("0") val zero: String?,
|
||||
@JsonProperty("key") val key: Boolean?,
|
||||
@JsonProperty("val") val stream: String?,
|
||||
|
@ -163,7 +168,7 @@ class SoaptwoDayProvider:MainAPI() {
|
|||
@JsonProperty("next_epi_url") val nextEpiUrl: String?
|
||||
)
|
||||
|
||||
data class Subs (
|
||||
data class Subs(
|
||||
@JsonProperty("id") val id: Int?,
|
||||
@JsonProperty("movieId") val movieId: Int?,
|
||||
@JsonProperty("tvId") val tvId: Int?,
|
||||
|
@ -188,16 +193,19 @@ class SoaptwoDayProvider:MainAPI() {
|
|||
val idplayer2 = doc.selectFirst("#divP")?.text()
|
||||
val movieid = doc.selectFirst("div.row input#hId")!!.attr("value")
|
||||
val tvType = try {
|
||||
doc.selectFirst(".col-md-5 > div:nth-child(1) > div:nth-child(1) > img")!!.attr("src") ?: ""
|
||||
doc.selectFirst(".col-md-5 > div:nth-child(1) > div:nth-child(1) > img")!!.attr("src")
|
||||
?: ""
|
||||
} catch (e: Exception) {
|
||||
""
|
||||
}
|
||||
val ajaxlink = if (tvType.contains("movie")) "$mainUrl/home/index/GetMInfoAjax" else "$mainUrl/home/index/GetEInfoAjax"
|
||||
val ajaxlink =
|
||||
if (tvType.contains("movie")) "$mainUrl/home/index/GetMInfoAjax" else "$mainUrl/home/index/GetEInfoAjax"
|
||||
listOf(
|
||||
idplayer,
|
||||
idplayer2,
|
||||
).mapNotNull { playerID ->
|
||||
val url = app.post(ajaxlink,
|
||||
val url = app.post(
|
||||
ajaxlink,
|
||||
headers = mapOf(
|
||||
"Host" to "secretlink.xyz",
|
||||
"User-Agent" to USER_AGENT,
|
||||
|
@ -211,32 +219,35 @@ class SoaptwoDayProvider:MainAPI() {
|
|||
"Referer" to data,
|
||||
"Sec-Fetch-Dest" to "empty",
|
||||
"Sec-Fetch-Mode" to "cors",
|
||||
"Sec-Fetch-Site" to "same-origin",),
|
||||
"Sec-Fetch-Site" to "same-origin",
|
||||
),
|
||||
data = mapOf(
|
||||
Pair("pass",movieid),
|
||||
Pair("param",playerID),
|
||||
Pair("pass", movieid),
|
||||
Pair("param", playerID ?: ""),
|
||||
)
|
||||
).text.replace("\\\"","\"").replace("\"{","{").replace("}\"","}")
|
||||
.replace("\\\\\\/","\\/")
|
||||
).text.replace("\\\"", "\"").replace("\"{", "{").replace("}\"", "}")
|
||||
.replace("\\\\\\/", "\\/")
|
||||
val json = parseJson<ServerJson>(url)
|
||||
listOfNotNull(
|
||||
json.stream,
|
||||
json.streambackup
|
||||
).apmap { stream ->
|
||||
val cleanstreamurl = stream.replace("\\/","/").replace("\\\\\\","")
|
||||
val cleanstreamurl = stream.replace("\\/", "/").replace("\\\\\\", "")
|
||||
if (cleanstreamurl.isNotBlank()) {
|
||||
callback(ExtractorLink(
|
||||
callback(
|
||||
ExtractorLink(
|
||||
"Soap2Day",
|
||||
"Soap2Day",
|
||||
cleanstreamurl,
|
||||
"https://soap2day.ac",
|
||||
Qualities.Unknown.value,
|
||||
isM3u8 = false
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
json.subs?.forEach { subtitle ->
|
||||
val sublink = mainUrl+subtitle.path
|
||||
val sublink = mainUrl + subtitle.path
|
||||
listOf(
|
||||
sublink,
|
||||
subtitle.downlink
|
||||
|
|
|
@ -211,12 +211,6 @@ class WebViewResolver(val interceptUrl: Regex, val additionalUrls: List<Regex> =
|
|||
this.method,
|
||||
webViewUrl,
|
||||
this.requestHeaders,
|
||||
null,
|
||||
emptyMap(),
|
||||
emptyMap(),
|
||||
null,
|
||||
10,
|
||||
TimeUnit.MINUTES
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -613,16 +613,18 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
|
|||
score: Int? = null,
|
||||
num_watched_episodes: Int? = null,
|
||||
): String? {
|
||||
val data = mapOf(
|
||||
"status" to status,
|
||||
"score" to score?.toString(),
|
||||
"num_watched_episodes" to num_watched_episodes?.toString()
|
||||
).filter { it.value != null } as Map<String, String>
|
||||
|
||||
return app.put(
|
||||
"https://api.myanimelist.net/v2/anime/$id/my_list_status",
|
||||
headers = mapOf(
|
||||
"Authorization" to "Bearer " + (getAuth() ?: return null)
|
||||
),
|
||||
data = mapOf(
|
||||
"status" to status,
|
||||
"score" to score?.toString(),
|
||||
"num_watched_episodes" to num_watched_episodes?.toString()
|
||||
)
|
||||
data = data
|
||||
).text
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue