gogo: add server prefix to quality

This commit is contained in:
jmir1
2022-04-18 21:57:47 +02:00
parent 9a138ff9d7
commit 2cf8818dba
4 changed files with 14 additions and 12 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Gogoanime'
pkgNameSuffix = 'en.gogoanime'
extClass = '.GogoAnime'
extVersionCode = 38
extVersionCode = 39
libVersion = '12'
}

View File

@ -139,7 +139,7 @@ class GogoAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
private fun qualityToInt(quality: String): Int {
return try {
quality.substringBefore("p").toInt()
quality.filter { it.isDigit() }.toInt()
} catch (e: NumberFormatException) {
-100
}

View File

@ -31,6 +31,7 @@ class GogoCdnExtractor(private val client: OkHttpClient, private val json: Json)
val host = "https://" + httpUrl.host + "/"
val id = httpUrl.queryParameter("id") ?: throw Exception("error getting id")
val token = httpUrl.queryParameter("token")
val qualityPrefix = if (token != null) "Gogostream: " else "Vidstreaming: "
val tokenString = if (token != null) { "&token=$token&op=2" } else ""
val encryptedId = cryptoHandler(id, iv, secretKey)
@ -60,7 +61,7 @@ class GogoCdnExtractor(private val client: OkHttpClient, private val json: Json)
if (!videoUrl.startsWith("http")) {
videoUrl = fileURL.substringBeforeLast("/") + "/$videoUrl"
}
videoList.add(Video(videoUrl, quality, videoUrl, null))
videoList.add(Video(videoUrl, qualityPrefix + quality, videoUrl, null))
}
} else array.forEach {
val label = it.jsonObject["label"].toString().lowercase(Locale.ROOT)
@ -70,15 +71,17 @@ class GogoCdnExtractor(private val client: OkHttpClient, private val json: Json)
if (label == "auto") autoList.add(
Video(
fileURL,
label,
qualityPrefix + label,
fileURL,
null,
videoHeaders
)
)
else videoList.add(Video(fileURL, label, fileURL, null, videoHeaders))
else videoList.add(Video(fileURL, qualityPrefix + label, fileURL, null, videoHeaders))
}
return videoList.sortedByDescending { it.quality.substringBefore("p").toInt() } + autoList
return videoList.sortedByDescending {
it.quality.substringAfter(qualityPrefix).substringBefore("p").toIntOrNull() ?: -1
} + autoList
} catch (e: Exception) {
return emptyList()
}

View File

@ -21,7 +21,6 @@ import org.jsoup.nodes.Element
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.lang.Exception
import java.util.Locale
class Kuramanime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
override val name = "Kuramanime"
@ -76,22 +75,22 @@ class Kuramanime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
}
override fun episodeListSelector(): String = "#episodeLists"
override fun episodeListParse(response: Response): List<SEpisode> {
val document = response.asJsoup()
val html = document.select(episodeListSelector()).attr("data-content")
val jsoupE = Jsoup.parse(html)
return jsoupE.select("a").filter { ele -> !ele.attr("href").contains("batch") }.map { episodeFromElement(it) }
}
private fun parseShortInfo(element : Element): SAnime {
private fun parseShortInfo(element: Element): SAnime {
val anime = SAnime.create()
anime.setUrlWithoutDomain(element.select("a").first().attr("href"))
anime.thumbnail_url = element.select("a > div").first().attr("data-setbg")
anime.title = element.select("div.product__item__text > h5").text()
return anime
return anime
}
override fun latestUpdatesFromElement(element: Element): SAnime = parseShortInfo(element)
@ -171,4 +170,4 @@ class Kuramanime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
}
screen.addPreference(videoQualityPref)
}
}
}