Initial commit
This commit is contained in:
commit
98ed7e8839
2263 changed files with 108711 additions and 0 deletions
16
src/en/animenosub/build.gradle
Normal file
16
src/en/animenosub/build.gradle
Normal file
|
@ -0,0 +1,16 @@
|
|||
ext {
|
||||
extName = 'Animenosub'
|
||||
extClass = '.Animenosub'
|
||||
themePkg = 'animestream'
|
||||
baseUrl = 'https://animenosub.com'
|
||||
overrideVersionCode = 5
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
||||
dependencies {
|
||||
implementation(project(':lib:filemoon-extractor'))
|
||||
implementation(project(':lib:streamwish-extractor'))
|
||||
implementation "dev.datlag.jsunpacker:jsunpacker:1.0.1"
|
||||
}
|
BIN
src/en/animenosub/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
src/en/animenosub/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
BIN
src/en/animenosub/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
src/en/animenosub/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
src/en/animenosub/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
src/en/animenosub/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
BIN
src/en/animenosub/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
src/en/animenosub/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
BIN
src/en/animenosub/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
src/en/animenosub/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.7 KiB |
|
@ -0,0 +1,122 @@
|
|||
package eu.kanade.tachiyomi.animeextension.en.animenosub
|
||||
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.tachiyomi.animeextension.en.animenosub.extractors.VidMolyExtractor
|
||||
import eu.kanade.tachiyomi.animeextension.en.animenosub.extractors.VtubeExtractor
|
||||
import eu.kanade.tachiyomi.animeextension.en.animenosub.extractors.WolfstreamExtractor
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.lib.filemoonextractor.FilemoonExtractor
|
||||
import eu.kanade.tachiyomi.lib.streamwishextractor.StreamWishExtractor
|
||||
import eu.kanade.tachiyomi.multisrc.animestream.AnimeStream
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class Animenosub : AnimeStream(
|
||||
"en",
|
||||
"Animenosub",
|
||||
"https://animenosub.com",
|
||||
) {
|
||||
// ============================== Episodes ==============================
|
||||
override fun getEpisodeName(element: Element, epNum: String): String {
|
||||
val episodeTitle = element.selectFirst("div.epl-title")?.text() ?: ""
|
||||
val complement = if (episodeTitle.contains("Episode $epNum", true)) "" else episodeTitle
|
||||
return "Ep. $epNum $complement"
|
||||
}
|
||||
|
||||
// ============================ Video Links =============================
|
||||
|
||||
override fun getVideoList(url: String, name: String): List<Video> {
|
||||
val prefix = "$name - "
|
||||
return when {
|
||||
url.contains("streamwish") -> {
|
||||
StreamWishExtractor(client, headers).videosFromUrl(url, prefix)
|
||||
}
|
||||
url.contains("vidmoly") -> {
|
||||
VidMolyExtractor(client).getVideoList(url, name)
|
||||
}
|
||||
url.contains("https://vtbe") -> {
|
||||
VtubeExtractor(client, headers).videosFromUrl(url, baseUrl, prefix)
|
||||
}
|
||||
url.contains("wolfstream") -> {
|
||||
WolfstreamExtractor(client).videosFromUrl(url, prefix)
|
||||
}
|
||||
url.contains("filemoon") -> {
|
||||
FilemoonExtractor(client).videosFromUrl(url, prefix, headers)
|
||||
}
|
||||
else -> emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
// ============================== Settings ==============================
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
super.setupPreferenceScreen(screen) // Quality preferences
|
||||
val videoTypePref = ListPreference(screen.context).apply {
|
||||
key = PREF_TYPE_KEY
|
||||
title = PREF_TYPE_TITLE
|
||||
entries = PREF_TYPE_VALUES
|
||||
entryValues = PREF_TYPE_VALUES
|
||||
setDefaultValue(PREF_TYPE_DEFAULT)
|
||||
summary = "%s"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = findIndexOfValue(selected)
|
||||
val entry = entryValues[index] as String
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
}
|
||||
}
|
||||
val videoServer = ListPreference(screen.context).apply {
|
||||
key = PREF_SERVER_KEY
|
||||
title = PREF_SERVER_TITLE
|
||||
entries = PREF_SERVER_VALUES
|
||||
entryValues = PREF_SERVER_VALUES
|
||||
setDefaultValue(PREF_SERVER_DEFAULT)
|
||||
summary = "%s"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = findIndexOfValue(selected)
|
||||
val entry = entryValues[index] as String
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
}
|
||||
}
|
||||
|
||||
screen.addPreference(videoTypePref)
|
||||
screen.addPreference(videoServer)
|
||||
}
|
||||
|
||||
// ============================= Utilities ==============================
|
||||
|
||||
override fun List<Video>.sort(): List<Video> {
|
||||
val quality = preferences.getString(prefQualityKey, prefQualityDefault)!!
|
||||
val type = preferences.getString(PREF_TYPE_KEY, PREF_TYPE_DEFAULT)!!
|
||||
val server = preferences.getString(PREF_SERVER_KEY, PREF_SERVER_DEFAULT)!!
|
||||
|
||||
return sortedWith(
|
||||
compareBy(
|
||||
{ it.quality.startsWith(type, true) },
|
||||
{ it.quality.contains(quality) },
|
||||
{ it.quality.contains(server, true) },
|
||||
),
|
||||
).reversed()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val PREF_TYPE_KEY = "preferred_type"
|
||||
private const val PREF_TYPE_TITLE = "Preferred Video Type"
|
||||
private const val PREF_TYPE_DEFAULT = "SUB"
|
||||
private val PREF_TYPE_VALUES = arrayOf("SUB", "RAW")
|
||||
|
||||
private const val PREF_SERVER_KEY = "preferred_server"
|
||||
private const val PREF_SERVER_TITLE = "Preferred Video Server"
|
||||
private const val PREF_SERVER_DEFAULT = "StreamWish"
|
||||
private val PREF_SERVER_VALUES = arrayOf(
|
||||
"StreamWish",
|
||||
"VidMoly",
|
||||
"Vtube",
|
||||
"WolfStream",
|
||||
"Filemoon",
|
||||
)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package eu.kanade.tachiyomi.animeextension.en.animenosub.extractors
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import okhttp3.Headers
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class VidMolyExtractor(private val client: OkHttpClient) {
|
||||
|
||||
private val regexPlaylist = Regex("file:\"(\\S+?)\"")
|
||||
|
||||
fun getVideoList(url: String, lang: String): List<Video> {
|
||||
val body = client.newCall(GET(url)).execute()
|
||||
.body.string()
|
||||
val playlistUrl = regexPlaylist.find(body)!!.groupValues.get(1)
|
||||
val headers = Headers.headersOf("Referer", "https://vidmoly.to")
|
||||
val playlistData = client.newCall(GET(playlistUrl, headers)).execute()
|
||||
.body.string()
|
||||
|
||||
val separator = "#EXT-X-STREAM-INF:"
|
||||
return playlistData.substringAfter(separator).split(separator).map {
|
||||
val quality = it.substringAfter("RESOLUTION=")
|
||||
.substringAfter("x")
|
||||
.substringBefore(",") + "p"
|
||||
val videoUrl = it.substringAfter("\n").substringBefore("\n")
|
||||
Video(videoUrl, "$lang - $quality", videoUrl, headers)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package eu.kanade.tachiyomi.animeextension.en.animenosub.extractors
|
||||
|
||||
import dev.datlag.jsunpacker.JsUnpacker
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class VtubeExtractor(private val client: OkHttpClient, private val headers: Headers) {
|
||||
fun videosFromUrl(url: String, baseUrl: String, prefix: String): List<Video> {
|
||||
val videoList = mutableListOf<Video>()
|
||||
|
||||
val docHeaders = headers.newBuilder()
|
||||
.add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8")
|
||||
.add("Host", url.toHttpUrl().host)
|
||||
.add("Referer", "$baseUrl/")
|
||||
.build()
|
||||
val doc = client.newCall(GET(url, headers = docHeaders)).execute().asJsoup()
|
||||
|
||||
val jsEval = doc.selectFirst("script:containsData(m3u8)")!!.data()
|
||||
|
||||
val masterUrl = JsUnpacker.unpackAndCombine(jsEval)
|
||||
?.substringAfter("source")
|
||||
?.substringAfter("file:\"")
|
||||
?.substringBefore("\"")
|
||||
?: return emptyList()
|
||||
|
||||
val playlistHeaders = headers.newBuilder()
|
||||
.add("Accept", "*/*")
|
||||
.add("Host", masterUrl.toHttpUrl().host)
|
||||
.add("Origin", "https://${url.toHttpUrl().host}")
|
||||
.add("Referer", "https://${url.toHttpUrl().host}/")
|
||||
.build()
|
||||
|
||||
val masterPlaylist = client.newCall(
|
||||
GET(masterUrl, headers = playlistHeaders),
|
||||
).execute().body.string()
|
||||
val separator = "#EXT-X-STREAM-INF:"
|
||||
masterPlaylist.substringAfter(separator).split(separator).forEach {
|
||||
val quality = prefix + it.substringAfter("RESOLUTION=").substringAfter("x").substringBefore(",") + "p "
|
||||
val videoUrl = it.substringAfter("\n").substringBefore("\n")
|
||||
videoList.add(Video(videoUrl, quality, videoUrl, headers = playlistHeaders))
|
||||
}
|
||||
|
||||
return videoList
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package eu.kanade.tachiyomi.animeextension.en.animenosub.extractors
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class WolfstreamExtractor(private val client: OkHttpClient) {
|
||||
fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
|
||||
val url = client.newCall(
|
||||
GET(url),
|
||||
).execute().asJsoup().selectFirst("script:containsData(sources)")?.let {
|
||||
it.data().substringAfter("{file:\"").substringBefore("\"")
|
||||
} ?: return emptyList()
|
||||
return listOf(
|
||||
Video(url, "${prefix}WolfStream", url),
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue