mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Extractor: added Pichive & Sobreatsesuyp
This commit is contained in:
parent
bcc2b19b2b
commit
22645a56ff
1 changed files with 17 additions and 22 deletions
|
@ -13,13 +13,13 @@ open class Sobreatsesuyp : ExtractorApi() {
|
||||||
override val requiresReferer = true
|
override val requiresReferer = true
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
|
override suspend fun getUrl(url: String, referer: String?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
|
||||||
val ext_ref = referer ?: ""
|
val extRef = referer ?: ""
|
||||||
|
|
||||||
val video_req = app.get(url, referer=ext_ref).text
|
val videoReq = app.get(url, referer = extRef).text
|
||||||
|
|
||||||
val file = Regex("""file\":\"([^\"]+)""").find(video_req)?.groupValues?.get(1) ?: throw ErrorLoadingException("File not found")
|
val file = Regex("""file\":\"([^\"]+)""").find(videoReq)?.groupValues?.get(1) ?: throw ErrorLoadingException("File not found")
|
||||||
val postLink = "${mainUrl}/" + file.replace("\\", "")
|
val postLink = "${mainUrl}/" + file.replace("\\", "")
|
||||||
val rawList = app.post(postLink, referer=ext_ref).parsedSafe<List<Any>>() ?: throw ErrorLoadingException("Post link not found")
|
val rawList = app.post(postLink, referer = extRef).parsedSafe<List<Any>>() ?: throw ErrorLoadingException("Post link not found")
|
||||||
|
|
||||||
val postJson: List<SobreatsesuypVideoData> = rawList.drop(1).map { item ->
|
val postJson: List<SobreatsesuypVideoData> = rawList.drop(1).map { item ->
|
||||||
val mapItem = item as Map<*, *>
|
val mapItem = item as Map<*, *>
|
||||||
|
@ -30,35 +30,30 @@ open class Sobreatsesuyp : ExtractorApi() {
|
||||||
}
|
}
|
||||||
Log.d("Kekik_${this.name}", "postJson » ${postJson}")
|
Log.d("Kekik_${this.name}", "postJson » ${postJson}")
|
||||||
|
|
||||||
val vid_links = mutableSetOf<String>()
|
val vidLinks = mutableSetOf<String>()
|
||||||
val vid_map = mutableListOf<Map<String, String>>()
|
val vidPairs = mutableListOf<Pair<String, String>>()
|
||||||
for (item in postJson) {
|
for (item in postJson) {
|
||||||
if (item.file == null || item.title == null) continue
|
if (item.file == null || item.title == null) continue
|
||||||
|
|
||||||
val fileUrl = "${mainUrl}/playlist/" + item.file.substring(1) + ".txt"
|
val fileUrl = "${mainUrl}/playlist/${item.file.substring(1)}.txt"
|
||||||
val videoData = app.post(fileUrl, referer=ext_ref).text
|
val videoData = app.post(fileUrl, referer = extRef).text
|
||||||
|
|
||||||
if (videoData in vid_links) { continue }
|
if (videoData in vidLinks) { continue }
|
||||||
vid_links.add(videoData)
|
vidLinks.add(videoData)
|
||||||
|
|
||||||
vid_map.add(mapOf(
|
vidPairs.add(Pair(item.title, videoData))
|
||||||
"title" to item.title,
|
|
||||||
"videoData" to videoData
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (vidPair in vidPairs) {
|
||||||
for (mapEntry in vid_map) {
|
Log.d("Kekik_${this.name}", "vidPair » ${vidPair}")
|
||||||
Log.d("Kekik_${this.name}", "mapEntry » ${mapEntry}")
|
val (title, m3uLink) = vidPair
|
||||||
val title = mapEntry["title"] ?: continue
|
|
||||||
val m3u_link = mapEntry["videoData"] ?: continue
|
|
||||||
|
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
source = this.name,
|
source = this.name,
|
||||||
name = "${this.name} - ${title}",
|
name = "${this.name} - ${title}",
|
||||||
url = m3u_link,
|
url = m3uLink,
|
||||||
referer = ext_ref,
|
referer = extRef,
|
||||||
quality = Qualities.Unknown.value,
|
quality = Qualities.Unknown.value,
|
||||||
type = INFER_TYPE
|
type = INFER_TYPE
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue