mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fixed Anilibria & Movierulzhd
This commit is contained in:
parent
7f83b0e73e
commit
65a1ce74d3
5 changed files with 74 additions and 16 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 1
|
version = 2
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.hexated
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
|
||||||
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
|
@ -21,6 +23,16 @@ class Anilibria : MainAPI() {
|
||||||
TvType.OVA
|
TvType.OVA
|
||||||
)
|
)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getType(t: String): TvType {
|
||||||
|
return when {
|
||||||
|
t.contains("Фильм", true) -> TvType.Movie
|
||||||
|
t.contains("ТВ", true) -> TvType.Anime
|
||||||
|
else -> TvType.OVA
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override val mainPage = mainPageOf(
|
override val mainPage = mainPageOf(
|
||||||
"1" to "Новое",
|
"1" to "Новое",
|
||||||
"2" to "Популярное",
|
"2" to "Популярное",
|
||||||
|
@ -68,10 +80,21 @@ class Anilibria : MainAPI() {
|
||||||
} ?: throw ErrorLoadingException("Invalid json responses")
|
} ?: throw ErrorLoadingException("Invalid json responses")
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun load(url: String): LoadResponse {
|
override suspend fun load(url: String): LoadResponse? {
|
||||||
val document = app.get(url).document
|
val document = app.get(url).document
|
||||||
|
|
||||||
val title = document.selectFirst("h1.release-title")!!.text().trim()
|
val title = document.selectFirst("h1.release-title")?.text() ?: return null
|
||||||
|
val poster = fixUrlNull(document.selectFirst("img#adminPoster")?.attr("src"))
|
||||||
|
val trackTitle = (document.selectFirst("h1.release-title br")?.nextSibling()
|
||||||
|
?: document.selectFirst("h1.release-title")?.text()?.substringAfter("/")?.trim()).toString()
|
||||||
|
val type = document.selectFirst("div#xreleaseInfo b:contains(Тип:)")?.nextSibling()
|
||||||
|
.toString().substringBefore(",").trim()
|
||||||
|
val trackType = type.let {
|
||||||
|
if(it.contains("Фильм", true)) "movie" else "tv"
|
||||||
|
}
|
||||||
|
val year = document.selectFirst("div#xreleaseInfo b:contains(Сезон:)")?.nextElementSibling()
|
||||||
|
?.text()?.filter { it.isDigit() }?.toIntOrNull()
|
||||||
|
val (malId, anilistId, image, cover) = getTracker(trackTitle, trackType, year)
|
||||||
val episodes = document.select("script").find { it.data().contains("var player =") }?.data()
|
val episodes = document.select("script").find { it.data().contains("var player =") }?.data()
|
||||||
?.substringAfter("file:[")?.substringBefore("],")?.let { data ->
|
?.substringAfter("file:[")?.substringBefore("],")?.let { data ->
|
||||||
tryParseJson<List<Episodes>>("[$data]")?.mapNotNull { eps ->
|
tryParseJson<List<Episodes>>("[$data]")?.mapNotNull { eps ->
|
||||||
|
@ -82,18 +105,16 @@ class Anilibria : MainAPI() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return newAnimeLoadResponse(title, url, getType(type)) {
|
||||||
return newAnimeLoadResponse(title, url, TvType.Anime) {
|
posterUrl = image ?: poster
|
||||||
posterUrl = fixUrlNull(document.selectFirst("img#adminPoster")?.attr("src"))
|
backgroundPosterUrl = cover ?: image ?: poster
|
||||||
this.year =
|
this.year = year
|
||||||
document.selectFirst("div#xreleaseInfo b:contains(Сезон:)")?.nextElementSibling()
|
|
||||||
?.text()?.filter { it.isDigit() }?.toIntOrNull()
|
|
||||||
addEpisodes(DubStatus.Subbed, episodes)
|
addEpisodes(DubStatus.Subbed, episodes)
|
||||||
plot = document.select("p.detail-description").text().trim()
|
plot = document.select("p.detail-description").text().trim()
|
||||||
this.tags = document.selectFirst("div#xreleaseInfo").toString().let { tag ->
|
this.tags = document.selectFirst("div#xreleaseInfo b:contains(Жанры:)")?.nextSibling()
|
||||||
Regex("Жанры:</b>(.*\\n?.*)<br>").find(tag)?.groupValues?.getOrNull(1)?.split(",")
|
.toString().split(",").map { it.trim() }
|
||||||
?.map { it.trim() }
|
addMalId(malId)
|
||||||
}
|
addAniListId(anilistId?.toIntOrNull())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +143,43 @@ class Anilibria : MainAPI() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private suspend fun getTracker(title: String?, type: String?, year: Int?): Tracker {
|
||||||
|
val res = app.get("https://api.consumet.org/meta/anilist/$title")
|
||||||
|
.parsedSafe<AniSearch>()?.results?.find { media ->
|
||||||
|
(media.title?.english.equals(title, true) || media.title?.romaji.equals(
|
||||||
|
title,
|
||||||
|
true
|
||||||
|
)) || (media.type.equals(type, true) && media.releaseDate == year)
|
||||||
|
}
|
||||||
|
return Tracker(res?.malId, res?.aniId, res?.image, res?.cover)
|
||||||
|
}
|
||||||
|
|
||||||
|
data class Tracker(
|
||||||
|
val malId: Int? = null,
|
||||||
|
val aniId: String? = null,
|
||||||
|
val image: String? = null,
|
||||||
|
val cover: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Title(
|
||||||
|
@JsonProperty("romaji") val romaji: String? = null,
|
||||||
|
@JsonProperty("english") val english: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Results(
|
||||||
|
@JsonProperty("id") val aniId: String? = null,
|
||||||
|
@JsonProperty("malId") val malId: Int? = null,
|
||||||
|
@JsonProperty("title") val title: Title? = null,
|
||||||
|
@JsonProperty("releaseDate") val releaseDate: Int? = null,
|
||||||
|
@JsonProperty("type") val type: String? = null,
|
||||||
|
@JsonProperty("image") val image: String? = null,
|
||||||
|
@JsonProperty("cover") val cover: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class AniSearch(
|
||||||
|
@JsonProperty("results") val results: ArrayList<Results>? = arrayListOf(),
|
||||||
|
)
|
||||||
|
|
||||||
private data class Episodes(
|
private data class Episodes(
|
||||||
@JsonProperty("file") val file: String? = null,
|
@JsonProperty("file") val file: String? = null,
|
||||||
@JsonProperty("title") val title: String? = null,
|
@JsonProperty("title") val title: String? = null,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 27
|
version = 28
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.jsoup.nodes.Element
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
|
|
||||||
class Movierulzhd : MainAPI() {
|
class Movierulzhd : MainAPI() {
|
||||||
override var mainUrl = "https://movierulzhd.shop"
|
override var mainUrl = "https://movierulzhd.store"
|
||||||
private var directUrl = mainUrl
|
private var directUrl = mainUrl
|
||||||
override var name = "Movierulzhd"
|
override var name = "Movierulzhd"
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
|
|
|
@ -29,7 +29,7 @@ open class Sbflix : ExtractorApi() {
|
||||||
val id = regexID.findAll(url).map {
|
val id = regexID.findAll(url).map {
|
||||||
it.value.replace(Regex("(embed-|/e/)"), "")
|
it.value.replace(Regex("(embed-|/e/)"), "")
|
||||||
}.first()
|
}.first()
|
||||||
val master = "$mainUrl/sources49/" + bytesToHex("||$id||||streamsb".toByteArray()) + "/"
|
val master = "$mainUrl/sources50/" + bytesToHex("||$id||||streamsb".toByteArray()) + "/"
|
||||||
val headers = mapOf(
|
val headers = mapOf(
|
||||||
"watchsb" to "sbstream",
|
"watchsb" to "sbstream",
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue