fixed nicehttp

This commit is contained in:
Blatzar 2022-05-12 17:04:30 +02:00
parent d4d083b3c3
commit eb36315b04
6 changed files with 75 additions and 68 deletions

View file

@ -156,7 +156,7 @@ dependencies {
// Networking // Networking
// implementation "com.squareup.okhttp3:okhttp:4.9.2" // implementation "com.squareup.okhttp3:okhttp:4.9.2"
// implementation "com.squareup.okhttp3:okhttp-dnsoverhttps:4.9.1" // 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 🙏 // Util to skip the URI file fuckery 🙏
implementation "com.github.tachiyomiorg:unifile:17bec43" implementation "com.github.tachiyomiorg:unifile:17bec43"

View file

@ -11,7 +11,7 @@
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <!-- Used for player vertical slide--> <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="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--> <!--<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" /> &lt;!&ndash; Used for getting if vlc is installed &ndash;&gt;-->
<!-- Fixes android tv fuckery --> <!-- Fixes android tv fuckery -->
<uses-feature <uses-feature

View file

@ -478,7 +478,7 @@ open class SflixProvider : MainAPI() {
val data = negotiateNewSid(extractorData) ?: return null to null val data = negotiateNewSid(extractorData) ?: return null to null
app.post( app.post(
"$extractorData&t=${generateTimeStamp()}&sid=${data.sid}", "$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. // 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}" val url = "${extractorData}&t=${generateTimeStamp()}&sid=${data.sid}"
getUpdatedData( getUpdatedData(
app.post(url, data = authData, headers = headers), app.post(url, json = authData, headers = headers),
data, data,
extractorData extractorData
).also { ).also {
@ -655,7 +655,7 @@ open class SflixProvider : MainAPI() {
extractorData?.let { negotiateNewSid(it) }?.also { extractorData?.let { negotiateNewSid(it) }?.also {
app.post( app.post(
"$extractorData&t=${generateTimeStamp()}&sid=${it.sid}", "$extractorData&t=${generateTimeStamp()}&sid=${it.sid}",
data = "40", json = "40",
timeout = 60 timeout = 60
) )
val text = app.get( val text = app.get(

View file

@ -3,10 +3,10 @@ package com.lagradost.cloudstream3.movieproviders
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.mvvm.logError import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
import org.jsoup.Jsoup 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 mainUrl = "https://secretlink.xyz" //Probably a rip off, but it has no captcha
@ -18,6 +18,7 @@ class SoaptwoDayProvider:MainAPI() {
TvType.Movie, TvType.Movie,
TvType.TvSeries, TvType.TvSeries,
) )
override suspend fun getMainPage(): HomePageResponse { override suspend fun getMainPage(): HomePageResponse {
val items = ArrayList<HomePageList>() val items = ArrayList<HomePageList>()
val urls = listOf( val urls = listOf(
@ -27,7 +28,9 @@ class SoaptwoDayProvider:MainAPI() {
for ((url, name) in urls) { for ((url, name) in urls) {
try { try {
val soup = app.get(url).document 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 title = it.selectFirst("h5 a")!!.text()
val link = it.selectFirst("a")!!.attr("href") val link = it.selectFirst("a")!!.attr("href")
TvSeriesSearchResponse( TvSeriesSearchResponse(
@ -51,7 +54,8 @@ class SoaptwoDayProvider:MainAPI() {
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val doc = app.get("$mainUrl/search/keyword/$query").document 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 title = it.selectFirst("h5 a")!!.text()
val image = fixUrl(it.selectFirst("img")!!.attr("src")) val image = fixUrl(it.selectFirst("img")!!.attr("src"))
val href = fixUrl(it.selectFirst("a")!!.attr("href")) val href = fixUrl(it.selectFirst("a")!!.attr("href"))
@ -71,7 +75,8 @@ class SoaptwoDayProvider:MainAPI() {
val soup = app.get(url).document val soup = app.get(url).document
val title = soup.selectFirst(".hidden-lg > div:nth-child(1) > h4")?.text() ?: "" val title = soup.selectFirst(".hidden-lg > div:nth-child(1) > h4")?.text() ?: ""
val description = soup.selectFirst("p#wrap")?.text()?.trim() 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>() val episodes = mutableListOf<Episode>()
soup.select("div.alert").forEach { soup.select("div.alert").forEach {
val season = it?.selectFirst("h4")?.text()?.filter { c -> c.isDigit() }?.toIntOrNull() val season = it?.selectFirst("h4")?.text()?.filter { c -> c.isDigit() }?.toIntOrNull()
@ -188,16 +193,19 @@ class SoaptwoDayProvider:MainAPI() {
val idplayer2 = doc.selectFirst("#divP")?.text() val idplayer2 = doc.selectFirst("#divP")?.text()
val movieid = doc.selectFirst("div.row input#hId")!!.attr("value") val movieid = doc.selectFirst("div.row input#hId")!!.attr("value")
val tvType = try { 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) { } 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( listOf(
idplayer, idplayer,
idplayer2, idplayer2,
).mapNotNull { playerID -> ).mapNotNull { playerID ->
val url = app.post(ajaxlink, val url = app.post(
ajaxlink,
headers = mapOf( headers = mapOf(
"Host" to "secretlink.xyz", "Host" to "secretlink.xyz",
"User-Agent" to USER_AGENT, "User-Agent" to USER_AGENT,
@ -211,10 +219,11 @@ class SoaptwoDayProvider:MainAPI() {
"Referer" to data, "Referer" to data,
"Sec-Fetch-Dest" to "empty", "Sec-Fetch-Dest" to "empty",
"Sec-Fetch-Mode" to "cors", "Sec-Fetch-Mode" to "cors",
"Sec-Fetch-Site" to "same-origin",), "Sec-Fetch-Site" to "same-origin",
),
data = mapOf( data = mapOf(
Pair("pass", movieid), Pair("pass", movieid),
Pair("param",playerID), Pair("param", playerID ?: ""),
) )
).text.replace("\\\"", "\"").replace("\"{", "{").replace("}\"", "}") ).text.replace("\\\"", "\"").replace("\"{", "{").replace("}\"", "}")
.replace("\\\\\\/", "\\/") .replace("\\\\\\/", "\\/")
@ -225,14 +234,16 @@ class SoaptwoDayProvider:MainAPI() {
).apmap { stream -> ).apmap { stream ->
val cleanstreamurl = stream.replace("\\/", "/").replace("\\\\\\", "") val cleanstreamurl = stream.replace("\\/", "/").replace("\\\\\\", "")
if (cleanstreamurl.isNotBlank()) { if (cleanstreamurl.isNotBlank()) {
callback(ExtractorLink( callback(
ExtractorLink(
"Soap2Day", "Soap2Day",
"Soap2Day", "Soap2Day",
cleanstreamurl, cleanstreamurl,
"https://soap2day.ac", "https://soap2day.ac",
Qualities.Unknown.value, Qualities.Unknown.value,
isM3u8 = false isM3u8 = false
)) )
)
} }
} }
json.subs?.forEach { subtitle -> json.subs?.forEach { subtitle ->

View file

@ -211,12 +211,6 @@ class WebViewResolver(val interceptUrl: Regex, val additionalUrls: List<Regex> =
this.method, this.method,
webViewUrl, webViewUrl,
this.requestHeaders, this.requestHeaders,
null,
emptyMap(),
emptyMap(),
null,
10,
TimeUnit.MINUTES
) )
} }

View file

@ -613,16 +613,18 @@ class MALApi(index: Int) : AccountManager(index), SyncAPI {
score: Int? = null, score: Int? = null,
num_watched_episodes: Int? = null, num_watched_episodes: Int? = null,
): String? { ): 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( return 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 " + (getAuth() ?: return null) "Authorization" to "Bearer " + (getAuth() ?: return null)
), ),
data = mapOf( data = data
"status" to status,
"score" to score?.toString(),
"num_watched_episodes" to num_watched_episodes?.toString()
)
).text ).text
} }