fixed tracker in Samehadaku

This commit is contained in:
hexated 2023-01-18 04:27:26 +07:00
parent 4edcde11b0
commit dbfff2f329
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 5
version = 6
cloudstream {

View File

@ -101,7 +101,7 @@ class Samehadaku : MainAPI() {
}
val document = app.get(fixUrl ?: return null).document
val title = document.selectFirst("h1.entry-title")?.text()?.removeSurrounding("Nonton", "Subtitle Indonesia")?.trim() ?: return null
val title = document.selectFirst("h1.entry-title")?.text()?.removeBloat() ?: return null
val poster = document.selectFirst("div.thumb > img")?.attr("src")
val tags = document.select("div.genre-info > a").map { it.text() }
val year = document.selectFirst("div.spe > span:contains(Rilis)")?.ownText()?.let {
@ -180,6 +180,10 @@ class Samehadaku : MainAPI() {
return true
}
private fun String.removeBloat() : String{
return this.replace(Regex("(Nonton)|(Anime)|(Subtitle\\sIndonesia)"), "").trim()
}
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 ->