aniflix: fix issue with one hoster not working

This commit is contained in:
jmir1
2021-11-29 21:42:01 +01:00
parent ad63421a15
commit 3e30a22d2d
4 changed files with 9 additions and 8 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Aniflix'
pkgNameSuffix = 'de.aniflix'
extClass = '.Aniflix'
extVersionCode = 6
extVersionCode = 7
libVersion = '12'
}

View File

@ -171,8 +171,10 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
val hosterSelection = preferences.getStringSet("hoster_selection", null)
when {
link.contains("https://dood") && hosterSelection?.contains("dood") == true -> {
val video = DoodExtractor(client).videoFromUrl(link, quality)
videoList.add(video)
val video = try { DoodExtractor(client).videoFromUrl(link, quality) } catch (e: Exception) { null }
if (video != null) {
videoList.add(video)
}
}
link.contains("https://streamtape") && hosterSelection?.contains("stape") == true -> {
val video = StreamTapeExtractor(client).videoFromUrl(link, quality)

View File

@ -5,12 +5,12 @@ import eu.kanade.tachiyomi.network.GET
import okhttp3.Headers
import okhttp3.OkHttpClient
class DoodExtractor(val client: OkHttpClient) {
fun videoFromUrl(url: String, quality: String): Video {
class DoodExtractor(private val client: OkHttpClient) {
fun videoFromUrl(url: String, quality: String): Video? {
val response = client.newCall(GET(url)).execute()
val doodTld = url.substringAfter("https://dood.").substringBefore("/")
val content = response.body!!.string()
if (!content.contains("'/pass_md5/")) throw Exception("Error with doodstream mirror")
if (!content.contains("'/pass_md5/")) return null
val md5 = content.substringAfter("'/pass_md5/").substringBefore("',")
val token = md5.substringAfterLast("/")
val randomString = getRandomString()

View File

@ -5,9 +5,8 @@ import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.OkHttpClient
class StreamTapeExtractor(val client: OkHttpClient) {
class StreamTapeExtractor(private val client: OkHttpClient) {
fun videoFromUrl(url: String, quality: String): Video? {
val id = url.substringAfterLast("/")
val document = client.newCall(GET(url)).execute().asJsoup()
val script = document.select("script:containsData(document.getElementById('robotlink'))")
.firstOrNull()?.data()?.substringAfter("document.getElementById('robotlink').innerHTML = '")