gogo, aniflix: support multiple doodstream domains

This commit is contained in:
jmir1
2021-11-26 18:11:17 +01:00
parent d35815988b
commit 34cd8adc1f
4 changed files with 18 additions and 15 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Aniflix'
pkgNameSuffix = 'de.aniflix'
extClass = '.Aniflix'
extVersionCode = 4
extVersionCode = 5
libVersion = '12'
}

View File

@ -44,9 +44,9 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
}
private val doodHeaders = Headers.Builder().apply {
private fun doodHeaders(tld: String) = Headers.Builder().apply {
add("User-Agent", "Aniyomi")
add("Referer", "https://dood.la/")
add("Referer", "https://dood.$tld/")
}.build()
private val json = Json {
@ -169,8 +169,9 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
val videoList = mutableListOf<Video>()
for (stream in streams) {
val quality = "${stream.hoster!!.name}, ${stream.lang!!}"
if (stream.link!!.contains("https://dood.la/e/")) {
videoList.add(Video(stream.link, quality, null, null, doodHeaders))
if (stream.link!!.contains("https://dood")) {
val tld = stream.link.substringAfter("https://dood.").substringBefore("/")
videoList.add(Video(stream.link, quality, null, null, doodHeaders(tld)))
}
}
return videoList
@ -209,16 +210,17 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
override fun videoUrlParse(response: Response): String {
val url = response.request.url.toString()
response.priorResponse
if (url.contains("https://dood.la/e/")) {
if (url.contains("https://dood")) {
val doodTld = url.substringAfter("https://dood.").substringBefore("/")
val content = response.body!!.string()
if (!content.contains("'/pass_md5/")) throw Exception("Error with doodstream mirror")
val md5 = content.substringAfter("'/pass_md5/").substringBefore("',")
val token = md5.substringAfterLast("/")
val randomString = getRandomString()
val expiry = System.currentTimeMillis()
val videoUrlStart = client.newCall(
GET(
"https://dood.la/pass_md5/$md5",
"https://dood.$doodTld/pass_md5/$md5",
Headers.headersOf("referer", url)
)
).execute().body!!.string()
@ -239,8 +241,8 @@ class Aniflix : ConfigurableAnimeSource, AnimeHttpSource() {
key = "preferred_hoster"
title = "Standard-Hoster"
entries = arrayOf("Doodstream")
entryValues = arrayOf("https://dood.la/e/")
setDefaultValue("https://dood.la/e/")
entryValues = arrayOf("https://dood")
setDefaultValue("https://dood")
summary = "%s"
setOnPreferenceChangeListener { _, newValue ->

View File

@ -5,7 +5,7 @@ ext {
extName = 'Gogoanime'
pkgNameSuffix = 'en.gogoanime'
extClass = '.GogoAnime'
extVersionCode = 23
extVersionCode = 24
libVersion = '12'
}

View File

@ -96,7 +96,7 @@ class GogoAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val newElements = Elements()
var googleElements = 0
for (element in this) {
if (element.attr("href").contains("https://dood.la")) {
if (element.attr("href").contains("https://dood")) {
newElements.add(element)
continue
}
@ -108,7 +108,7 @@ class GogoAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
return newElements
}
override fun videoListSelector() = "div.mirror_link a[download], div.mirror_link a[href*=https://dood.la]"
override fun videoListSelector() = "div.mirror_link a[download], div.mirror_link a[href*=https://dood]"
override fun videoFromElement(element: Element): Video {
val quality = element.text().substringAfter("Download (").replace("P - mp4)", "p")
@ -116,7 +116,7 @@ class GogoAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val location = element.ownerDocument().location()
val videoHeaders = Headers.headersOf("Referer", location)
return when {
url.contains("https://dood.la") -> {
url.contains("https://dood") -> {
val newQuality = "Doodstream mirror"
Video(url, newQuality, doodUrlParse(url), null, videoHeaders)
}
@ -158,11 +158,12 @@ class GogoAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
if (!content.contains("'/pass_md5/")) return null
val md5 = content.substringAfter("'/pass_md5/").substringBefore("',")
val token = md5.substringAfterLast("/")
val doodTld = url.substringAfter("https://dood.").substringBefore("/")
val randomString = getRandomString()
val expiry = System.currentTimeMillis()
val videoUrlStart = client.newCall(
GET(
"https://dood.la/pass_md5/$md5",
"https://dood.$doodTld/pass_md5/$md5",
Headers.headersOf("referer", url)
)
).execute().body!!.string()