encrypt url

This commit is contained in:
KingLucius 2023-09-11 16:28:45 +03:00
parent f6c547242f
commit f29605e7ab
2 changed files with 9 additions and 10 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 5 version = 6
cloudstream { cloudstream {

View file

@ -22,11 +22,14 @@ class YacienTV : MainAPI() {
setOf( setOf(
TvType.Live TvType.Live
) )
private val yacienTVAPI = "http://ver3.yacinelive.com/api" private val yacienTVAPI = b64("aHR0cDovL3ZlcjMueWFjaW5lbGl2ZS5jb20vYXBp")
private val mainKey = "YyF4WmorTjkmR0BFdkB2dw==" private val mainKey = "YyF4WmorTjkmR0BFdkB2dw=="
private fun b64(str: String): String{
return Base64.decode(str, Base64.DEFAULT).toString(charset("UTF-8"))
}
private fun decrypt(enc: String, headerStr: String): String { private fun decrypt(enc: String, headerStr: String): String {
val key = Base64.decode(mainKey, Base64.DEFAULT).toString(charset("UTF-8")) + headerStr val key = b64(mainKey) + headerStr
val decodedBytes = Base64.decode(enc, Base64.DEFAULT) val decodedBytes = Base64.decode(enc, Base64.DEFAULT)
val encString = decodedBytes.toString(charset("UTF-8")) val encString = decodedBytes.toString(charset("UTF-8"))
var result = "" var result = ""
@ -63,7 +66,7 @@ class YacienTV : MainAPI() {
if (request.name == "Live Events") { if (request.name == "Live Events") {
val parsedData = parseJson<EventsResults>(decodedBody).results val parsedData = parseJson<EventsResults>(decodedBody).results
Log.d("King", "parsedEventData:$parsedData") Log.d("King", "parsedEventData:$parsedData")
val list = parsedData?.mapNotNull { element -> val list = parsedData?.map { element ->
element.toSearchResponse(request) element.toSearchResponse(request)
} ?: throw ErrorLoadingException("Invalid Json response") } ?: throw ErrorLoadingException("Invalid Json response")
if (list.isNotEmpty()) items.add(HomePageList(request.name, list, true)) if (list.isNotEmpty()) items.add(HomePageList(request.name, list, true))
@ -92,12 +95,8 @@ class YacienTV : MainAPI() {
val matchTeams = "${team_1["name"].toString()} vs ${team_2["name"].toString()}" val matchTeams = "${team_1["name"].toString()} vs ${team_2["name"].toString()}"
//val startTime = Date(start_time.toLong()) .toString()
val startTime = DateFormat.format("hh:mm", start_time.toLong()).toString()
val endTime = end_time
return LiveSearchResponse( return LiveSearchResponse(
name = "${matchTeams}\n${start_time?.let { DateFormat.format("h:mm a", it.toLong() * 1000).toString() }}", name = "${matchTeams}\n${start_time.let { DateFormat.format("h:mm a", it.toLong() * 1000).toString() }}",
LinksData( LinksData(
id = id, id = id,
start_time = start_time, start_time = start_time,
@ -113,7 +112,7 @@ class YacienTV : MainAPI() {
"logo" to team_2["logo"].toString() "logo" to team_2["logo"].toString()
), ),
category = request.name, category = request.name,
name = "$matchTeams", name = matchTeams,
commentary = commentary, commentary = commentary,
).toJson(), ).toJson(),
this@YacienTV.name, this@YacienTV.name,