FembedExtractor: Prevent cloudflare problems (#969)
Vizer: Remove unnecessary runCatching block
This commit is contained in:
@ -9,8 +9,9 @@ import okhttp3.OkHttpClient
|
|||||||
class FembedExtractor(private val client: OkHttpClient) {
|
class FembedExtractor(private val client: OkHttpClient) {
|
||||||
fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
|
fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
|
||||||
val videoApi = url.replace("/v/", "/api/source/")
|
val videoApi = url.replace("/v/", "/api/source/")
|
||||||
val body = client.newCall(POST(videoApi)).execute()
|
val body = runCatching {
|
||||||
.body?.string().orEmpty()
|
client.newCall(POST(videoApi)).execute().body?.string().orEmpty()
|
||||||
|
}.getOrNull() ?: return emptyList<Video>()
|
||||||
|
|
||||||
val jsonResponse = Json { ignoreUnknownKeys = true }
|
val jsonResponse = Json { ignoreUnknownKeys = true }
|
||||||
.decodeFromString<FembedResponse>(body)
|
.decodeFromString<FembedResponse>(body)
|
||||||
|
@ -170,10 +170,8 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
StreamTapeExtractor(client)
|
StreamTapeExtractor(client)
|
||||||
.videoFromUrl(url, "StreamTape($langPrefix)")?.let(::listOf)
|
.videoFromUrl(url, "StreamTape($langPrefix)")?.let(::listOf)
|
||||||
name == "fembed" ->
|
name == "fembed" ->
|
||||||
runCatching {
|
FembedExtractor(client)
|
||||||
FembedExtractor(client)
|
.videosFromUrl(url, langPrefix)
|
||||||
.videosFromUrl(url, langPrefix)
|
|
||||||
}.getOrNull()
|
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}.flatten()
|
}.flatten()
|
||||||
|
Reference in New Issue
Block a user