exts: Fix moonanime player

This commit is contained in:
CakesTwix 2024-07-10 12:38:59 +03:00
parent 483dea7476
commit 3c8dc3d4e5
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825
5 changed files with 34 additions and 26 deletions

View file

@ -137,14 +137,19 @@ class HigoTVProvider : MainAPI() {
document.select("iframe").forEach { document.select("iframe").forEach {
if(it.attr("src").isNotEmpty()){ if(it.attr("src").isNotEmpty()){
val playerDocument = app.get(it.attr("src")).document val playerDocument = app.get(it.attr("src"),
// Log.d("CakesTwix-Debug", playerDocument.select("script[type*=text/javascript]").html().substringAfter("file:'").substringBefore("',")) headers = mapOf(
"Host" to "moonanime.art",
"Accept" to "*/*",
"User-Agent" to "Mozilla/5.0 (Windows NT 10.0; rv:126.0) Gecko/20100101 Firefox/126.0",
"accept-language" to "en-US,en;q=0.5"
)).document
Log.d("CakesTwix-Debug", playerDocument.select("script[type*=text/javascript]").html().substringAfter("file: '").substringBefore("',"))
val parsedJSON = gson.fromJson<List<PlayerJson>>( val parsedJSON = gson.fromJson<List<PlayerJson>>(
playerDocument.select("script[type*=text/javascript]").html().substringAfter("file: '").substringBefore("',"), listPlayer playerDocument.select("script[type*=text/javascript]").html().substringAfter("file: '").substringBefore("',"), listPlayer
) )
parsedJSON[0].folder?.forEach { seasons -> parsedJSON?.forEach {
seasons.folder?.forEach {
episodes.add( episodes.add(
Episode( Episode(
"${url}, ${it.title}", "${url}, ${it.title}",
@ -156,7 +161,6 @@ class HigoTVProvider : MainAPI() {
} }
} }
} }
}
// Log.d("CakesTwix-Debug", playerRawJson) // Log.d("CakesTwix-Debug", playerRawJson)
@ -201,24 +205,28 @@ class HigoTVProvider : MainAPI() {
document.select("iframe").forEach { document.select("iframe").forEach {
if(it.attr("src").isNotEmpty()){ if(it.attr("src").isNotEmpty()){
val playerDocument = app.get(it.attr("src")).document val playerDocument = app.get(it.attr("src"),
headers = mapOf(
"Host" to "moonanime.art",
"Accept" to "*/*",
"User-Agent" to "Mozilla/5.0 (Windows NT 10.0; rv:126.0) Gecko/20100101 Firefox/126.0",
"accept-language" to "en-US,en;q=0.5"
)).document
// Log.d("CakesTwix-Debug", playerDocument.select("script[type*=text/javascript]").html().substringAfter("file:'").substringBefore("',")) // Log.d("CakesTwix-Debug", playerDocument.select("script[type*=text/javascript]").html().substringAfter("file:'").substringBefore("',"))
val parsedJSON = gson.fromJson<List<PlayerJson>>( val parsedJSON = gson.fromJson<List<PlayerJson>>(
playerDocument.select("script[type*=text/javascript]").html().substringAfter("file: '").substringBefore("',"), listPlayer playerDocument.select("script[type*=text/javascript]").html().substringAfter("file: '").substringBefore("',"), listPlayer
) )
parsedJSON[0].folder?.forEach { seasons -> parsedJSON?.forEach {
seasons.folder?.forEach {
if(it.title != dataList[1]) return@forEach if(it.title != dataList[1]) return@forEach
M3u8Helper.generateM3u8( M3u8Helper.generateM3u8(
source = parsedJSON[0].title!!, source = it.title,
streamUrl = it.file!!, streamUrl = it.file!!,
referer = "https://moonanime.art" referer = "https://moonanime.art"
).forEach(callback) ).forEach(callback)
} }
} }
} }
}
return true return true
} }