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,40 +141,19 @@ class GogoanimeProvider : MainAPI() {
source: GogoSource, source: GogoSource,
sourceCallback: (ExtractorLink) -> Unit sourceCallback: (ExtractorLink) -> Unit
) { ) {
when { sourceCallback.invoke(
source.file.contains("m3u8") -> { ExtractorLink(
M3u8Helper.generateM3u8( mainApiName,
mainApiName, mainApiName,
source.file, source.file,
mainUrl, mainUrl,
headers = mapOf("Referer" to "https://gogoplay4.com") getQualityFromName(source.label),
).forEach(sourceCallback) isM3u8 = source.type == "hls" || source.label?.contains(
} "auto",
source.file.contains("vidstreaming") -> { ignoreCase = true
sourceCallback.invoke( ) == true
ExtractorLink( )
mainApiName, )
mainApiName,
source.file,
mainUrl,
getQualityFromName(source.label),
isM3u8 = source.type == "hls"
)
)
}
else -> {
sourceCallback.invoke(
ExtractorLink(
mainApiName,
mainApiName,
source.file,
mainUrl,
getQualityFromName(source.label),
isM3u8 = source.type == "hls"
)
)
}
}
} }
sources.source?.forEach { sources.source?.forEach {
@ -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