mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
🎉 ruin sora with dub
This commit is contained in:
parent
afa6956717
commit
ebb89face3
3 changed files with 58 additions and 49 deletions
|
@ -1014,17 +1014,21 @@ object SoraExtractor : SoraStream() {
|
|||
val episodeId = app.get("$consumetAnilistAPI/info/$anilistId?provider=zoro")
|
||||
.parsedSafe<ConsumetDetails>()?.episodes?.find {
|
||||
it.number == episode
|
||||
}?.id ?: return
|
||||
}?.id?.substringBeforeLast("$") ?: return
|
||||
|
||||
val sources = app.get("$consumetZoroAPI/watch?episodeId=$episodeId", timeout = 120L)
|
||||
.parsedSafe<ConsumetSourcesResponse>() ?: return
|
||||
listOf(
|
||||
"$episodeId\$sub" to "Subbed",
|
||||
"$episodeId\$dub" to "English Dub",
|
||||
).apmap { (id, type) ->
|
||||
val sources = app.get("$consumetZoroAPI/watch?episodeId=$id")
|
||||
.parsedSafe<ConsumetSourcesResponse>() ?: return@apmap null
|
||||
|
||||
sources.sources?.map {
|
||||
sources.sources?.map sources@{
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
"Zoro",
|
||||
"Zoro",
|
||||
it.url ?: return@map null,
|
||||
"Zoro [$type]",
|
||||
"Zoro [$type]",
|
||||
it.url ?: return@sources null,
|
||||
"",
|
||||
getQualityFromName(it.quality),
|
||||
it.isM3U8 ?: true
|
||||
|
@ -1032,14 +1036,15 @@ object SoraExtractor : SoraStream() {
|
|||
)
|
||||
}
|
||||
|
||||
sources.subtitles?.map {
|
||||
sources.subtitles?.map subtitles@{
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
it.lang ?: "",
|
||||
it.url ?: return@map null
|
||||
it.url ?: return@subtitles null
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1476,15 +1481,21 @@ object SoraExtractor : SoraStream() {
|
|||
|
||||
val detail = app.get("$consumetCrunchyrollAPI/info?id=${id.id}&mediaType=series").text
|
||||
val episodeId = tryParseJson<ConsumetDetails>(detail)?.episodes?.filter {
|
||||
(it.number == episode || it.title.equals(epsTitle, true)) && it.type == "Subbed"
|
||||
}?.map { it.id }?.getOrNull(season?.minus(1) ?: 0) ?: return
|
||||
(it.number == episode || it.title.equals(epsTitle, true))
|
||||
}?.let { eps ->
|
||||
listOf(eps.filter { it.type == "Subbed" }.map { it.id }
|
||||
.getOrNull(season?.minus(1) ?: 0) to "Subbed",
|
||||
eps.filter { it.type == "English Dub" }.map { it.id }
|
||||
.getOrNull(season?.minus(1) ?: 0) to "English Dub")
|
||||
}
|
||||
|
||||
val json = app.get("$consumetCrunchyrollAPI/watch?episodeId=$episodeId&format=srt")
|
||||
episodeId?.apmap { (id, type) ->
|
||||
val json = app.get("$consumetCrunchyrollAPI/watch?episodeId=${id ?: return@apmap null}&format=srt")
|
||||
.parsedSafe<ConsumetSourcesResponse>()
|
||||
|
||||
json?.sources?.map source@{ source ->
|
||||
M3u8Helper.generateM3u8(
|
||||
"Crunchyroll",
|
||||
"Crunchyroll [$type]",
|
||||
source.url ?: return@source null,
|
||||
"",
|
||||
).forEach(callback)
|
||||
|
@ -1498,7 +1509,7 @@ object SoraExtractor : SoraStream() {
|
|||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -208,12 +208,11 @@ open class SoraStream : TmdbProvider() {
|
|||
?.randomOrNull()
|
||||
|
||||
return if (type == TvType.TvSeries) {
|
||||
val episodes = mutableListOf<Episode>()
|
||||
val lastSeason = res.seasons?.lastOrNull()?.seasonNumber
|
||||
res.seasons?.apmap { season ->
|
||||
val episodes = res.seasons?.mapNotNull { season ->
|
||||
app.get("$tmdbAPI/${data.type}/${data.id}/season/${season.seasonNumber}?api_key=$apiKey")
|
||||
.parsedSafe<MediaDetailEpisodes>()?.episodes?.map { eps ->
|
||||
episodes.add(Episode(
|
||||
Episode(
|
||||
LinkData(
|
||||
data.id,
|
||||
res.external_ids?.imdb_id,
|
||||
|
@ -236,9 +235,9 @@ open class SoraStream : TmdbProvider() {
|
|||
description = eps.overview
|
||||
).apply {
|
||||
this.addDate(eps.airDate)
|
||||
})
|
||||
}
|
||||
}
|
||||
}?.flatten() ?: listOf()
|
||||
newTvSeriesLoadResponse(
|
||||
title,
|
||||
url,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import com.lagradost.cloudstream3.gradle.CloudstreamExtension
|
||||
import com.android.build.gradle.BaseExtension
|
||||
import java.util.Properties
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
|
@ -43,11 +42,11 @@ subprojects {
|
|||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion(32)
|
||||
compileSdkVersion(33)
|
||||
|
||||
defaultConfig {
|
||||
minSdk = 21
|
||||
targetSdk = 32
|
||||
targetSdk = 33
|
||||
|
||||
// val properties = Properties()
|
||||
// properties.load(project.rootProject.file("local.properties").inputStream())
|
||||
|
@ -84,8 +83,8 @@ subprojects {
|
|||
// but you dont need to include any of them if you dont need them
|
||||
// https://github.com/recloudstream/cloudstream/blob/master/app/build.gradle
|
||||
implementation(kotlin("stdlib")) // adds standard kotlin features, like listOf, mapOf etc
|
||||
implementation("com.github.Blatzar:NiceHttp:0.3.5") // http library
|
||||
implementation("org.jsoup:jsoup:1.13.1") // html parser
|
||||
implementation("com.github.Blatzar:NiceHttp:0.4.1") // http library
|
||||
implementation("org.jsoup:jsoup:1.15.3") // html parser
|
||||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1")
|
||||
implementation("io.karn:khttp-android:0.1.2")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") // html parser
|
||||
|
|
Loading…
Reference in a new issue