anitubeinua: Fix fucking csst -> monstro
Check btw https://monstro.site/ and https://csst.online) @mail.ru moment on ukrainian site, lol
This commit is contained in:
parent
eeab703558
commit
596ab11cd0
2 changed files with 119 additions and 107 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 5
|
||||
version = 6
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
package com.lagradost
|
||||
|
||||
import com.lagradost.models.PlayerJson
|
||||
import com.lagradost.extractors.AshdiExtractor
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.extractors.Mp4Upload
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||
import com.lagradost.cloudstream3.extractors.Mp4Upload
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||
import com.lagradost.extractors.AshdiExtractor
|
||||
import com.lagradost.extractors.csstExtractor
|
||||
import com.lagradost.models.Ajax
|
||||
import com.lagradost.models.Link
|
||||
import com.lagradost.models.PlayerJson
|
||||
import com.lagradost.models.videoConstructor
|
||||
import java.util.*
|
||||
import org.jsoup.Jsoup
|
||||
import org.jsoup.nodes.Element
|
||||
import java.util.*
|
||||
|
||||
class AnitubeinuaProvider : MainAPI() {
|
||||
|
||||
|
@ -24,33 +24,31 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
override val hasMainPage = true
|
||||
override var lang = "uk"
|
||||
override val hasDownloadSupport = true
|
||||
override val supportedTypes = setOf(
|
||||
override val supportedTypes =
|
||||
setOf(
|
||||
TvType.AnimeMovie,
|
||||
TvType.Anime,
|
||||
)
|
||||
|
||||
// Sections
|
||||
override val mainPage = mainPageOf(
|
||||
override val mainPage =
|
||||
mainPageOf(
|
||||
"$mainUrl/anime/page/" to "Нові",
|
||||
"$mainUrl/f/sort=rating/order=desc/page/" to "Популярні",
|
||||
)
|
||||
|
||||
override suspend fun getMainPage(
|
||||
page: Int,
|
||||
request: MainPageRequest
|
||||
): HomePageResponse {
|
||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||
val document = app.get(request.data + page).document
|
||||
|
||||
val home = document.select(".story").map {
|
||||
it.toSearchResponse()
|
||||
}
|
||||
val home = document.select(".story").map { it.toSearchResponse() }
|
||||
return newHomePageResponse(request.name, home)
|
||||
}
|
||||
|
||||
private fun Element.toSearchResponse(): AnimeSearchResponse {
|
||||
val title = this.selectFirst(".story_c h2 a, div.text_content a")?.text()?.trim().toString()
|
||||
val href = this.selectFirst(".story_c h2 a, div.text_content a")?.attr("href").toString()
|
||||
val posterUrl = mainUrl + this.selectFirst(".story_c_l span.story_post img, a img")?.attr("src")
|
||||
val posterUrl =
|
||||
mainUrl + this.selectFirst(".story_c_l span.story_post img, a img")?.attr("src")
|
||||
|
||||
var isSub = this.select(".box .sub").isNotEmpty()
|
||||
var isDub = this.select(".box .ukr").isNotEmpty()
|
||||
|
@ -62,22 +60,22 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
this.posterUrl = posterUrl
|
||||
addDubStatus(isDub, isSub)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val document = app.post(
|
||||
val document =
|
||||
app.post(
|
||||
url = mainUrl,
|
||||
data = mapOf(
|
||||
data =
|
||||
mapOf(
|
||||
"do" to "search",
|
||||
"subaction" to "search",
|
||||
"story" to query.replace(" ", "+")
|
||||
)
|
||||
).document
|
||||
)
|
||||
.document
|
||||
|
||||
return document.select("article.story").map {
|
||||
it.toSearchResponse()
|
||||
}
|
||||
return document.select("article.story").map { it.toSearchResponse() }
|
||||
}
|
||||
|
||||
// Detailed information
|
||||
|
@ -88,7 +86,8 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
|
||||
// Parse info
|
||||
val title = document.selectFirst(".story_c h2")?.text()?.trim().toString()
|
||||
val poster = mainUrl + document.selectFirst(".story_c_left span.story_post img")?.attr("src")
|
||||
val poster =
|
||||
mainUrl + document.selectFirst(".story_c_left span.story_post img")?.attr("src")
|
||||
val tags = someInfo.select("a[href*=/anime/]").map { it.text() }
|
||||
val year = someInfo.select("a[href*=/xfsearch/year/]").text().toIntOrNull()
|
||||
|
||||
|
@ -96,11 +95,10 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
val description = document.selectFirst("div.my-text")?.text()?.trim()
|
||||
// val author = someInfo.select("strong:contains(Студія:)").next().html()
|
||||
val trailer = document.selectFirst(".rcol a.rollover")?.attr("href").toString()
|
||||
val rating = document.selectFirst(".lexington-box > div:last-child span")?.text().toRatingInt()
|
||||
val rating =
|
||||
document.selectFirst(".lexington-box > div:last-child span")?.text().toRatingInt()
|
||||
|
||||
val recommendations = document.select(".horizontal ul li").map {
|
||||
it.toSearchResponse()
|
||||
}
|
||||
val recommendations = document.select(".horizontal ul li").map { it.toSearchResponse() }
|
||||
|
||||
// Return to app
|
||||
// Players, Episodes, Number of episodes
|
||||
|
@ -108,23 +106,30 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
val dubEpisodes = mutableListOf<Episode>()
|
||||
val id = url.split("/").last().split("-").first()
|
||||
|
||||
val ajax = fromPlaylistAjax("$mainUrl/engine/ajax/playlists.php?news_id=$id&xfield=playlist&time=${Date().time}")
|
||||
val ajax =
|
||||
fromPlaylistAjax(
|
||||
"$mainUrl/engine/ajax/playlists.php?news_id=$id&xfield=playlist&time=${Date().time}"
|
||||
)
|
||||
|
||||
if (!ajax.isNullOrEmpty()) { // Ajax list
|
||||
ajax.groupBy{ it.name }.forEach { episodes -> // Group by name
|
||||
ajax
|
||||
.groupBy { it.name }
|
||||
.forEach { episodes -> // Group by name
|
||||
episodes.value.forEach lit@{
|
||||
// UFDub player, drop
|
||||
if (it.name == "ПЛЕЙЛИСТ") return@lit
|
||||
|
||||
if (it.urls.isDub) {
|
||||
dubEpisodes.add(Episode(
|
||||
dubEpisodes.add(
|
||||
Episode(
|
||||
"${it.name}, $id, ${it.urls.isDub}",
|
||||
it.name,
|
||||
episode = it.numberEpisode
|
||||
)
|
||||
)
|
||||
} else {
|
||||
subEpisodes.add(Episode(
|
||||
subEpisodes.add(
|
||||
Episode(
|
||||
"${it.name}, $id, ${it.urls.isDub}",
|
||||
it.name,
|
||||
episode = it.numberEpisode
|
||||
|
@ -143,7 +148,7 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
var varEpisodeNumber = episode.episodeNumber
|
||||
if (episode.episodeName == "ПЛЕЙЛИСТ") return@forEach
|
||||
if (varEpisodeNumber == null) {
|
||||
varEpisodeNumber = episodesList.last().episodeNumber?.plus(1);
|
||||
varEpisodeNumber = episodesList.last().episodeNumber?.plus(1)
|
||||
}
|
||||
dubEpisodes.add(
|
||||
Episode(
|
||||
|
@ -152,10 +157,8 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
episode = varEpisodeNumber,
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +175,6 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// It works when I click to view the series
|
||||
override suspend fun loadLinks(
|
||||
data: String, // (Ajax) Name, id title, isDub | (Two) Episode name, url title
|
||||
|
@ -181,12 +183,17 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
val dataList = data.split(", ")
|
||||
// Log.d("CakesTwix-Debug", data)
|
||||
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}")
|
||||
val ajax =
|
||||
fromPlaylistAjax(
|
||||
"$mainUrl/engine/ajax/playlists.php?news_id=${dataList[1]}&xfield=playlist&time=${Date().time}"
|
||||
)
|
||||
|
||||
// Filter by name and isDub
|
||||
ajax?.filter { it.name == dataList[0] }
|
||||
ajax
|
||||
?.filter { it.name == dataList[0] }
|
||||
?.filter { it.urls.isDub == dataList[2].toBoolean() }
|
||||
?.forEach {
|
||||
// Get m3u8 url
|
||||
|
@ -197,14 +204,16 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
source = "${it.urls.playerName} (${it.urls.name})",
|
||||
streamUrl = AshdiExtractor().ParseM3U8(this.urls.url),
|
||||
referer = "https://tortuga.wtf/"
|
||||
).forEach(callback)
|
||||
)
|
||||
.forEach(callback)
|
||||
}
|
||||
it.urls.url.contains("https://ashdi.vip/vod") -> {
|
||||
M3u8Helper.generateM3u8(
|
||||
source = "${it.urls.playerName} (${it.urls.name})",
|
||||
streamUrl = AshdiExtractor().ParseM3U8(this.urls.url),
|
||||
referer = "https://qeruya.cyou"
|
||||
).forEach(callback)
|
||||
)
|
||||
.forEach(callback)
|
||||
}
|
||||
it.urls.url.contains("https://www.udrop.com") -> {
|
||||
callback.invoke(
|
||||
|
@ -218,8 +227,9 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
)
|
||||
)
|
||||
}
|
||||
it.urls.url.contains("https://csst.online/embed/") -> {
|
||||
csstExtractor().ParseUrl(it.urls.url).split(",").forEach{ csstUrl ->
|
||||
it.urls.url.contains("https://csst.online/embed/") || it.urls.url.contains("https://monstro.site/embed/") -> {
|
||||
csstExtractor().ParseUrl(it.urls.url).split(",").forEach { csstUrl
|
||||
->
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
this.urls.url,
|
||||
|
@ -243,7 +253,6 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
extlink.quality,
|
||||
extlink.type,
|
||||
extlink.headers,
|
||||
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -263,7 +272,7 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
// Parse by number episode
|
||||
// If null, just add +1
|
||||
if (dub.episodeNumber == null) {
|
||||
dub.episodeNumber = latestNumber?.plus(1);
|
||||
dub.episodeNumber = latestNumber?.plus(1)
|
||||
}
|
||||
|
||||
latestNumber = dub.episodeNumber
|
||||
|
@ -276,14 +285,16 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
source = dub.playerName,
|
||||
streamUrl = AshdiExtractor().ParseM3U8(this),
|
||||
referer = "https://tortuga.wtf/"
|
||||
).forEach(callback)
|
||||
)
|
||||
.forEach(callback)
|
||||
}
|
||||
contains("https://ashdi.vip/vod") -> {
|
||||
M3u8Helper.generateM3u8(
|
||||
source = dub.playerName,
|
||||
streamUrl = AshdiExtractor().ParseM3U8(this),
|
||||
referer = "https://qeruya.cyou"
|
||||
).forEach(callback)
|
||||
)
|
||||
.forEach(callback)
|
||||
}
|
||||
contains("https://www.udrop.com") -> {
|
||||
callback.invoke(
|
||||
|
@ -297,12 +308,12 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
)
|
||||
)
|
||||
}
|
||||
contains("https://csst.online/embed/") -> {
|
||||
contains("https://monstro.site/embed/") || contains("https://csst.online/embed/") -> {
|
||||
csstExtractor().ParseUrl(this).split(",").forEach {
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
dub.playerName,
|
||||
name = "${dub.playerName} ${it.substringBefore("]").drop(1)}",
|
||||
name = "${dub.playerName.replace("\"", "")} ${it.substringBefore("]").drop(1)}",
|
||||
it.substringAfter("]"),
|
||||
"",
|
||||
0,
|
||||
|
@ -322,7 +333,6 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
extlink.quality,
|
||||
extlink.type,
|
||||
extlink.headers,
|
||||
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -345,11 +355,7 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
}
|
||||
}
|
||||
|
||||
data class Responses(
|
||||
val success: Boolean?,
|
||||
val response: String?,
|
||||
val message: String?
|
||||
)
|
||||
data class Responses(val success: Boolean?, val response: String?, val message: String?)
|
||||
|
||||
// Thanks to Andro999b
|
||||
// https://github.com/Andro999b/movies-telegram-bot/blob/a296c7d4122a25fa70b612e75d741dd55c154640/functions/src/providers/AnitubeUAProvider.ts#L86-L137
|
||||
|
@ -441,8 +447,14 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
|
||||
private fun fromVideoContructor(script: Element): List<videoConstructor> {
|
||||
val playerScriptRawJson = script.data().substringAfterLast(".init(").substringBefore(");")
|
||||
val playerEpisodesRawJson = playerScriptRawJson.substringAfter("],").substringBeforeLast(",")
|
||||
val playerNamesArray = (playerScriptRawJson.substringBefore("],") + "]").dropLast(1).drop(1).replace("\",\"", ",,,").split(",,,")
|
||||
val playerEpisodesRawJson =
|
||||
playerScriptRawJson.substringAfter("],").substringBeforeLast(",")
|
||||
val playerNamesArray =
|
||||
(playerScriptRawJson.substringBefore("],") + "]")
|
||||
.dropLast(1)
|
||||
.drop(1)
|
||||
.replace("\",\"", ",,,")
|
||||
.split(",,,")
|
||||
// val numberOfEpisodesInt = playerScriptRawJson.substringAfterLast(",").toIntOrNull()
|
||||
|
||||
val jsonEpisodes = tryParseJson<List<List<PlayerJson>>>(playerEpisodesRawJson)!!
|
||||
|
@ -464,6 +476,7 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
}
|
||||
return episodes.toList()
|
||||
}
|
||||
|
||||
private fun extractIntFromString(string: String): Int? {
|
||||
val value = Regex("(\\d+)").findAll(string).lastOrNull() ?: return null
|
||||
if (value.value[0].toString() == "0") {
|
||||
|
@ -471,6 +484,5 @@ class AnitubeinuaProvider : MainAPI() {
|
|||
}
|
||||
|
||||
return value.value.toIntOrNull()
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue