add new source animension (#822)
Co-authored-by: Lawwwwwwww <97511605+Lawwwwwwww@users.noreply.github.com>
This commit is contained in:
2
src/en/animension/AndroidManifest.xml
Normal file
2
src/en/animension/AndroidManifest.xml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest package="eu.kanade.tachiyomi.animeextension" />
|
12
src/en/animension/build.gradle
Normal file
12
src/en/animension/build.gradle
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
|
ext {
|
||||||
|
extName = 'Animension'
|
||||||
|
pkgNameSuffix = 'en.animension'
|
||||||
|
extClass = '.Animension'
|
||||||
|
extVersionCode = 1
|
||||||
|
libVersion = '13'
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: "$rootDir/common.gradle"
|
BIN
src/en/animension/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
src/en/animension/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
BIN
src/en/animension/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
src/en/animension/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
src/en/animension/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
src/en/animension/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
src/en/animension/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
src/en/animension/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
BIN
src/en/animension/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
src/en/animension/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
src/en/animension/res/web_hi_res_512.png
Normal file
BIN
src/en/animension/res/web_hi_res_512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 59 KiB |
@ -0,0 +1,243 @@
|
|||||||
|
package eu.kanade.tachiyomi.animeextension.en.animension
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import androidx.preference.ListPreference
|
||||||
|
import androidx.preference.PreferenceScreen
|
||||||
|
import eu.kanade.tachiyomi.animeextension.en.animension.extractors.DoodExtractor
|
||||||
|
import eu.kanade.tachiyomi.animeextension.en.animension.extractors.FembedExtractor
|
||||||
|
import eu.kanade.tachiyomi.animeextension.en.animension.extractors.StreamSBExtractor
|
||||||
|
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
|
||||||
|
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
|
||||||
|
import eu.kanade.tachiyomi.animesource.model.AnimesPage
|
||||||
|
import eu.kanade.tachiyomi.animesource.model.SAnime
|
||||||
|
import eu.kanade.tachiyomi.animesource.model.SEpisode
|
||||||
|
import eu.kanade.tachiyomi.animesource.model.Video
|
||||||
|
import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource
|
||||||
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonArray
|
||||||
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
import kotlinx.serialization.json.float
|
||||||
|
import kotlinx.serialization.json.jsonArray
|
||||||
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.Response
|
||||||
|
import uy.kohesive.injekt.Injekt
|
||||||
|
import uy.kohesive.injekt.api.get
|
||||||
|
|
||||||
|
class Animension() : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||||
|
override val lang = "en"
|
||||||
|
|
||||||
|
override val name = "Animension"
|
||||||
|
|
||||||
|
override val baseUrl = "https://animension.to/"
|
||||||
|
|
||||||
|
override val supportsLatest = false
|
||||||
|
|
||||||
|
private val apiUrl = "https://animension.to/public-api"
|
||||||
|
|
||||||
|
private val json = Json {
|
||||||
|
ignoreUnknownKeys = true
|
||||||
|
}
|
||||||
|
|
||||||
|
private val preferences: SharedPreferences by lazy {
|
||||||
|
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Popular
|
||||||
|
override fun popularAnimeRequest(page: Int): Request =
|
||||||
|
GET("$apiUrl/search.php?dub=0&sort=popular-week&page=$page")
|
||||||
|
|
||||||
|
override fun popularAnimeParse(response: Response): AnimesPage {
|
||||||
|
val responseJson = json.decodeFromString<JsonArray>(response.body!!.string())
|
||||||
|
val animes = responseJson.map { anime ->
|
||||||
|
val data = anime.jsonArray
|
||||||
|
|
||||||
|
SAnime.create().apply {
|
||||||
|
title = data[0].jsonPrimitive.content
|
||||||
|
url = data[1].jsonPrimitive.content
|
||||||
|
thumbnail_url = data[2].jsonPrimitive.content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val hasNextPage = responseJson.size >= 25
|
||||||
|
|
||||||
|
return AnimesPage(animes, hasNextPage)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Episode
|
||||||
|
override fun episodeListRequest(anime: SAnime): Request {
|
||||||
|
return (GET("$apiUrl/episodes.php?id=${anime.url}", headers))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun episodeListParse(response: Response): List<SEpisode> {
|
||||||
|
val responseJson = json.decodeFromString<JsonArray>(response.body!!.string())
|
||||||
|
val episodes = responseJson.map { episode ->
|
||||||
|
val data = episode.jsonArray
|
||||||
|
|
||||||
|
SEpisode.create().apply {
|
||||||
|
name = "Episode ${data[2]}"
|
||||||
|
url = data[1].jsonPrimitive.content
|
||||||
|
episode_number = data[2].jsonPrimitive.float
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return episodes
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vide urls
|
||||||
|
override fun videoListRequest(episode: SEpisode): Request =
|
||||||
|
GET("$apiUrl/episode.php?id=${episode.url}", headers)
|
||||||
|
|
||||||
|
override fun videoListParse(response: Response): List<Video> {
|
||||||
|
val responseJson = json.decodeFromString<JsonArray>(response.body!!.string())
|
||||||
|
val videos = json.decodeFromString<JsonObject>(responseJson[3].jsonPrimitive.content)
|
||||||
|
val videoList = mutableListOf<Video>()
|
||||||
|
|
||||||
|
for (key in videos.keys.toList()) {
|
||||||
|
val url = videos[key]!!.jsonPrimitive.content
|
||||||
|
when {
|
||||||
|
url.contains("sbembed.com") || url.contains("sbembed1.com") || url.contains("sbplay.org") ||
|
||||||
|
url.contains("sbvideo.net") || url.contains("streamsb.net") || url.contains("sbplay.one") ||
|
||||||
|
url.contains("cloudemb.com") || url.contains("playersb.com") || url.contains("tubesb.com") ||
|
||||||
|
url.contains("sbplay1.com") || url.contains("embedsb.com") || url.contains("watchsb.com") ||
|
||||||
|
url.contains("sbplay2.com") || url.contains("japopav.tv") || url.contains("viewsb.com") ||
|
||||||
|
url.contains("sbfast") || url.contains("sbfull.com") || url.contains("javplaya.com") ||
|
||||||
|
url.contains("ssbstream.net") || url.contains("p1ayerjavseen.com") || url.contains("sbthe.com") ||
|
||||||
|
url.contains("streamsss.net") // || url.contains("") // || url.contains("")
|
||||||
|
-> {
|
||||||
|
val headers = headers.newBuilder()
|
||||||
|
.set("Referer", url)
|
||||||
|
.set(
|
||||||
|
"User-Agent",
|
||||||
|
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0"
|
||||||
|
)
|
||||||
|
.set("Accept-Language", "en-US,en;q=0.5")
|
||||||
|
.set("watchsb", "streamsb")
|
||||||
|
.build()
|
||||||
|
videoList.addAll(StreamSBExtractor(client).videosFromUrl(url, headers))
|
||||||
|
}
|
||||||
|
|
||||||
|
url.contains("dood") -> {
|
||||||
|
val video = DoodExtractor(client).videoFromUrl(url)
|
||||||
|
if (video != null) {
|
||||||
|
videoList.add(video)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
url.contains("fembed.com") || url.contains("anime789.com") || url.contains("24hd.club") ||
|
||||||
|
url.contains("fembad.org") || url.contains("vcdn.io") || url.contains("sharinglink.club") ||
|
||||||
|
url.contains("moviemaniac.org") || url.contains("votrefiles.club") || url.contains("femoload.xyz") ||
|
||||||
|
url.contains("albavido.xyz") || url.contains("feurl.com") || url.contains("dailyplanet.pw") ||
|
||||||
|
url.contains("ncdnstm.com") || url.contains("jplayer.net") || url.contains("xstreamcdn.com") ||
|
||||||
|
url.contains("fembed-hd.com") || url.contains("gcloud.live") || url.contains("vcdnplay.com") ||
|
||||||
|
url.contains("superplayxyz.club") || url.contains("vidohd.com") || url.contains("vidsource.me") ||
|
||||||
|
url.contains("cinegrabber.com") || url.contains("votrefile.xyz") || url.contains("zidiplay.com") ||
|
||||||
|
url.contains("ndrama.xyz") || url.contains("fcdn.stream") || url.contains("mediashore.org") ||
|
||||||
|
url.contains("suzihaza.com") || url.contains("there.to") || url.contains("femax20.com") ||
|
||||||
|
url.contains("javstream.top") || url.contains("viplayer.cc") || url.contains("sexhd.co") ||
|
||||||
|
url.contains("fembed.net") || url.contains("mrdhan.com") || url.contains("votrefilms.xyz") ||
|
||||||
|
url.contains("fembed9hd.com") || url.contains("embedsito.com") || url.contains("dutrag.com") ||
|
||||||
|
url.contains("youvideos.ru") || url.contains("streamm4u.club") || // url.contains("") ||
|
||||||
|
url.contains("moviepl.xyz") || url.contains("asianclub.tv") || // url.contains("") ||
|
||||||
|
url.contains("vidcloud.fun") || url.contains("fplayer.info") || // url.contains("") ||
|
||||||
|
url.contains("diasfem.com") || url.contains("javpoll.com") // url.contains("")
|
||||||
|
-> {
|
||||||
|
FembedExtractor().videosFromUrl(url)?.let { videoList.addAll(it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return videoList
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun List<Video>.sort(): List<Video> {
|
||||||
|
val quality = preferences.getString("preferred_quality", null)
|
||||||
|
if (quality != null) {
|
||||||
|
val newList = mutableListOf<Video>()
|
||||||
|
var preferred = 0
|
||||||
|
for (video in this) {
|
||||||
|
if (video.quality.contains(quality)) {
|
||||||
|
newList.add(preferred, video)
|
||||||
|
preferred++
|
||||||
|
} else {
|
||||||
|
newList.add(video)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newList
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun videoUrlParse(response: Response) = throw Exception("not used")
|
||||||
|
|
||||||
|
// Anime details
|
||||||
|
override fun animeDetailsParse(response: Response): SAnime {
|
||||||
|
val document = response.asJsoup()
|
||||||
|
val anime = SAnime.create()
|
||||||
|
anime.thumbnail_url = document.select("div.thumb img").attr("src")
|
||||||
|
anime.title = document.select("h1.entry-title").text()
|
||||||
|
anime.description = document.select("div.desc").text()
|
||||||
|
anime.genre = document.select("div.genxed span a").joinToString { it.text() }
|
||||||
|
anime.status = parseStatus(document.select("div.spe span:contains(Status)").text().substringAfter("Status: "))
|
||||||
|
return anime
|
||||||
|
}
|
||||||
|
|
||||||
|
// Latest
|
||||||
|
override fun latestUpdatesParse(response: Response): AnimesPage {
|
||||||
|
throw Exception("Not used")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun latestUpdatesRequest(page: Int): Request {
|
||||||
|
throw Exception("Not used")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search
|
||||||
|
override fun searchAnimeParse(response: Response): AnimesPage {
|
||||||
|
val responseJson = json.decodeFromString<JsonArray>(response.body!!.string())
|
||||||
|
val animes = responseJson.map { anime ->
|
||||||
|
val data = anime.jsonArray
|
||||||
|
|
||||||
|
SAnime.create().apply {
|
||||||
|
title = data[0].jsonPrimitive.content
|
||||||
|
url = data[1].jsonPrimitive.content
|
||||||
|
thumbnail_url = data[2].jsonPrimitive.content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val hasNextPage = responseJson.size >= 25
|
||||||
|
|
||||||
|
return AnimesPage(animes, hasNextPage)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request =
|
||||||
|
GET("$apiUrl/search.php?search_text=$query&page=$page", headers)
|
||||||
|
|
||||||
|
// Utilities
|
||||||
|
private fun parseStatus(statusString: String): Int {
|
||||||
|
return when (statusString) {
|
||||||
|
"Ongoing" -> SAnime.ONGOING
|
||||||
|
"Completed" -> SAnime.COMPLETED
|
||||||
|
else -> SAnime.UNKNOWN
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Preferences
|
||||||
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
|
val videoQualityPref = ListPreference(screen.context).apply {
|
||||||
|
key = "preferred_quality"
|
||||||
|
title = "Preferred quality"
|
||||||
|
entries = arrayOf("1080p", "720p", "480p", "360p", "Doodstream")
|
||||||
|
entryValues = arrayOf("1080", "720", "480", "360", "Doodstream")
|
||||||
|
setDefaultValue("1080")
|
||||||
|
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(videoQualityPref)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package eu.kanade.tachiyomi.animeextension.en.animension.extractors
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.animesource.model.Video
|
||||||
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import okhttp3.Headers
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
|
||||||
|
class DoodExtractor(private val client: OkHttpClient) {
|
||||||
|
fun videoFromUrl(url: String): Video? {
|
||||||
|
val response = client.newCall(GET(url)).execute()
|
||||||
|
// Overwrite url to the redirected one
|
||||||
|
val url = response.request.url.toString()
|
||||||
|
val doodTld = url.substringAfter("https://dood.").substringBefore("/")
|
||||||
|
val content = response.body!!.string()
|
||||||
|
if (!content.contains("'/pass_md5/")) return null
|
||||||
|
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.$doodTld/pass_md5/$md5",
|
||||||
|
Headers.headersOf("referer", url)
|
||||||
|
)
|
||||||
|
).execute().body!!.string()
|
||||||
|
val videoUrl = "$videoUrlStart$randomString?token=$token&expiry=$expiry"
|
||||||
|
val newQuality = "Doodstream mirror"
|
||||||
|
|
||||||
|
return Video(url, newQuality, videoUrl, headers = doodHeaders(doodTld))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getRandomString(length: Int = 10): String {
|
||||||
|
val allowedChars = ('A'..'Z') + ('a'..'z') + ('0'..'9')
|
||||||
|
return (1..length)
|
||||||
|
.map { allowedChars.random() }
|
||||||
|
.joinToString("")
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun doodHeaders(tld: String) = Headers.Builder().apply {
|
||||||
|
add("User-Agent", "Aniyomi")
|
||||||
|
add("Referer", "https://dood.$tld/")
|
||||||
|
}.build()
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package eu.kanade.tachiyomi.animeextension.en.animension.extractors
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.animesource.model.Video
|
||||||
|
import org.json.JSONObject
|
||||||
|
import org.jsoup.Connection
|
||||||
|
import org.jsoup.Jsoup
|
||||||
|
|
||||||
|
class FembedExtractor {
|
||||||
|
|
||||||
|
fun videosFromUrl(url: String): List<Video>? {
|
||||||
|
val videoApi = url.replace("/v/", "/api/source/")
|
||||||
|
val json = JSONObject(Jsoup.connect(videoApi).ignoreContentType(true).method(Connection.Method.POST).execute().body())
|
||||||
|
val videoList = mutableListOf<Video>()
|
||||||
|
|
||||||
|
return if (json.getBoolean("success")) {
|
||||||
|
val jsonArray = json.getJSONArray("data")
|
||||||
|
for (i in 0 until jsonArray.length()) {
|
||||||
|
val `object` = jsonArray.getJSONObject(i)
|
||||||
|
val videoUrl = `object`.getString("file")
|
||||||
|
val quality = "Fembed: " + `object`.getString("label")
|
||||||
|
videoList.add(Video(videoUrl, quality, videoUrl))
|
||||||
|
}
|
||||||
|
videoList
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package eu.kanade.tachiyomi.animeextension.en.animension.extractors
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.animesource.model.Video
|
||||||
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
import kotlinx.serialization.json.jsonObject
|
||||||
|
import okhttp3.Headers
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
|
||||||
|
class StreamSBExtractor(private val client: OkHttpClient) {
|
||||||
|
|
||||||
|
private val hexArray = "0123456789ABCDEF".toCharArray()
|
||||||
|
|
||||||
|
private fun bytesToHex(bytes: ByteArray): String {
|
||||||
|
val hexChars = CharArray(bytes.size * 2)
|
||||||
|
for (j in bytes.indices) {
|
||||||
|
val v = bytes[j].toInt() and 0xFF
|
||||||
|
|
||||||
|
hexChars[j * 2] = hexArray[v ushr 4]
|
||||||
|
hexChars[j * 2 + 1] = hexArray[v and 0x0F]
|
||||||
|
}
|
||||||
|
return String(hexChars)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun videosFromUrl(url: String, headers: Headers): List<Video> {
|
||||||
|
val sbUrl = url.substringBefore("/e")
|
||||||
|
val id = url.substringAfter("e/").substringBefore("?")
|
||||||
|
val bytes = id.toByteArray()
|
||||||
|
val bytesToHex = bytesToHex(bytes)
|
||||||
|
val master = "$sbUrl/sources43/566d337678566f743674494a7c7c${bytesToHex}7c7c346b6767586d6934774855537c7c73747265616d7362/6565417268755339773461447c7c346133383438333436313335376136323337373433383634376337633465366534393338373136643732373736343735373237613763376334363733353737303533366236333463353333363534366137633763373337343732363536313664373336327c7c6b586c3163614468645a47617c7c73747265616d7362"
|
||||||
|
// "https://sbplay2.com/sourcesx38/4f395a53447166635a3836787c7c${bytesToHex}7c7c7965344f61436d467845586c7c7c73747265616d7362/6e56314c77564e6a6c6631737c7c333735383537363836633662373635323636376133343637376337633335346334343332353735343333366633343635346336383763376334313561373633343761346133303665363837363537353937633763373337343732363536313664373336327c7c395239444c3961626d634e6a7c7c73747265616d7362"
|
||||||
|
val json = Json.decodeFromString<JsonObject>(
|
||||||
|
client.newCall(GET(master, headers))
|
||||||
|
.execute().body!!.string()
|
||||||
|
)
|
||||||
|
val masterUrl = json["stream_data"]!!.jsonObject["file"].toString().trim('"')
|
||||||
|
val masterPlaylist = client.newCall(GET(masterUrl, headers)).execute().body!!.string()
|
||||||
|
val videoList = mutableListOf<Video>()
|
||||||
|
masterPlaylist.substringAfter("#EXT-X-STREAM-INF:").split("#EXT-X-STREAM-INF:").forEach {
|
||||||
|
val quality = "StreamSB: " + it.substringAfter("RESOLUTION=").substringAfter("x").substringBefore(",") + "p"
|
||||||
|
val videoUrl = it.substringAfter("\n").substringBefore("\n")
|
||||||
|
videoList.add(Video(videoUrl, quality, videoUrl, headers = headers))
|
||||||
|
}
|
||||||
|
return videoList
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user