Add DUB option [AnimeFLV] (#386)
This commit is contained in:
committed by
GitHub
parent
5a74917cd9
commit
ee02a35ac0
@ -5,7 +5,7 @@ ext {
|
|||||||
extName = 'AnimeFLV'
|
extName = 'AnimeFLV'
|
||||||
pkgNameSuffix = 'es.animeflv'
|
pkgNameSuffix = 'es.animeflv'
|
||||||
extClass = '.AnimeFlv'
|
extClass = '.AnimeFlv'
|
||||||
extVersionCode = 12
|
extVersionCode = 13
|
||||||
libVersion = '12'
|
libVersion = '12'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.animeextension.es.animeflv
|
|||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.util.Log
|
||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import eu.kanade.tachiyomi.animeextension.es.animeflv.extractors.FembedExtractor
|
import eu.kanade.tachiyomi.animeextension.es.animeflv.extractors.FembedExtractor
|
||||||
@ -108,6 +109,7 @@ class AnimeFlv : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
val data = script.data().substringAfter("var videos = ").substringBefore(";")
|
val data = script.data().substringAfter("var videos = ").substringBefore(";")
|
||||||
val jsonObject = json.decodeFromString<JsonObject>(data)
|
val jsonObject = json.decodeFromString<JsonObject>(data)
|
||||||
val sub = jsonObject["SUB"]!!
|
val sub = jsonObject["SUB"]!!
|
||||||
|
val lat = jsonObject["LAT"]!!
|
||||||
if (sub !is JsonNull) {
|
if (sub !is JsonNull) {
|
||||||
for (server in sub.jsonArray) {
|
for (server in sub.jsonArray) {
|
||||||
val url = server.jsonObject["code"]!!.jsonPrimitive.content.replace("\\/", "/")
|
val url = server.jsonObject["code"]!!.jsonPrimitive.content.replace("\\/", "/")
|
||||||
@ -138,6 +140,22 @@ class AnimeFlv : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (lat !is JsonNull) {
|
||||||
|
for (server in lat.jsonArray) {
|
||||||
|
val url = server.jsonObject["code"]!!.jsonPrimitive.content.replace("\\/", "/")
|
||||||
|
val quality = server.jsonObject["title"]!!.jsonPrimitive.content
|
||||||
|
|
||||||
|
if (quality == "Fembed") {
|
||||||
|
val videos = FembedExtractor().videosFromUrl(url, "DUB: ")
|
||||||
|
videoList.addAll(videos)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quality == "Okru") {
|
||||||
|
val videos = OkruExtractor(client).videosFromUrl(url, "DUB: ")
|
||||||
|
videoList.addAll(videos)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return videoList
|
return videoList
|
||||||
|
@ -6,17 +6,18 @@ import org.jsoup.Connection
|
|||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
|
|
||||||
class FembedExtractor {
|
class FembedExtractor {
|
||||||
fun videosFromUrl(url: String): List<Video> {
|
fun videosFromUrl(url: String, qualityPrefix: String = ""): List<Video> {
|
||||||
val videoApi = url.replace("/v/", "/api/source/")
|
val videoApi = url.replace("/v/", "/api/source/")
|
||||||
val json = JSONObject(Jsoup.connect(videoApi).ignoreContentType(true).method(Connection.Method.POST).execute().body())
|
val json = JSONObject(Jsoup.connect(videoApi).ignoreContentType(true).method(Connection.Method.POST).execute().body())
|
||||||
val videoList = mutableListOf<Video>()
|
val videoList = mutableListOf<Video>()
|
||||||
|
val prefix = qualityPrefix
|
||||||
if (json.getBoolean("success")) {
|
if (json.getBoolean("success")) {
|
||||||
val videoList = mutableListOf<Video>()
|
val videoList = mutableListOf<Video>()
|
||||||
val jsonArray = json.getJSONArray("data")
|
val jsonArray = json.getJSONArray("data")
|
||||||
for (i in 0 until jsonArray.length()) {
|
for (i in 0 until jsonArray.length()) {
|
||||||
val `object` = jsonArray.getJSONObject(i)
|
val `object` = jsonArray.getJSONObject(i)
|
||||||
val videoUrl = `object`.getString("file")
|
val videoUrl = `object`.getString("file")
|
||||||
val quality = "Fembed:" + `object`.getString("label")
|
val quality = prefix + "Fembed:" + `object`.getString("label")
|
||||||
videoList.add(Video(videoUrl, quality, videoUrl, null))
|
videoList.add(Video(videoUrl, quality, videoUrl, null))
|
||||||
}
|
}
|
||||||
return videoList
|
return videoList
|
||||||
|
@ -6,7 +6,7 @@ import eu.kanade.tachiyomi.util.asJsoup
|
|||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
|
||||||
class OkruExtractor(private val client: OkHttpClient) {
|
class OkruExtractor(private val client: OkHttpClient) {
|
||||||
fun videosFromUrl(url: String): List<Video> {
|
fun videosFromUrl(url: String, qualityPrefix: String = ""): List<Video> {
|
||||||
val document = client.newCall(GET(url)).execute().asJsoup()
|
val document = client.newCall(GET(url)).execute().asJsoup()
|
||||||
val videoList = mutableListOf<Video>()
|
val videoList = mutableListOf<Video>()
|
||||||
val videosString = document.select("div[data-options]").attr("data-options")
|
val videosString = document.select("div[data-options]").attr("data-options")
|
||||||
@ -16,7 +16,7 @@ class OkruExtractor(private val client: OkHttpClient) {
|
|||||||
val videoUrl = it.substringAfter("url\\\":\\\"")
|
val videoUrl = it.substringAfter("url\\\":\\\"")
|
||||||
.substringBefore("\\\"")
|
.substringBefore("\\\"")
|
||||||
.replace("\\\\u0026", "&")
|
.replace("\\\\u0026", "&")
|
||||||
val videoQuality = "Okru: " + it.substringBefore("\\\"")
|
val videoQuality = qualityPrefix + "Okru: " + it.substringBefore("\\\"")
|
||||||
if (videoUrl.startsWith("https://")) {
|
if (videoUrl.startsWith("https://")) {
|
||||||
videoList.add(Video(videoUrl, videoQuality, videoUrl, null))
|
videoList.add(Video(videoUrl, videoQuality, videoUrl, null))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user