mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
various cleanups
This commit is contained in:
parent
5853f99386
commit
aa9ce3f963
1 changed files with 7 additions and 8 deletions
|
@ -2,10 +2,9 @@ package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.fasterxml.jackson.module.kotlin.readValue
|
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.mapper
|
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
|
|
||||||
class PlayLtXyz: ExtractorApi() {
|
class PlayLtXyz: ExtractorApi() {
|
||||||
override val name: String = "PlayLt"
|
override val name: String = "PlayLt"
|
||||||
|
@ -13,7 +12,7 @@ class PlayLtXyz: ExtractorApi() {
|
||||||
override val requiresReferer = true
|
override val requiresReferer = true
|
||||||
|
|
||||||
private data class ResponseData(
|
private data class ResponseData(
|
||||||
@JsonProperty("data") val data: String?
|
@JsonProperty("data") val data: String? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
||||||
|
@ -36,12 +35,12 @@ class PlayLtXyz: ExtractorApi() {
|
||||||
//Log.i(this.name, "Result => (bodyText) $bodyText")
|
//Log.i(this.name, "Result => (bodyText) $bodyText")
|
||||||
if (bodyText.isNotBlank()) {
|
if (bodyText.isNotBlank()) {
|
||||||
idUser = "(?<=var idUser = \")(.*)(?=\";)".toRegex().find(bodyText)
|
idUser = "(?<=var idUser = \")(.*)(?=\";)".toRegex().find(bodyText)
|
||||||
?.groupValues?.get(0).toString()
|
?.groupValues?.get(0) ?: ""
|
||||||
|
|
||||||
idFile = "(?<=var idfile = \")(.*)(?=\";)".toRegex().find(bodyText)
|
idFile = "(?<=var idfile = \")(.*)(?=\";)".toRegex().find(bodyText)
|
||||||
?.groupValues?.get(0).toString()
|
?.groupValues?.get(0) ?: ""
|
||||||
}
|
}
|
||||||
Log.i(this.name, "Result => (idUser, idFile) $idUser / $idFile")
|
//Log.i(this.name, "Result => (idUser, idFile) $idUser / $idFile")
|
||||||
if (idUser.isNotBlank() && idFile.isNotBlank()) {
|
if (idUser.isNotBlank() && idFile.isNotBlank()) {
|
||||||
//val sess = HttpSession()
|
//val sess = HttpSession()
|
||||||
val ajaxHead = mapOf(
|
val ajaxHead = mapOf(
|
||||||
|
@ -59,11 +58,11 @@ class PlayLtXyz: ExtractorApi() {
|
||||||
//idUser = 608f7c85cf0743547f1f1b4e
|
//idUser = 608f7c85cf0743547f1f1b4e
|
||||||
val posturl = "https://api-plhq.playlt.xyz/apiv5/$idUser/$idFile"
|
val posturl = "https://api-plhq.playlt.xyz/apiv5/$idUser/$idFile"
|
||||||
val data = app.post(posturl, headers = ajaxHead, data = ajaxData)
|
val data = app.post(posturl, headers = ajaxHead, data = ajaxData)
|
||||||
Log.i(this.name, "Result => (posturl) $posturl")
|
//Log.i(this.name, "Result => (posturl) $posturl")
|
||||||
if (data.isSuccessful) {
|
if (data.isSuccessful) {
|
||||||
val itemstr = data.text
|
val itemstr = data.text
|
||||||
Log.i(this.name, "Result => (data) $itemstr")
|
Log.i(this.name, "Result => (data) $itemstr")
|
||||||
mapper.readValue<ResponseData>(itemstr).let { item ->
|
tryParseJson<ResponseData?>(itemstr)?.let { item ->
|
||||||
val linkUrl = item.data ?: ""
|
val linkUrl = item.data ?: ""
|
||||||
if (linkUrl.isNotBlank()) {
|
if (linkUrl.isNotBlank()) {
|
||||||
extractedLinksList.add(
|
extractedLinksList.add(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue