11package com.idlix
22
3- import com.idlix.IdlixProvider.ResponseSource
4- import com.idlix.IdlixProvider.Tracks
3+ import com.fasterxml.jackson.annotation.JsonProperty
4+ import com.lagradost.api.Log
55import com.lagradost.cloudstream3.SubtitleFile
66import com.lagradost.cloudstream3.app
77import com.lagradost.cloudstream3.newSubtitleFile
88import com.lagradost.cloudstream3.utils.AppUtils
99import com.lagradost.cloudstream3.utils.ExtractorApi
1010import com.lagradost.cloudstream3.utils.ExtractorLink
11- import com.lagradost.cloudstream3.utils.ExtractorLinkType
11+ import com.lagradost.cloudstream3.utils.M3u8Helper.Companion.generateM3u8
1212import com.lagradost.cloudstream3.utils.getAndUnpack
13- import com.lagradost.cloudstream3.utils.newExtractorLink
1413
1514class Jeniusplay : ExtractorApi () {
1615 override var name = " Jeniusplay"
@@ -23,26 +22,22 @@ class Jeniusplay : ExtractorApi() {
2322 subtitleCallback : (SubtitleFile ) -> Unit ,
2423 callback : (ExtractorLink ) -> Unit
2524 ) {
26- val document = app.get(url, referer = referer).documentLarge
25+ val document = app.get(url, referer = referer).document
2726 val hash = url.split(" /" ).last().substringAfter(" data=" )
2827
2928 val m3uLink = app.post(
3029 url = " $mainUrl /player/index.php?data=$hash &do=getVideo" ,
3130 data = mapOf (" hash" to hash, " r" to " $referer " ),
3231 referer = referer,
3332 headers = mapOf (" X-Requested-With" to " XMLHttpRequest" )
34- ).parsed<ResponseSource >().videoSource
33+ ).parsed<ResponseSource >().videoSource.replace( " .txt " , " .m3u8 " )
3534
36- callback.invoke(
37- newExtractorLink(
38- name,
39- name,
40- url = m3uLink,
41- ExtractorLinkType .M3U8
42- )
43- )
35+ generateM3u8(name,
36+ m3uLink,
37+ mainUrl,
38+ ).forEach(callback)
4439
45- document.select(" script" ).map { script ->
40+ document.select(" script" ).forEach { script ->
4641 if (script.data().contains(" eval(function(p,a,c,k,e,d)" )) {
4742 val subData =
4843 getAndUnpack(script.data()).substringAfter(" \" tracks\" :[" ).substringBefore(" ]," )
@@ -58,7 +53,17 @@ class Jeniusplay : ExtractorApi() {
5853 }
5954 }
6055
56+ data class ResponseSource (
57+ @param:JsonProperty("hls") val hls : Boolean ,
58+ @param:JsonProperty("videoSource") val videoSource : String ,
59+ @param:JsonProperty("securedLink") val securedLink : String? ,
60+ )
6161
62+ data class Tracks (
63+ @param:JsonProperty("kind") val kind : String? ,
64+ @param:JsonProperty("file") val file : String ,
65+ @param:JsonProperty("label") val label : String? ,
66+ )
6267 private fun getLanguage (str : String ): String {
6368 return when {
6469 str.contains(" indonesia" , true ) || str
@@ -67,3 +72,39 @@ class Jeniusplay : ExtractorApi() {
6772 }
6873 }
6974}
75+
76+ class Majorplay : ExtractorApi () {
77+ override var name = " Majorplay"
78+ override var mainUrl = " https://*.majorplay.net"
79+ override val requiresReferer = true
80+
81+ override suspend fun getUrl (
82+ url : String ,
83+ referer : String? ,
84+ subtitleCallback : (SubtitleFile ) -> Unit ,
85+ callback : (ExtractorLink ) -> Unit
86+ ) {
87+ val document = app.get(url, referer = mainUrl).document
88+ val m3uLink = document.select(" source" ).attr(" src" )
89+ Log .d(name, m3uLink)
90+ generateM3u8(name, m3uLink, mainUrl).forEach(callback)
91+
92+ val scripts = document.selectFirst(" script:containsData(subtitles)" )?.data() ? : return
93+
94+ val subRegex = Regex (""" \\"label\\":\\"([^\\"]*?)\\"[^}]*?\\"path\\":\\"([^\\"]*?)\\"""" )
95+
96+ subRegex.findAll(scripts).forEach { match ->
97+ val label = match.groupValues[1 ]
98+ var vttUrl = match.groupValues[2 ]
99+
100+ if (! vttUrl.startsWith(" http" )) {
101+ vttUrl = mainUrl.trimEnd(' /' ) + vttUrl
102+ }
103+
104+ subtitleCallback.invoke(
105+ newSubtitleFile
106+ (label, vttUrl)
107+ )
108+ }
109+ }
110+ }
0 commit comments