gogo: add server prefix to quality
This commit is contained in:
@ -5,7 +5,7 @@ ext {
|
|||||||
extName = 'Gogoanime'
|
extName = 'Gogoanime'
|
||||||
pkgNameSuffix = 'en.gogoanime'
|
pkgNameSuffix = 'en.gogoanime'
|
||||||
extClass = '.GogoAnime'
|
extClass = '.GogoAnime'
|
||||||
extVersionCode = 38
|
extVersionCode = 39
|
||||||
libVersion = '12'
|
libVersion = '12'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ class GogoAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
|
|
||||||
private fun qualityToInt(quality: String): Int {
|
private fun qualityToInt(quality: String): Int {
|
||||||
return try {
|
return try {
|
||||||
quality.substringBefore("p").toInt()
|
quality.filter { it.isDigit() }.toInt()
|
||||||
} catch (e: NumberFormatException) {
|
} catch (e: NumberFormatException) {
|
||||||
-100
|
-100
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ class GogoCdnExtractor(private val client: OkHttpClient, private val json: Json)
|
|||||||
val host = "https://" + httpUrl.host + "/"
|
val host = "https://" + httpUrl.host + "/"
|
||||||
val id = httpUrl.queryParameter("id") ?: throw Exception("error getting id")
|
val id = httpUrl.queryParameter("id") ?: throw Exception("error getting id")
|
||||||
val token = httpUrl.queryParameter("token")
|
val token = httpUrl.queryParameter("token")
|
||||||
|
val qualityPrefix = if (token != null) "Gogostream: " else "Vidstreaming: "
|
||||||
val tokenString = if (token != null) { "&token=$token&op=2" } else ""
|
val tokenString = if (token != null) { "&token=$token&op=2" } else ""
|
||||||
|
|
||||||
val encryptedId = cryptoHandler(id, iv, secretKey)
|
val encryptedId = cryptoHandler(id, iv, secretKey)
|
||||||
@ -60,7 +61,7 @@ class GogoCdnExtractor(private val client: OkHttpClient, private val json: Json)
|
|||||||
if (!videoUrl.startsWith("http")) {
|
if (!videoUrl.startsWith("http")) {
|
||||||
videoUrl = fileURL.substringBeforeLast("/") + "/$videoUrl"
|
videoUrl = fileURL.substringBeforeLast("/") + "/$videoUrl"
|
||||||
}
|
}
|
||||||
videoList.add(Video(videoUrl, quality, videoUrl, null))
|
videoList.add(Video(videoUrl, qualityPrefix + quality, videoUrl, null))
|
||||||
}
|
}
|
||||||
} else array.forEach {
|
} else array.forEach {
|
||||||
val label = it.jsonObject["label"].toString().lowercase(Locale.ROOT)
|
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(
|
if (label == "auto") autoList.add(
|
||||||
Video(
|
Video(
|
||||||
fileURL,
|
fileURL,
|
||||||
label,
|
qualityPrefix + label,
|
||||||
fileURL,
|
fileURL,
|
||||||
null,
|
null,
|
||||||
videoHeaders
|
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) {
|
} catch (e: Exception) {
|
||||||
return emptyList()
|
return emptyList()
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ import org.jsoup.nodes.Element
|
|||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import java.lang.Exception
|
import java.lang.Exception
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
class Kuramanime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
class Kuramanime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||||
override val name = "Kuramanime"
|
override val name = "Kuramanime"
|
||||||
@ -76,22 +75,22 @@ class Kuramanime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun episodeListSelector(): String = "#episodeLists"
|
override fun episodeListSelector(): String = "#episodeLists"
|
||||||
|
|
||||||
override fun episodeListParse(response: Response): List<SEpisode> {
|
override fun episodeListParse(response: Response): List<SEpisode> {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
|
|
||||||
val html = document.select(episodeListSelector()).attr("data-content")
|
val html = document.select(episodeListSelector()).attr("data-content")
|
||||||
val jsoupE = Jsoup.parse(html)
|
val jsoupE = Jsoup.parse(html)
|
||||||
|
|
||||||
return jsoupE.select("a").filter { ele -> !ele.attr("href").contains("batch") }.map { episodeFromElement(it) }
|
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()
|
val anime = SAnime.create()
|
||||||
anime.setUrlWithoutDomain(element.select("a").first().attr("href"))
|
anime.setUrlWithoutDomain(element.select("a").first().attr("href"))
|
||||||
anime.thumbnail_url = element.select("a > div").first().attr("data-setbg")
|
anime.thumbnail_url = element.select("a > div").first().attr("data-setbg")
|
||||||
anime.title = element.select("div.product__item__text > h5").text()
|
anime.title = element.select("div.product__item__text > h5").text()
|
||||||
return anime
|
return anime
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun latestUpdatesFromElement(element: Element): SAnime = parseShortInfo(element)
|
override fun latestUpdatesFromElement(element: Element): SAnime = parseShortInfo(element)
|
||||||
@ -171,4 +170,4 @@ class Kuramanime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
}
|
}
|
||||||
screen.addPreference(videoQualityPref)
|
screen.addPreference(videoQualityPref)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user