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(all/animexin): Fix YoutubeExtractor #2360

Merged
merged 5 commits into from
Oct 13, 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
1 change: 1 addition & 0 deletions multisrc/overrides/animestream/animexin/additional.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ dependencies {
implementation(project(':lib-dailymotion-extractor'))
implementation(project(':lib-okru-extractor'))
implementation(project(':lib-gdriveplayer-extractor'))
implementation(project(':lib-dood-extractor'))
implementation "dev.datlag.jsunpacker:jsunpacker:1.0.1"
}
40 changes: 17 additions & 23 deletions multisrc/overrides/animestream/animexin/src/AnimeXin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package eu.kanade.tachiyomi.animeextension.all.animexin

import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.animeextension.all.animexin.extractors.DoodExtractor
import eu.kanade.tachiyomi.animeextension.all.animexin.extractors.VidstreamingExtractor
import eu.kanade.tachiyomi.animeextension.all.animexin.extractors.YouTubeExtractor
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.lib.dailymotionextractor.DailymotionExtractor
import eu.kanade.tachiyomi.lib.doodextractor.DoodExtractor
import eu.kanade.tachiyomi.lib.gdriveplayerextractor.GdrivePlayerExtractor
import eu.kanade.tachiyomi.lib.okruextractor.OkruExtractor
import eu.kanade.tachiyomi.multisrc.animestream.AnimeStream
Expand All @@ -19,41 +19,37 @@ class AnimeXin : AnimeStream(
override val id = 4620219025406449669

// ============================ Video Links =============================
private val dailymotionExtractor by lazy { DailymotionExtractor(client, headers) }
private val doodExtractor by lazy { DoodExtractor(client) }
private val gdrivePlayerExtractor by lazy { GdrivePlayerExtractor(client) }
private val okruExtractor by lazy { OkruExtractor(client) }
private val vidstreamingExtractor by lazy { VidstreamingExtractor(client) }
private val youTubeExtractor by lazy { YouTubeExtractor(client) }

override fun getVideoList(url: String, name: String): List<Video> {
val prefix = "$name - "
return when {
url.contains("ok.ru") -> {
OkruExtractor(client).videosFromUrl(url, prefix = prefix)
}

url.contains("dailymotion") -> {
DailymotionExtractor(client, headers).videosFromUrl(url, prefix)
}
url.contains("https://dood") -> {
DoodExtractor(client).videosFromUrl(url, quality = name)
}
url.contains("ok.ru") -> okruExtractor.videosFromUrl(url, prefix)
url.contains("dailymotion") -> dailymotionExtractor.videosFromUrl(url, prefix)
url.contains("https://dood") -> doodExtractor.videosFromUrl(url, name)
url.contains("gdriveplayer") -> {
val gdriveHeaders = headersBuilder()
.add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8")
.add("Host", "gdriveplayer.to")
.add("Referer", "$baseUrl/")
.build()
GdrivePlayerExtractor(client).videosFromUrl(url, name = name, headers = gdriveHeaders)
}
url.contains("youtube.com") -> {
YouTubeExtractor(client).videosFromUrl(url, prefix = prefix)
}
url.contains("vidstreaming") -> {
VidstreamingExtractor(client).videosFromUrl(url, prefix = prefix)
gdrivePlayerExtractor.videosFromUrl(url, name, gdriveHeaders)
}
url.contains("youtube.com") -> youTubeExtractor.videosFromUrl(url, prefix)
url.contains("vidstreaming") -> vidstreamingExtractor.videosFromUrl(url, prefix)
else -> emptyList()
}
}

// ============================== Settings ==============================
override fun setupPreferenceScreen(screen: PreferenceScreen) {
super.setupPreferenceScreen(screen) // Quality preferences
val videoLangPref = ListPreference(screen.context).apply {

ListPreference(screen.context).apply {
key = PREF_LANG_KEY
title = PREF_LANG_TITLE
entries = PREF_LANG_VALUES
Expand All @@ -67,9 +63,7 @@ class AnimeXin : AnimeStream(
val entry = entryValues[index] as String
preferences.edit().putString(key, entry).commit()
}
}

screen.addPreference(videoLangPref)
}.also(screen::addPreference)
}

// ============================= Utilities ==============================
Expand Down

This file was deleted.

Loading