@@ -17,8 +17,10 @@ import com.lagradost.cloudstream3.newLiveSearchResponse
1717import com.lagradost.cloudstream3.newLiveStreamLoadResponse
1818import com.lagradost.cloudstream3.utils.ExtractorApi
1919import com.lagradost.cloudstream3.utils.ExtractorLink
20+ import com.lagradost.cloudstream3.utils.ExtractorLinkType
2021import com.lagradost.cloudstream3.utils.getQualityFromName
2122import com.lagradost.cloudstream3.utils.loadExtractor
23+ import com.lagradost.cloudstream3.utils.newExtractorLink
2224import org.jsoup.nodes.Element
2325import java.lang.RuntimeException
2426
@@ -126,7 +128,8 @@ class TwitchProvider : MainAPI() {
126128 }
127129
128130 override suspend fun search (query : String ): List <SearchResponse >? {
129- val document = app.get(" $mainUrl /search" , params = mapOf (" q" to query), referer = mainUrl).document
131+ val document =
132+ app.get(" $mainUrl /search" , params = mapOf (" q" to query), referer = mainUrl).document
130133 return document.select(" table.tops tr" ).map { it.toLiveSearchResponse() }
131134 }
132135
@@ -155,19 +158,22 @@ class TwitchProvider : MainAPI() {
155158 subtitleCallback : (SubtitleFile ) -> Unit ,
156159 callback : (ExtractorLink ) -> Unit
157160 ) {
158- val response = app.get(" https://pwn.sh/tools/streamapi.py?url=$url " ).parsed<ApiResponse >()
161+ val response =
162+ app.get(" https://pwn.sh/tools/streamapi.py?url=$url " ).parsed<ApiResponse >()
159163 response.urls?.forEach { (name, url) ->
160164 val quality = getQualityFromName(name.substringBefore(" p" ))
161165 callback.invoke(
162- ExtractorLink (
166+ newExtractorLink (
163167 this .name,
164168 " ${this .name} ${name.replace(" ${quality} p" , " " )} " ,
165- url,
166- " " ,
167- quality,
168- isM3u8 = true
169- ))
169+ url
170+ ) {
171+ this .type = ExtractorLinkType .M3U8
172+ this .quality = quality
173+ this .referer = " "
174+ }
175+ )
170176 }
171177 }
172178 }
173- }
179+ }
0 commit comments