Unsplit gogo m3u8 to fix audio issues

This commit is contained in:
Blatzar 2022-06-22 23:22:06 +02:00
parent f3e7163436
commit 000cbfcbdc

View file

@ -4,7 +4,10 @@ import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
import com.lagradost.cloudstream3.mvvm.safeApiCall import com.lagradost.cloudstream3.mvvm.safeApiCall
import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.AppUtils
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.getQualityFromName
import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.Jsoup import org.jsoup.Jsoup
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import java.net.URI import java.net.URI
@ -138,16 +141,6 @@ class GogoanimeProvider : MainAPI() {
source: GogoSource, source: GogoSource,
sourceCallback: (ExtractorLink) -> Unit sourceCallback: (ExtractorLink) -> Unit
) { ) {
when {
source.file.contains("m3u8") -> {
M3u8Helper.generateM3u8(
mainApiName,
source.file,
mainUrl,
headers = mapOf("Referer" to "https://gogoplay4.com")
).forEach(sourceCallback)
}
source.file.contains("vidstreaming") -> {
sourceCallback.invoke( sourceCallback.invoke(
ExtractorLink( ExtractorLink(
mainApiName, mainApiName,
@ -155,24 +148,13 @@ class GogoanimeProvider : MainAPI() {
source.file, source.file,
mainUrl, mainUrl,
getQualityFromName(source.label), getQualityFromName(source.label),
isM3u8 = source.type == "hls" isM3u8 = source.type == "hls" || source.label?.contains(
"auto",
ignoreCase = true
) == true
) )
) )
} }
else -> {
sourceCallback.invoke(
ExtractorLink(
mainApiName,
mainApiName,
source.file,
mainUrl,
getQualityFromName(source.label),
isM3u8 = source.type == "hls"
)
)
}
}
}
sources.source?.forEach { sources.source?.forEach {
invokeGogoSource(it, callback) invokeGogoSource(it, callback)
@ -279,8 +261,7 @@ class GogoanimeProvider : MainAPI() {
override suspend fun load(url: String): LoadResponse { override suspend 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 = app.get(link).text val doc = app.get(link).document
val doc = Jsoup.parse(html)
val animeBody = doc.selectFirst(".anime_info_body_bg") val animeBody = doc.selectFirst(".anime_info_body_bg")
val title = animeBody?.selectFirst("h1")!!.text() val title = animeBody?.selectFirst("h1")!!.text()
@ -391,7 +372,7 @@ class GogoanimeProvider : MainAPI() {
val streamingDocument = streamingResponse.document val streamingDocument = streamingResponse.document
argamap({ argamap({
streamingDocument.select(".list-server-items > .linkserver") streamingDocument.select(".list-server-items > .linkserver")
?.forEach { element -> .forEach { element ->
val status = element.attr("data-status") ?: return@forEach val status = element.attr("data-status") ?: return@forEach
if (status != "1") return@forEach if (status != "1") return@forEach
val data = element.attr("data-video") ?: return@forEach val data = element.attr("data-video") ?: return@forEach