animeflv: add fembed extractor (#192)
This commit is contained in:
committed by
GitHub
parent
b34aff92c3
commit
1275243b4a
@ -5,7 +5,7 @@ ext {
|
||||
extName = 'AnimeFLV'
|
||||
pkgNameSuffix = 'es.animeflv'
|
||||
extClass = '.AnimeFlv'
|
||||
extVersionCode = 6
|
||||
extVersionCode = 7
|
||||
libVersion = '12'
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import android.app.Application
|
||||
import android.content.SharedPreferences
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.tachiyomi.animeextension.es.animeflv.extractors.FembedExtractor
|
||||
import eu.kanade.tachiyomi.animeextension.es.animeflv.extractors.OkruExtractor
|
||||
import eu.kanade.tachiyomi.animeextension.es.animeflv.extractors.StreamTapeExtractor
|
||||
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
|
||||
@ -110,6 +111,10 @@ class AnimeFlv : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
for (server in sub.jsonArray) {
|
||||
val url = server.jsonObject["code"]!!.jsonPrimitive.content.replace("\\/", "/")
|
||||
val quality = server.jsonObject["title"]!!.jsonPrimitive.content
|
||||
if (quality == "Fembed") {
|
||||
val videos = FembedExtractor().videosFromUrl(url)
|
||||
videoList.addAll(videos)
|
||||
}
|
||||
if (quality == "Stape") {
|
||||
val video = StreamTapeExtractor(client).videoFromUrl(url, quality)
|
||||
if (video != null) {
|
||||
@ -191,9 +196,9 @@ class AnimeFlv : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val videoQualityPref = ListPreference(screen.context).apply {
|
||||
key = "preferred_quality"
|
||||
title = "Preferred quality"
|
||||
entries = arrayOf("Stape", "hd", "sd", "low", "lowest", "mobile")
|
||||
entryValues = arrayOf("Stape", "hd", "sd", "low", "lowest", "mobile")
|
||||
setDefaultValue("Stape")
|
||||
entries = arrayOf("Fembed:480p", "Fembed:720p", "Stape", "hd", "sd", "low", "lowest", "mobile")
|
||||
entryValues = arrayOf("Fembed:480p", "Fembed:720p", "Stape", "hd", "sd", "low", "lowest", "mobile")
|
||||
setDefaultValue("Fembed:720p")
|
||||
summary = "%s"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
|
@ -0,0 +1,24 @@
|
||||
package eu.kanade.tachiyomi.animeextension.es.animeflv.extractors
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import org.json.JSONObject
|
||||
import org.jsoup.Connection
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
class FembedExtractor {
|
||||
fun videosFromUrl(url: String): List<Video> {
|
||||
val videoApi = url.replace("/v/", "/api/source/")
|
||||
val json = JSONObject(Jsoup.connect(videoApi).ignoreContentType(true).method(Connection.Method.POST).execute().body())
|
||||
check(json.getBoolean("success")) { "Request was not succeeded" }
|
||||
val videoList = mutableListOf<Video>()
|
||||
|
||||
val jsonArray = json.getJSONArray("data")
|
||||
for (i in 0 until jsonArray.length()) {
|
||||
val `object` = jsonArray.getJSONObject(i)
|
||||
val videoUrl = `object`.getString("file")
|
||||
val quality = "Fembed:" + `object`.getString("label")
|
||||
videoList.add(Video(videoUrl, quality, videoUrl, null))
|
||||
}
|
||||
return videoList
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user