anitubeinua: filter links by name
This commit is contained in:
parent
d01fdd2af1
commit
fdb058cc72
2 changed files with 48 additions and 58 deletions
|
@ -1,6 +1,5 @@
|
|||
package com.lagradost
|
||||
|
||||
import android.util.Log
|
||||
import com.lagradost.models.PlayerJson
|
||||
import com.lagradost.extractors.AshdiExtractor
|
||||
import com.lagradost.cloudstream3.*
|
||||
|
@ -136,7 +135,7 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
{
|
||||
dubEpisodes.add(
|
||||
Episode(
|
||||
"$index, $url",
|
||||
"${episode.episodeName}, $url",
|
||||
episode.episodeName,
|
||||
episode = episode.episodeNumber,
|
||||
)
|
||||
|
@ -163,13 +162,13 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
|
||||
// It works when I click to view the series
|
||||
override suspend fun loadLinks(
|
||||
data: String, // (Ajax) Name, id title, isDub | (Two) index, url title
|
||||
data: String, // (Ajax) Name, id title, isDub | (Two) Episode name, url title
|
||||
isCasting: Boolean,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
val dataList = data.split(", ")
|
||||
if(dataList[0].toIntOrNull() == null){ // Its ajax list
|
||||
if(dataList[1].toIntOrNull() != null){ // Its ajax list
|
||||
|
||||
val ajax = fromPlaylistAjax("$mainUrl/engine/ajax/playlists.php?news_id=${dataList[1]}&xfield=playlist&time=${Date().time}")
|
||||
|
||||
|
@ -177,7 +176,6 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
ajax?.filter { it.name == dataList[0] }
|
||||
?.filter { it.urls.isDub == dataList[2].toBoolean() }
|
||||
?.forEach {
|
||||
|
||||
// Get m3u8 url
|
||||
with(it){
|
||||
when{
|
||||
|
@ -229,7 +227,7 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
val document = app.get(dataList[1]).document
|
||||
document.select("script").map { script ->
|
||||
if (script.data().contains("RalodePlayer.init(")) {
|
||||
fromVideoContructor(script).forEach { dub ->
|
||||
fromVideoContructor(script).filter { it.episodeName == dataList[0] } .forEach { dub ->
|
||||
with(dub.episodeUrl) {
|
||||
when {
|
||||
contains("https://tortuga.wtf/vod/") -> {
|
||||
|
@ -259,7 +257,7 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
)
|
||||
}
|
||||
contains("https://csst.online/embed/") -> {
|
||||
csstExtractor().ParseUrl(this).split(",").forEach{
|
||||
csstExtractor().ParseUrl(this).split(",").forEach {
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
dub.playerName,
|
||||
|
@ -316,7 +314,6 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
playlist.select(".playlists-lists .playlists-items:first-child li").forEach {
|
||||
audios.add(Pair(it.text(), it.attr("data-id")))
|
||||
}
|
||||
|
||||
// Set listPlayers and listDubStatus
|
||||
// If has subs - So players in 3 index
|
||||
if(playlist.select(".playlists-lists .playlists-items").count() == 3){
|
||||
|
@ -335,7 +332,6 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
listPlayers.add(Pair(it.text(), it.attr("data-id")))
|
||||
}
|
||||
}
|
||||
|
||||
// Parse episodes
|
||||
playlist.select(".playlists-videos .playlists-items li").forEach { element ->
|
||||
val audioId = element.attr("data-id") // 0_0_0 or 0_0_0_0 if subs
|
||||
|
@ -361,12 +357,13 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
listPlayers.forEach {
|
||||
if(audioId.startsWith(it.second)){
|
||||
playerName = it.first
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
returnEpisodes.add(
|
||||
Ajax(
|
||||
|
@ -408,15 +405,12 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
// Log.d("load-debug", "$playerName ${it.name}")
|
||||
}
|
||||
}
|
||||
Log.d("load-debug", episodes.toString())
|
||||
return episodes.toList()
|
||||
}
|
||||
private fun extractIntFromString(string: String): Int? {
|
||||
val value = Regex("(\\d+)").find(string)?.value
|
||||
if(value?.get(0).toString() == "0"){
|
||||
if (value != null) {
|
||||
return value.drop(1).toIntOrNull()
|
||||
}
|
||||
return value?.drop(1)?.toIntOrNull()
|
||||
}
|
||||
|
||||
return value?.toIntOrNull()
|
||||
|
|
|
@ -4,12 +4,8 @@ import com.lagradost.cloudstream3.app
|
|||
|
||||
class csstExtractor {
|
||||
suspend fun ParseUrl(url: String): String{
|
||||
val playerLinks = app.get(url).document.select("script").html()
|
||||
return app.get(url).document.select("script").html()
|
||||
.substringAfterLast("file:\"")
|
||||
.substringBefore("\",")
|
||||
|
||||
// Log.d("load-debug", playerLinks)
|
||||
|
||||
return playerLinks
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue