feat(id/otakudesu): Add FileLions extractor + fix video sorting (#2420)
This commit is contained in:
@ -7,12 +7,13 @@ ext {
|
|||||||
extName = 'OtakuDesu'
|
extName = 'OtakuDesu'
|
||||||
pkgNameSuffix = 'id.otakudesu'
|
pkgNameSuffix = 'id.otakudesu'
|
||||||
extClass = '.OtakuDesu'
|
extClass = '.OtakuDesu'
|
||||||
extVersionCode = 20
|
extVersionCode = 21
|
||||||
libVersion = '13'
|
libVersion = '13'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":lib-yourupload-extractor"))
|
implementation(project(":lib-yourupload-extractor"))
|
||||||
|
implementation(project(":lib-streamwish-extractor"))
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.animeextension.id.otakudesu
|
package eu.kanade.tachiyomi.animeextension.id.otakudesu
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.SharedPreferences
|
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
@ -13,6 +12,7 @@ import eu.kanade.tachiyomi.animesource.model.SAnime
|
|||||||
import eu.kanade.tachiyomi.animesource.model.SEpisode
|
import eu.kanade.tachiyomi.animesource.model.SEpisode
|
||||||
import eu.kanade.tachiyomi.animesource.model.Video
|
import eu.kanade.tachiyomi.animesource.model.Video
|
||||||
import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource
|
import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource
|
||||||
|
import eu.kanade.tachiyomi.lib.streamwishextractor.StreamWishExtractor
|
||||||
import eu.kanade.tachiyomi.lib.youruploadextractor.YourUploadExtractor
|
import eu.kanade.tachiyomi.lib.youruploadextractor.YourUploadExtractor
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.network.POST
|
import eu.kanade.tachiyomi.network.POST
|
||||||
@ -22,7 +22,6 @@ import kotlinx.coroutines.async
|
|||||||
import kotlinx.coroutines.awaitAll
|
import kotlinx.coroutines.awaitAll
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import okhttp3.FormBody
|
import okhttp3.FormBody
|
||||||
import okhttp3.OkHttpClient
|
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
@ -44,9 +43,9 @@ class OtakuDesu : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
|
|
||||||
override val supportsLatest = true
|
override val supportsLatest = true
|
||||||
|
|
||||||
override val client: OkHttpClient = network.cloudflareClient
|
override val client = network.cloudflareClient
|
||||||
|
|
||||||
private val preferences: SharedPreferences by lazy {
|
private val preferences by lazy {
|
||||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,9 +60,9 @@ class OtakuDesu : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
author = info.getInfo("Produser")
|
author = info.getInfo("Produser")
|
||||||
|
|
||||||
description = buildString {
|
description = buildString {
|
||||||
info.getInfo("Japanese", false)?.let { append("$it\n") }
|
info.getInfo("Japanese", false)?.also { append("$it\n") }
|
||||||
info.getInfo("Skor", false)?.let { append("$it\n") }
|
info.getInfo("Skor", false)?.also { append("$it\n") }
|
||||||
info.getInfo("Total Episode", false)?.let { append("$it\n") }
|
info.getInfo("Total Episode", false)?.also { append("$it\n") }
|
||||||
append("\n\nSynopsis:\n")
|
append("\n\nSynopsis:\n")
|
||||||
document.select("div.sinopc > p").eachText().forEach { append("$it\n\n") }
|
document.select("div.sinopc > p").eachText().forEach { append("$it\n\n") }
|
||||||
}
|
}
|
||||||
@ -217,7 +216,7 @@ class OtakuDesu : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
|
|
||||||
val doc = client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", body = form))
|
val doc = client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", body = form))
|
||||||
.execute()
|
.execute()
|
||||||
.body.string()
|
.use { it.body.string() }
|
||||||
.substringAfter(":\"")
|
.substringAfter(":\"")
|
||||||
.substringBefore('"')
|
.substringBefore('"')
|
||||||
.b64Decode()
|
.b64Decode()
|
||||||
@ -228,12 +227,18 @@ class OtakuDesu : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
return Pair(quality, url)
|
return Pair(quality, url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val filelionsExtractor by lazy { StreamWishExtractor(client, headers) }
|
||||||
|
private val yourUploadExtractor by lazy { YourUploadExtractor(client) }
|
||||||
|
|
||||||
private fun getVideosFromEmbed(quality: String, link: String): List<Video> {
|
private fun getVideosFromEmbed(quality: String, link: String): List<Video> {
|
||||||
return when {
|
return when {
|
||||||
|
"filelions" in link -> {
|
||||||
|
filelionsExtractor.videosFromUrl(link, videoNameGen = { "FileLions - $it" })
|
||||||
|
}
|
||||||
"yourupload" in link -> {
|
"yourupload" in link -> {
|
||||||
val id = link.substringAfter("id=").substringBefore("&")
|
val id = link.substringAfter("id=").substringBefore("&")
|
||||||
val url = "https://yourupload.com/embed/$id"
|
val url = "https://yourupload.com/embed/$id"
|
||||||
YourUploadExtractor(client).videoFromUrl(url, headers, "YourUpload - $quality")
|
yourUploadExtractor.videoFromUrl(url, headers, "YourUpload - $quality")
|
||||||
}
|
}
|
||||||
"desustream" in link -> {
|
"desustream" in link -> {
|
||||||
client.newCall(GET(link, headers)).execute().use {
|
client.newCall(GET(link, headers)).execute().use {
|
||||||
@ -361,7 +366,7 @@ class OtakuDesu : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
override fun List<Video>.sort(): List<Video> {
|
override fun List<Video>.sort(): List<Video> {
|
||||||
val quality = preferences.getString(PREF_QUALITY_KEY, PREF_QUALITY_DEFAULT)!!
|
val quality = preferences.getString(PREF_QUALITY_KEY, PREF_QUALITY_DEFAULT)!!
|
||||||
return sortedWith(
|
return sortedWith(
|
||||||
compareByDescending { it.quality.equals(quality) },
|
compareByDescending { it.quality.contains(quality) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user