From be0a2bb590b22f49b1342473c86c9acddb700847 Mon Sep 17 00:00:00 2001 From: Dark25 Date: Fri, 9 Feb 2024 21:04:39 +0100 Subject: [PATCH] fix(es/hackstore): Video empty (#2898) Co-authored-by: Secozzi <49240133+Secozzi@users.noreply.github.com> --- src/es/hackstore/build.gradle | 2 +- .../animeextension/es/hackstore/Hackstore.kt | 35 ++++++++++++------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/es/hackstore/build.gradle b/src/es/hackstore/build.gradle index 7703dd23ed..8b114c6d51 100644 --- a/src/es/hackstore/build.gradle +++ b/src/es/hackstore/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Hackstore' extClass = '.Hackstore' - extVersionCode = 3 + extVersionCode = 4 } apply from: "$rootDir/common.gradle" diff --git a/src/es/hackstore/src/eu/kanade/tachiyomi/animeextension/es/hackstore/Hackstore.kt b/src/es/hackstore/src/eu/kanade/tachiyomi/animeextension/es/hackstore/Hackstore.kt index 54ac53b9a7..c63d9c600f 100644 --- a/src/es/hackstore/src/eu/kanade/tachiyomi/animeextension/es/hackstore/Hackstore.kt +++ b/src/es/hackstore/src/eu/kanade/tachiyomi/animeextension/es/hackstore/Hackstore.kt @@ -21,6 +21,7 @@ import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.util.asJsoup 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 @@ -195,22 +196,30 @@ class Hackstore : ConfigurableAnimeSource, ParsedAnimeHttpSource() { override fun episodeFromElement(element: Element): SEpisode { throw UnsupportedOperationException() } // ============================ 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