[PelisPLusHD] Fix StreamSB extractor, fix videourl extractor and add StreamTape ext… (#462)

* Fix StreamSB extractor, fix videourl extractor and add StreamTape extractor

* Update build.gradle
This commit is contained in:
Diego Peña Y Lillo
2022-04-05 17:25:44 -04:00
committed by GitHub
parent 02a580610a
commit f9267d4237
4 changed files with 58 additions and 29 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Pelisplushd'
pkgNameSuffix = 'es.pelisplushd'
extClass = '.Pelisplushd'
extVersionCode = 5
extVersionCode = 6
libVersion = '12'
}

View File

@ -8,6 +8,7 @@ import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.animeextension.es.pelisplushd.extractors.DoodExtractor
import eu.kanade.tachiyomi.animeextension.es.pelisplushd.extractors.FembedExtractor
import eu.kanade.tachiyomi.animeextension.es.pelisplushd.extractors.StreamSBExtractor
import eu.kanade.tachiyomi.animeextension.es.pelisplushd.extractors.StreamTapeExtractor
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
import eu.kanade.tachiyomi.animesource.model.AnimeFilter
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
@ -20,7 +21,6 @@ import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import uy.kohesive.injekt.Injekt
@ -97,39 +97,50 @@ class Pelisplushd : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
document.select("ul.TbVideoNv li").forEach { it ->
val server = it.select("a").text()
val option = it.attr("data-id")
document.select("script").forEach() { script ->
if (script.data().contains("video[1] =")) {
if (server == "PlusTo") {
val iframeUrl = script.data().substringAfter("video[$option] = '").substringBefore("';")
val jsoup = Jsoup.connect(iframeUrl).get()
val url = jsoup.select("iframe").attr("src").replace("#caption=&poster=#", "")
Log.i("bruh", "$url")
Log.i("bruh", "$option : $server")
document.select("div.page-container div#link_url span").forEach() { servers ->
if (servers.attr("lid") == option && server == "PlusTo") {
val url = servers.attr("url")
Log.i("bruh", "id:${servers.attr("lid")} server:$server Url: $url")
val videos = FembedExtractor().videosFromUrl(url)
videoList.addAll(videos)
}
if (server == "DoodStream") {
val url = script.data().substringAfter("video[$option] = '").substringBefore("';")
//probably the conditions are redundant idk
if (servers.attr("lid") == option && server == "DoFast" || servers.attr("lid") == option && server == "DoodStream") {
val url = servers.attr("url").replace("doodstream.com", "dood.so")
Log.i("bruh", "id:${servers.attr("lid")} server:$server Url1: $url")
val video = try { DoodExtractor(client).videoFromUrl(url, "DoodStream") } catch (e: Exception) { null }
if (video != null) {
videoList.add(video)
}
}
if (server == "SBFast") {
val url = script.data().substringAfter("video[$option] = '").substringBefore("';")
if (servers.attr("lid") == option && server == "FastTape" || servers.attr("lid") == option && server == "StreamTape") {
val url = servers.attr("url")
Log.i("bruh", "id:${servers.attr("lid")} server:$server Url1: $url")
val video = StreamTapeExtractor(client).videoFromUrl(url, "StreamTape")
if (video != null) {
videoList.add(video)
}
}
if (servers.attr("lid") == option && server == "SBFast" || servers.attr("lid") == option && server == "SBFas") {
val url = servers.attr("url")
Log.i("bruh", "id:${servers.attr("lid")} server:$server Url2: $url")
val headers = headers.newBuilder()
.set("Referer", url)
.set("User-Agent", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0")
.set("Accept-Language", "en-US,en;q=0.5")
.set("watchsb", "streamsb")
.build()
val video = StreamSBExtractor(client).videosFromUrl(url, headers)
val video = try { StreamSBExtractor(client).videosFromUrl(url, headers) } catch (e: Exception) { null }
if (video != null) {
videoList.addAll(video)
}
}
}
}
return videoList
}

View File

@ -26,7 +26,7 @@ class StreamSBExtractor(private val client: OkHttpClient) {
}
fun videosFromUrl(url: String, headers: Headers): List<Video> {
val id = url.substringAfter("embed-").substringBefore(".html")
val id = url.substringAfter("embed-").substringBefore(".html").substringAfter("/e/")
Log.i("id", id)
val bytes = id.toByteArray()
Log.i("bytes", "$bytes")

View File

@ -0,0 +1,18 @@
package eu.kanade.tachiyomi.animeextension.es.pelisplushd.extractors
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.OkHttpClient
class StreamTapeExtractor(private val client: OkHttpClient) {
fun videoFromUrl(url: String, quality: String): Video? {
val document = client.newCall(GET(url)).execute().asJsoup()
val script = document.select("script:containsData(document.getElementById('robotlink'))")
.firstOrNull()?.data()?.substringAfter("document.getElementById('robotlink').innerHTML = '")
?: return null
val videoUrl = "https:" + script.substringBefore("'") +
script.substringAfter("+ ('xcd").substringBefore("'")
return Video(url, quality, videoUrl, null)
}
}