Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ar/egydead): fix streamwish extractor and dood #2653

Merged
merged 2 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ar/egydead/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ ext {
extName = 'Egy Dead'
pkgNameSuffix = 'ar.egydead'
extClass = '.EgyDead'
extVersionCode = 7
extVersionCode = 8
libVersion = '13'
}

dependencies {
implementation(project(':lib-dood-extractor'))
implementation(project(':lib-mixdrop-extractor'))
implementation('dev.datlag.jsunpacker:jsunpacker:1.0.1')
implementation(project(':lib-streamwish-extractor'))
}

apply from: "$rootDir/common.gradle"
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.preference.EditTextPreference
import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.animeextension.BuildConfig
import dev.datlag.jsunpacker.JsUnpacker
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
import eu.kanade.tachiyomi.animesource.model.AnimeFilter
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
Expand All @@ -17,6 +16,7 @@ import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource
import eu.kanade.tachiyomi.lib.doodextractor.DoodExtractor
import eu.kanade.tachiyomi.lib.mixdropextractor.MixDropExtractor
import eu.kanade.tachiyomi.lib.streamwishextractor.StreamWishExtractor
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.util.asJsoup
Expand Down Expand Up @@ -130,6 +130,8 @@ class EgyDead : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
}

// ================================== video urls ==================================
private val streamWishExtractor by lazy { StreamWishExtractor(client, headers) }

override fun videoListParse(response: Response): List<Video> {
val requestBody = FormBody.Builder().add("View", "1").build()
val document = client.newCall(POST(response.request.url.toString(), body = requestBody)).execute().asJsoup()
Expand All @@ -148,7 +150,7 @@ class EgyDead : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
DOOD_REGEX.containsMatchIn(url) -> {
DoodExtractor(client).videoFromUrl(url, "Dood mirror")?.let(::listOf)
}
url.contains("mixdrop") -> {
url.contains("mdbekjwqa") -> {
MixDropExtractor(client).videoFromUrl(url)
}
url.contains("ahvsh") -> {
Expand All @@ -159,24 +161,7 @@ class EgyDead : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
Video(streamLink, "StreamHide: $quality", streamLink).let(::listOf)
}
STREAMWISH_REGEX.containsMatchIn(url) -> {
val request = client.newCall(GET(url, headers)).execute().asJsoup()
val data = JsUnpacker.unpackAndCombine(request.selectFirst("script:containsData(sources)")!!.data())!!
val m3u8 = SOURCE_URL_REGEX.find(data)!!.groupValues[1]
if (QUALITIES_REGEX.containsMatchIn(m3u8)) {
val streamLink = QUALITIES_REGEX.find(m3u8)!!
val streamQuality = streamLink.groupValues[2].split(",").reversed()
val qualities = data.substringAfter("qualityLabels").substringBefore("}")
val qRegex = Regex("\".*?\":\\s*\"(.*?)\"").findAll(qualities)
qRegex.mapIndexed { index, matchResult ->
val src = streamLink.groupValues[1] + "_" + streamQuality[index] + "/index-v1-a1" + streamLink.groupValues[3]
val quality = "StreamWish: " + matchResult.groupValues[1]
Video(src, quality, src, headers)
}.toList()
} else {
val qualities = data.substringAfter("qualityLabels").substringBefore("}")
val qRegex = Regex("\".*?\"\\s*:\\s*\"(.*?)\"").find(qualities)!!
Video(m3u8, qRegex.groupValues[1], m3u8).let(::listOf)
}
streamWishExtractor.videosFromUrl(url)
}
url.contains("fanakishtuna") -> {
val request = client.newCall(GET(url, headers)).execute().asJsoup()
Expand Down Expand Up @@ -365,9 +350,7 @@ class EgyDead : ConfigurableAnimeSource, ParsedAnimeHttpSource() {

// like|kharabnahk
companion object {
private val DOOD_REGEX = Regex("(do*d(?:stream)?\\.(?:com?|watch|to|s[ho]|cx|la|w[sf]|pm|re|yt|stream))/[de]/([0-9a-zA-Z]+)")
private val DOOD_REGEX = Regex("(do*d(?:stream)?\\.(?:com?|watch|to|s[ho]|cx|la|w[sf]|pm|re|yt|stream))/[de]/([0-9a-zA-Z]+)|ds2play")
private val STREAMWISH_REGEX = Regex("ajmidyad|alhayabambi|atabknh[ks]|file|egtpgrvh")
private val SOURCE_URL_REGEX = Regex("sources:\\s*\\[\\{\\s*\\t*file:\\s*[\"']([^\"']+)")
private val QUALITIES_REGEX = Regex("(.*)_,(.*),\\.urlset/master(.*)")
}
}