Fembed extractor updated & LocoPelis updates (#1124)

- Functionality for the Fembed extractor to redirect to a mirror link and then extract the videos.
This commit is contained in:
miguelantonioe
2022-12-31 02:57:28 -06:00
committed by GitHub
parent 16f4a69903
commit 83dbe38336
3 changed files with 10 additions and 4 deletions

View File

@ -1,14 +1,20 @@
package eu.kanade.tachiyomi.lib.fembedextractor
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import okhttp3.OkHttpClient
class FembedExtractor(private val client: OkHttpClient) {
fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
val videoApi = url.replace("/v/", "/api/source/")
fun videosFromUrl(url: String, prefix: String = "", redirect: Boolean = false): List<Video> {
val videoApi = if (redirect) {
(runCatching { client.newCall(GET(url)).execute().request.url.toString()
.replace("/v/", "/api/source/") }.getOrNull() ?: return emptyList<Video>())
} else {
url.replace("/v/", "/api/source/")
}
val body = runCatching {
client.newCall(POST(videoApi)).execute().body?.string().orEmpty()
}.getOrNull() ?: return emptyList<Video>()

View File

@ -5,7 +5,7 @@ ext {
extName = 'LocoPelis'
pkgNameSuffix = 'es.locopelis'
extClass = '.LocoPelis'
extVersionCode = 1
extVersionCode = 2
libVersion = '13'
}

View File

@ -126,7 +126,7 @@ class LocoPelis : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
embedUrl.contains("diampokusy.com") || embedUrl.contains("i18n.pw") || embedUrl.contains("vanfem.com") ||
embedUrl.contains("fembed9hd.com") || embedUrl.contains("votrefilms.xyz") || embedUrl.contains("watchjavnow.xyz")
) {
val videos = FembedExtractor(client).videosFromUrl(url)
val videos = FembedExtractor(client).videosFromUrl(url, redirect = true)
videoList.addAll(videos)
}
if (url.lowercase().contains("streamtape")) {