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) {
|
||||
fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
|
||||
val videoApi = url.replace("/v/", "/api/source/")
|
||||
val body = client.newCall(POST(videoApi)).execute()
|
||||
.body?.string().orEmpty()
|
||||
val body = runCatching {
|
||||
client.newCall(POST(videoApi)).execute().body?.string().orEmpty()
|
||||
}.getOrNull() ?: return emptyList<Video>()
|
||||
|
||||
val jsonResponse = Json { ignoreUnknownKeys = true }
|
||||
.decodeFromString<FembedResponse>(body)
|
||||
|
@ -170,10 +170,8 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
StreamTapeExtractor(client)
|
||||
.videoFromUrl(url, "StreamTape($langPrefix)")?.let(::listOf)
|
||||
name == "fembed" ->
|
||||
runCatching {
|
||||
FembedExtractor(client)
|
||||
.videosFromUrl(url, langPrefix)
|
||||
}.getOrNull()
|
||||
FembedExtractor(client)
|
||||
.videosFromUrl(url, langPrefix)
|
||||
else -> null
|
||||
}
|
||||
}.flatten()
|
||||
|
Reference in New Issue
Block a user