Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CornHubProvider/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 2
version = 3


cloudstream {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.amap
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.network.WebViewResolver
import com.lagradost.cloudstream3.utils.newExtractorLink
Expand Down Expand Up @@ -140,7 +141,7 @@ class CornHubProvider : MainAPI() {
val document = request.document
val mediaDefinitions = JSONObject(
document.selectXpath("//script[contains(text(),'flashvars')]").first()?.data()
?.substringAfter("=")?.substringBefore(";")
?.substringAfter("=")?.substringBefore(";") ?: ""
).getJSONArray("mediaDefinitions")

for (i in 0 until mediaDefinitions.length()) {
Expand All @@ -152,17 +153,17 @@ class CornHubProvider : MainAPI() {
M3u8Helper.M3u8Stream(
videoUrl
), true
).apmap { stream ->
).amap { stream ->
extlinkList.add(
newExtractorLink(
source = name,
name = "${this.name}",
name = "${name}",
url = stream.streamUrl,
type = ExtractorLinkType.M3U8,
) {
this.quality = Regex("(\\d+)").find(quality ?: "")?.groupValues?.get(1)
.let { getQualityFromName(it) }
this.referer = mainUrl
.let { getQualityFromName(it) }
referer = mainUrl
}
)
}
Expand Down