Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Jan 1, 2024
1 parent 4643275 commit 4c14b60
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 68 deletions.
2 changes: 1 addition & 1 deletion Anilibria/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 2
version = 3


cloudstream {
Expand Down
52 changes: 5 additions & 47 deletions Anilibria/src/main/kotlin/com/hexated/Anilibria.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,13 @@ class Anilibria : MainAPI() {
val document = app.get(url).document

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()
val enTitle = (document.selectFirst("h1.release-title br")?.nextSibling()
?: document.selectFirst("h1.release-title")?.text()?.substringAfter("/")?.trim()).toString()
val poster = fixUrlNull(document.selectFirst("img#adminPoster")?.attr("src"))
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()
?.substringAfter("file:[")?.substringBefore("],")?.let { data ->
tryParseJson<List<Episodes>>("[$data]")?.mapNotNull { eps ->
Expand All @@ -106,15 +102,14 @@ class Anilibria : MainAPI() {
}
}
return newAnimeLoadResponse(title, url, getType(type)) {
posterUrl = image ?: poster
backgroundPosterUrl = cover ?: image ?: poster
japName = enTitle
posterUrl = poster
backgroundPosterUrl = poster
this.year = year
addEpisodes(DubStatus.Subbed, episodes)
plot = document.select("p.detail-description").text().trim()
this.tags = document.selectFirst("div#xreleaseInfo b:contains(Жанры:)")?.nextSibling()
.toString().split(",").map { it.trim() }
addMalId(malId)
addAniListId(anilistId?.toIntOrNull())
}
}

Expand Down Expand Up @@ -143,43 +138,6 @@ class Anilibria : MainAPI() {
return true
}

private suspend fun getTracker(title: String?, type: String?, year: Int?): Tracker {
val res = app.get("https://consumet-instance.vercel.app/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(
@JsonProperty("file") val file: String? = null,
@JsonProperty("title") val title: String? = null,
Expand Down
20 changes: 10 additions & 10 deletions SoraStream/src/main/kotlin/com/hexated/SoraStream.kt
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,16 @@ open class SoraStream : TmdbProvider() {
val res = parseJson<LinkData>(data)

argamap(
{
invokeFebbox(
res.title,
res.year,
res.season,
res.lastSeason,
res.episode,
callback
)
},
// {
// invokeFebbox(
// res.title,
// res.year,
// res.season,
// res.lastSeason,
// res.episode,
// callback
// )
// },
{
invokeDumpStream(
res.title,
Expand Down
20 changes: 10 additions & 10 deletions SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ class SoraStreamLite : SoraStream() {
val res = AppUtils.parseJson<LinkData>(data)

argamap(
{
invokeFebbox(
res.title,
res.year,
res.season,
res.lastSeason,
res.episode,
callback
)
},
// {
// invokeFebbox(
// res.title,
// res.year,
// res.season,
// res.lastSeason,
// res.episode,
// callback
// )
// },
{
if (!res.isAnime) invokeWatchsomuch(
res.imdbId,
Expand Down

0 comments on commit 4c14b60

Please sign in to comment.