mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
9893c5313e
2 changed files with 55 additions and 35 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 1
|
version = 2
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -3,12 +3,13 @@ package com.hexated
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||||
|
import com.lagradost.cloudstream3.mvvm.safeApiCall
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
|
||||||
class Phim1080Provider : MainAPI() {
|
class Phim1080Provider : MainAPI() {
|
||||||
override var mainUrl = "https://xem1080.com"
|
override var mainUrl = "https://phimnhanh2.com"
|
||||||
override var name = "Phim1080"
|
override var name = "Phim1080"
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
override var lang = "vi"
|
override var lang = "vi"
|
||||||
|
@ -20,10 +21,10 @@ class Phim1080Provider : MainAPI() {
|
||||||
TvType.AsianDrama
|
TvType.AsianDrama
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun encodeString(e: String, t: Int): String {
|
private fun decodeString(e: String, t: Int): String {
|
||||||
var a = ""
|
var a = ""
|
||||||
for (element in e) {
|
for (i in 0 until e.length) {
|
||||||
val r = element.code
|
val r = e[i].code
|
||||||
val o = r xor t
|
val o = r xor t
|
||||||
a += o.toChar()
|
a += o.toChar()
|
||||||
}
|
}
|
||||||
|
@ -109,7 +110,7 @@ class Phim1080Provider : MainAPI() {
|
||||||
"Content-Type" to "application/json",
|
"Content-Type" to "application/json",
|
||||||
"X-Requested-With" to "XMLHttpRequest"
|
"X-Requested-With" to "XMLHttpRequest"
|
||||||
)
|
)
|
||||||
).parsedSafe<FilmInfo>()
|
).parsedSafe<filmInfo>()
|
||||||
val title = filmInfo?.name?.trim().toString()
|
val title = filmInfo?.name?.trim().toString()
|
||||||
val poster = filmInfo?.thumbnail
|
val poster = filmInfo?.thumbnail
|
||||||
val background = filmInfo?.poster
|
val background = filmInfo?.poster
|
||||||
|
@ -176,26 +177,45 @@ class Phim1080Provider : MainAPI() {
|
||||||
val fId = document.select("div.container").attr("data-id")
|
val fId = document.select("div.container").attr("data-id")
|
||||||
val epId = document.select("div.container").attr("data-episode-id")
|
val epId = document.select("div.container").attr("data-episode-id")
|
||||||
val doc = app.get(
|
val doc = app.get(
|
||||||
"$mainUrl/api/v2/films/$fId/episodes/$epId",
|
"$mainUrl/api/v2/films/$fId/episodes/$epId",
|
||||||
referer = data,
|
referer = data,
|
||||||
headers = mapOf(
|
headers = mapOf(
|
||||||
"Content-Type" to "application/json",
|
"Content-Type" to "application/json",
|
||||||
"cookie" to "xem1080=%3D",
|
"cookie" to "phimnhanh=%3D",
|
||||||
"X-Requested-With" to "XMLHttpRequest"
|
"X-Requested-With" to "XMLHttpRequest"
|
||||||
)
|
|
||||||
)
|
|
||||||
val source = doc.text.substringAfter(":{\"hls\":\"").substringBefore("\"},")
|
|
||||||
val link = encodeString(source, 69)
|
|
||||||
callback.invoke(
|
|
||||||
ExtractorLink(
|
|
||||||
"HS",
|
|
||||||
"HS",
|
|
||||||
link,
|
|
||||||
referer = data,
|
|
||||||
quality = Qualities.Unknown.value,
|
|
||||||
isM3u8 = true,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
val optEncode = if (doc.text.indexOf("\"opt\":\"") != -1) {
|
||||||
|
doc.text.substringAfter("\"opt\":\"").substringBefore("\"},")
|
||||||
|
} else { "" }
|
||||||
|
val opt = decodeString(optEncode as String, 69).replace("0uut$", "_").replace("index.m3u8", "3000k/hls/mixed.m3u8")
|
||||||
|
val hlsEncode = if (doc.text.indexOf(":{\"hls\":\"") != -1) {
|
||||||
|
doc.text.substringAfter(":{\"hls\":\"").substringBefore("\"},")
|
||||||
|
} else { "" }
|
||||||
|
val hls = decodeString(hlsEncode as String, 69)
|
||||||
|
val fb = if (doc.text.indexOf("\"fb\":[{\"src\":\"") != -1) {
|
||||||
|
doc.text.substringAfter("\"fb\":[{\"src\":\"").substringBefore("\",").replace("\\", "")
|
||||||
|
} else { "" }
|
||||||
|
|
||||||
|
listOfNotNull(
|
||||||
|
if (hls.contains(".m3u8")) {Triple("$hls", "HS", true)} else null,
|
||||||
|
if (fb.contains(".mp4")) {Triple("$fb", "FB", false)} else null,
|
||||||
|
if (opt.contains(".m3u8")) {Triple("$opt", "OP", true)} else null,
|
||||||
|
).apmap { (link, source, isM3u8) ->
|
||||||
|
safeApiCall {
|
||||||
|
callback.invoke(
|
||||||
|
ExtractorLink(
|
||||||
|
source,
|
||||||
|
source,
|
||||||
|
link,
|
||||||
|
referer = data,
|
||||||
|
quality = Qualities.Unknown.value,
|
||||||
|
isM3u8,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
val subId = doc.parsedSafe<Media>()?.subtitle?.vi
|
val subId = doc.parsedSafe<Media>()?.subtitle?.vi
|
||||||
val isSubIdEmpty = subId.isNullOrBlank()
|
val isSubIdEmpty = subId.isNullOrBlank()
|
||||||
if (!isSubIdEmpty) {
|
if (!isSubIdEmpty) {
|
||||||
|
@ -209,7 +229,7 @@ class Phim1080Provider : MainAPI() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
data class FilmInfo(
|
data class filmInfo(
|
||||||
@JsonProperty("name") val name: String? = null,
|
@JsonProperty("name") val name: String? = null,
|
||||||
@JsonProperty("poster") val poster: String? = null,
|
@JsonProperty("poster") val poster: String? = null,
|
||||||
@JsonProperty("thumbnail") val thumbnail: String? = null,
|
@JsonProperty("thumbnail") val thumbnail: String? = null,
|
||||||
|
|
Loading…
Reference in a new issue