fix(es/hackstore): Video empty (#2898)
Co-authored-by: Secozzi <49240133+Secozzi@users.noreply.github.com>
This commit is contained in:
parent
c9629f7e60
commit
be0a2bb590
@ -1,7 +1,7 @@
|
|||||||
ext {
|
ext {
|
||||||
extName = 'Hackstore'
|
extName = 'Hackstore'
|
||||||
extClass = '.Hackstore'
|
extClass = '.Hackstore'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
@ -21,6 +21,7 @@ import eu.kanade.tachiyomi.network.GET
|
|||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
import org.jsoup.Jsoup
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
@ -195,22 +196,30 @@ class Hackstore : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
override fun episodeFromElement(element: Element): SEpisode { throw UnsupportedOperationException() }
|
override fun episodeFromElement(element: Element): SEpisode { throw UnsupportedOperationException() }
|
||||||
|
|
||||||
// ============================ Video Links =============================
|
// ============================ Video Links =============================
|
||||||
|
private fun extractUrlFromDonFunction(fullUrl: String): String {
|
||||||
|
val response = client.newCall(GET(fullUrl, headers)).execute()
|
||||||
|
val body = response.body.string()
|
||||||
|
val document = Jsoup.parse(body)
|
||||||
|
val scriptElement = document.selectFirst("script:containsData(function don())")
|
||||||
|
val urlPattern = Regex("window\\.location\\.href\\s*=\\s*'([^']+)'")
|
||||||
|
val matchResult = scriptElement?.data()?.let { urlPattern.find(it) }
|
||||||
|
return matchResult?.groupValues?.get(1) ?: "url not found"
|
||||||
|
}
|
||||||
|
|
||||||
override fun videoListParse(response: Response): List<Video> {
|
override fun videoListParse(response: Response): List<Video> {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
val videoList = mutableListOf<Video>()
|
val videoList = mutableListOf<Video>()
|
||||||
|
|
||||||
val table = document.select("table.episodes")
|
val tabs = document.select("ul.TbVideoNv li.pres")
|
||||||
val rows = table.select("tbody tr.tabletr")
|
|
||||||
|
|
||||||
rows.forEach { row ->
|
tabs.forEach { tab ->
|
||||||
val serverElement = row.select("td:eq(0)")
|
val server = tab.select("a.playr").text()
|
||||||
val linkElement = row.select("td:eq(1) a")
|
val deco = tab.select("a.playr").attr("data-href")
|
||||||
|
val langs = tab.select("a.playr").attr("data-lang")
|
||||||
val server = serverElement.text()
|
val fullUrl = baseUrl + deco
|
||||||
val url = linkElement.attr("href")
|
val url = extractUrlFromDonFunction(fullUrl)
|
||||||
|
val isLatino = langs.contains("latino")
|
||||||
val isLatino = server.contains("latino")
|
val isSub = langs.contains("subtitulado") || langs.contains("sub") || langs.contains("japonés")
|
||||||
val isSub = server.contains("subtitulado")
|
|
||||||
|
|
||||||
when {
|
when {
|
||||||
server.contains("streamtape") -> {
|
server.contains("streamtape") -> {
|
||||||
@ -240,7 +249,7 @@ class Hackstore : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
|
|
||||||
return videoList
|
return videoList
|
||||||
}
|
}
|
||||||
override fun videoListSelector(): String = "#onpn > table > tbody > tr > td.link-td > a"
|
override fun videoListSelector(): String = "ul.TbVideoNv li.pres a.playr"
|
||||||
|
|
||||||
override fun videoFromElement(element: Element): Video { throw UnsupportedOperationException() }
|
override fun videoFromElement(element: Element): Video { throw UnsupportedOperationException() }
|
||||||
|
|
||||||
@ -273,7 +282,7 @@ class Hackstore : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
|
|
||||||
private const val PREF_SERVER_KEY = "preferred_server"
|
private const val PREF_SERVER_KEY = "preferred_server"
|
||||||
private const val PREF_SERVER_DEFAULT = "DoodStream"
|
private const val PREF_SERVER_DEFAULT = "DoodStream"
|
||||||
private val SERVER_LIST = arrayOf("DoodStream", "StreamTape", "VOE", "Filemoon", "StreamWish")
|
private val SERVER_LIST = arrayOf("DoodStream", "StreamTape", "Voe", "Filemoon", "StreamWish")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user