refactor(src/es): Improvements for the main spanish extensions (#2446)
This commit is contained in:
@ -6,14 +6,17 @@ import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class VoeExtractor(private val client: OkHttpClient) {
|
||||
fun videoFromUrl(url: String, quality: String? = null): Video? {
|
||||
fun videoFromUrl(url: String, quality: String? = null, prefix: String = ""): Video? {
|
||||
val document = client.newCall(GET(url)).execute().asJsoup()
|
||||
val script = document.selectFirst("script:containsData(const sources),script:containsData(var sources)")
|
||||
?.data()
|
||||
?: return null
|
||||
val videoUrl = script.substringAfter("hls': '").substringBefore("'")
|
||||
val resolution = script.substringAfter("video_height': ").substringBefore(",")
|
||||
val qualityStr = quality ?: "VoeCDN(${resolution}p)"
|
||||
val qualityStr = when {
|
||||
prefix.isNotEmpty() -> "$prefix${resolution}p"
|
||||
else -> quality ?: "VoeCDN(${resolution}p)"
|
||||
}
|
||||
return Video(url, qualityStr, videoUrl)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user