Fix ok.ru server and add Mytv extractor [Vostfree] (#360)
This commit is contained in:
committed by
GitHub
parent
9af2654cf1
commit
642dc36f2a
@ -5,7 +5,7 @@ ext {
|
||||
extName = 'Vostfree'
|
||||
pkgNameSuffix = 'fr.vostfree'
|
||||
extClass = '.Vostfree'
|
||||
extVersionCode = 1
|
||||
extVersionCode = 2
|
||||
libVersion = '12'
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import android.util.Log
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.tachiyomi.animeextension.fr.vostfree.extractors.DoodExtractor
|
||||
import eu.kanade.tachiyomi.animeextension.fr.vostfree.extractors.MytvExtractor
|
||||
import eu.kanade.tachiyomi.animeextension.fr.vostfree.extractors.OkruExtractor
|
||||
import eu.kanade.tachiyomi.animeextension.fr.vostfree.extractors.VudeoExtractor
|
||||
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
|
||||
@ -111,7 +112,7 @@ class Vostfree : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val video = VudeoExtractor(client).videosFromUrl(url)
|
||||
videoList.addAll(video)
|
||||
}
|
||||
if (server == "OK") {
|
||||
if (server == "Ok" || server == "OK") {
|
||||
val playerId = it.attr("id")
|
||||
val url = "https://ok.ru/videoembed/" + document.select("div#player-tabs div.tab-blocks div.tab-content div div#content_$playerId").text()
|
||||
val video = OkruExtractor(client).videosFromUrl(url)
|
||||
@ -125,8 +126,13 @@ class Vostfree : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
videoList.add(video)
|
||||
}
|
||||
}
|
||||
if (server == "Mytv" || server == "Stream") {
|
||||
val playerId = it.attr("id")
|
||||
val url = "https://www.myvi.tv/embed/" + document.select("div#player-tabs div.tab-blocks div.tab-content div div#content_$playerId").text()
|
||||
val video = MytvExtractor(client).videosFromUrl(url)
|
||||
videoList.addAll(video)
|
||||
}
|
||||
}
|
||||
Log.i("bruh", "test1")
|
||||
|
||||
return videoList
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
package eu.kanade.tachiyomi.animeextension.fr.vostfree.extractors
|
||||
|
||||
import android.util.Log
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class MytvExtractor(private val client: OkHttpClient) {
|
||||
fun videosFromUrl(url: String): List<Video> {
|
||||
val document = client.newCall(GET(url)).execute().asJsoup()
|
||||
val videoList = mutableListOf<Video>()
|
||||
document.select("script").forEach { script ->
|
||||
if (script.data().contains("CreatePlayer(\"v")) {
|
||||
val videosString = script.data().toString()
|
||||
val videoUrl = videosString.substringAfter("\"v=").substringBefore("\\u0026tp=video").replace("%26", "&").replace("%3a", ":").replace("%2f", "/").replace("%3f", "?").replace("%3d", "=")
|
||||
Log.i("bruh", "URL: $videoUrl")
|
||||
if (!videoUrl.contains("https:")) {
|
||||
val videoUrl = "https:$videoUrl"
|
||||
videoList.add(Video(videoUrl, "Stream", videoUrl, null))
|
||||
} else {
|
||||
videoList.add(Video(videoUrl, "Mytv", videoUrl, null))
|
||||
}
|
||||
}
|
||||
}
|
||||
return videoList
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user