mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
fixed json from github issue
This commit is contained in:
parent
d4f33eecde
commit
ada48f2a98
8 changed files with 50 additions and 40 deletions
|
@ -15,7 +15,6 @@
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="resolveModulePerSourceSet" value="false" />
|
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -76,7 +76,7 @@ object APIHolder {
|
||||||
TwoEmbedProvider(),
|
TwoEmbedProvider(),
|
||||||
DramaSeeProvider(),
|
DramaSeeProvider(),
|
||||||
WatchAsianProvider(),
|
WatchAsianProvider(),
|
||||||
DramaidProvider(),
|
DramaidProvider(),
|
||||||
KdramaHoodProvider(),
|
KdramaHoodProvider(),
|
||||||
AkwamProvider(),
|
AkwamProvider(),
|
||||||
MyCimaProvider(),
|
MyCimaProvider(),
|
||||||
|
@ -116,20 +116,27 @@ object APIHolder {
|
||||||
DubbedAnimeProvider(),
|
DubbedAnimeProvider(),
|
||||||
MonoschinosProvider(),
|
MonoschinosProvider(),
|
||||||
KawaiifuProvider(), // disabled due to cloudflare
|
KawaiifuProvider(), // disabled due to cloudflare
|
||||||
NeonimeProvider(),
|
NeonimeProvider(),
|
||||||
KuramanimeProvider(),
|
KuramanimeProvider(),
|
||||||
OploverzProvider(),
|
OploverzProvider(),
|
||||||
GomunimeProvider(),
|
GomunimeProvider(),
|
||||||
NontonAnimeIDProvider(),
|
NontonAnimeIDProvider(),
|
||||||
KuronimeProvider(),
|
KuronimeProvider(),
|
||||||
//MultiAnimeProvider(),
|
//MultiAnimeProvider(),
|
||||||
NginxProvider(),
|
NginxProvider(),
|
||||||
OlgplyProvider(),
|
OlgplyProvider(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun initAll() {
|
||||||
|
for (api in allProviders) {
|
||||||
|
api.init()
|
||||||
|
}
|
||||||
|
APIHolder.apiMap = null
|
||||||
|
}
|
||||||
|
|
||||||
var apis: List<MainAPI> = arrayListOf()
|
var apis: List<MainAPI> = arrayListOf()
|
||||||
private var apiMap: Map<String, Int>? = null
|
var apiMap: Map<String, Int>? = null
|
||||||
|
|
||||||
private fun initMap() {
|
private fun initMap() {
|
||||||
if (apiMap == null)
|
if (apiMap == null)
|
||||||
|
@ -143,7 +150,6 @@ object APIHolder {
|
||||||
fun getApiFromNameNull(apiName: String?): MainAPI? {
|
fun getApiFromNameNull(apiName: String?): MainAPI? {
|
||||||
if (apiName == null) return null
|
if (apiName == null) return null
|
||||||
initMap()
|
initMap()
|
||||||
|
|
||||||
return apiMap?.get(apiName)?.let { apis.getOrNull(it) }
|
return apiMap?.get(apiName)?.let { apis.getOrNull(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,12 +162,12 @@ object APIHolder {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getLoadResponseIdFromUrl(url : String, apiName: String) : Int {
|
fun getLoadResponseIdFromUrl(url: String, apiName: String): Int {
|
||||||
return url.replace(getApiFromName(apiName).mainUrl, "").replace("/", "").hashCode()
|
return url.replace(getApiFromName(apiName).mainUrl, "").replace("/", "").hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun LoadResponse.getId(): Int {
|
fun LoadResponse.getId(): Int {
|
||||||
return getLoadResponseIdFromUrl(url,apiName)
|
return getLoadResponseIdFromUrl(url, apiName)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -338,18 +344,19 @@ abstract class MainAPI {
|
||||||
var overrideData: HashMap<String, ProvidersInfoJson>? = null
|
var overrideData: HashMap<String, ProvidersInfoJson>? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun overrideWithNewData(data: ProvidersInfoJson) {
|
fun init() {
|
||||||
this.name = data.name
|
|
||||||
this.mainUrl = data.url
|
|
||||||
this.storedCredentials = data.credentials
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
overrideData?.get(this.javaClass.simpleName)?.let { data ->
|
overrideData?.get(this.javaClass.simpleName)?.let { data ->
|
||||||
overrideWithNewData(data)
|
overrideWithNewData(data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun overrideWithNewData(data: ProvidersInfoJson) {
|
||||||
|
this.name = data.name
|
||||||
|
this.name
|
||||||
|
this.mainUrl = data.url
|
||||||
|
this.storedCredentials = data.credentials
|
||||||
|
}
|
||||||
|
|
||||||
open var name = "NONE"
|
open var name = "NONE"
|
||||||
open var mainUrl = "NONE"
|
open var mainUrl = "NONE"
|
||||||
open var storedCredentials: String? = null
|
open var storedCredentials: String? = null
|
||||||
|
@ -765,12 +772,12 @@ fun AnimeSearchResponse.addDubStatus(isDub: Boolean, episodes: Int? = null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun AnimeSearchResponse.addDub(episodes: Int?) {
|
fun AnimeSearchResponse.addDub(episodes: Int?) {
|
||||||
if(episodes == null || episodes <= 0) return
|
if (episodes == null || episodes <= 0) return
|
||||||
addDubStatus(DubStatus.Dubbed, episodes)
|
addDubStatus(DubStatus.Dubbed, episodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun AnimeSearchResponse.addSub(episodes: Int?) {
|
fun AnimeSearchResponse.addSub(episodes: Int?) {
|
||||||
if(episodes == null || episodes <= 0) return
|
if (episodes == null || episodes <= 0) return
|
||||||
addDubStatus(DubStatus.Subbed, episodes)
|
addDubStatus(DubStatus.Subbed, episodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.jaredrummler.android.colorpicker.ColorPickerDialogListener
|
||||||
import com.lagradost.cloudstream3.APIHolder.allProviders
|
import com.lagradost.cloudstream3.APIHolder.allProviders
|
||||||
import com.lagradost.cloudstream3.APIHolder.apis
|
import com.lagradost.cloudstream3.APIHolder.apis
|
||||||
import com.lagradost.cloudstream3.APIHolder.getApiDubstatusSettings
|
import com.lagradost.cloudstream3.APIHolder.getApiDubstatusSettings
|
||||||
|
import com.lagradost.cloudstream3.APIHolder.initAll
|
||||||
import com.lagradost.cloudstream3.CommonActivity.backEvent
|
import com.lagradost.cloudstream3.CommonActivity.backEvent
|
||||||
import com.lagradost.cloudstream3.CommonActivity.loadThemes
|
import com.lagradost.cloudstream3.CommonActivity.loadThemes
|
||||||
import com.lagradost.cloudstream3.CommonActivity.onColorSelectedEvent
|
import com.lagradost.cloudstream3.CommonActivity.onColorSelectedEvent
|
||||||
|
@ -390,7 +391,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addNginxToJson(data: java.util.HashMap<String, ProvidersInfoJson>): java.util.HashMap<String, ProvidersInfoJson>? {
|
fun addNginxToJson(data: java.util.HashMap<String, ProvidersInfoJson>): java.util.HashMap<String, ProvidersInfoJson> {
|
||||||
try {
|
try {
|
||||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(this)
|
val settingsManager = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
val nginxUrl =
|
val nginxUrl =
|
||||||
|
@ -402,18 +403,18 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
"nginx_credentials"
|
"nginx_credentials"
|
||||||
)
|
)
|
||||||
.toString()
|
.toString()
|
||||||
val StoredNginxProvider = NginxProvider()
|
val storedNginxProvider = NginxProvider()
|
||||||
if (nginxUrl == "nginx_url_key" || nginxUrl == "") { // if key is default value, or empty:
|
if (nginxUrl == "nginx_url_key" || nginxUrl == "") { // if key is default value, or empty:
|
||||||
data[StoredNginxProvider.javaClass.simpleName] = ProvidersInfoJson(
|
data[storedNginxProvider.javaClass.simpleName] = ProvidersInfoJson(
|
||||||
url = nginxUrl,
|
url = nginxUrl,
|
||||||
name = StoredNginxProvider.name,
|
name = storedNginxProvider.name,
|
||||||
status = PROVIDER_STATUS_DOWN, // the provider will not be display
|
status = PROVIDER_STATUS_DOWN, // the provider will not be display
|
||||||
credentials = nginxCredentials
|
credentials = nginxCredentials
|
||||||
)
|
)
|
||||||
} else { // valid url
|
} else { // valid url
|
||||||
data[StoredNginxProvider.javaClass.simpleName] = ProvidersInfoJson(
|
data[storedNginxProvider.javaClass.simpleName] = ProvidersInfoJson(
|
||||||
url = nginxUrl,
|
url = nginxUrl,
|
||||||
name = StoredNginxProvider.name,
|
name = storedNginxProvider.name,
|
||||||
status = PROVIDER_STATUS_OK,
|
status = PROVIDER_STATUS_OK,
|
||||||
credentials = nginxCredentials
|
credentials = nginxCredentials
|
||||||
)
|
)
|
||||||
|
@ -472,8 +473,8 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
MainAPI.overrideData = newCache // update all new providers
|
MainAPI.overrideData = newCache // update all new providers
|
||||||
|
|
||||||
val newUpdatedCache =
|
val newUpdatedCache =
|
||||||
newCache?.let { addNginxToJson(it) ?: it }
|
newCache?.let { addNginxToJson(it) }
|
||||||
|
initAll()
|
||||||
for (api in apis) { // update current providers
|
for (api in apis) { // update current providers
|
||||||
newUpdatedCache?.get(api.javaClass.simpleName)
|
newUpdatedCache?.get(api.javaClass.simpleName)
|
||||||
?.let { data ->
|
?.let { data ->
|
||||||
|
@ -493,8 +494,9 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
newCache
|
newCache
|
||||||
}?.let { providersJsonMap ->
|
}?.let { providersJsonMap ->
|
||||||
MainAPI.overrideData = providersJsonMap
|
MainAPI.overrideData = providersJsonMap
|
||||||
val providersJsonMapUpdated = addNginxToJson(providersJsonMap)
|
val providersJsonMapUpdated =
|
||||||
?: providersJsonMap // if return null, use unchanged one
|
addNginxToJson(providersJsonMap) // if return null, use unchanged one
|
||||||
|
initAll()
|
||||||
val acceptableProviders =
|
val acceptableProviders =
|
||||||
providersJsonMapUpdated.filter { it.value.status == PROVIDER_STATUS_OK || it.value.status == PROVIDER_STATUS_SLOW }
|
providersJsonMapUpdated.filter { it.value.status == PROVIDER_STATUS_OK || it.value.status == PROVIDER_STATUS_SLOW }
|
||||||
.map { it.key }.toSet()
|
.map { it.key }.toSet()
|
||||||
|
@ -517,11 +519,13 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
initAll()
|
||||||
apis = allProviders
|
apis = allProviders
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
logError(e)
|
logError(e)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
initAll()
|
||||||
apis = allProviders
|
apis = allProviders
|
||||||
try {
|
try {
|
||||||
val nginxProviderName = NginxProvider().name
|
val nginxProviderName = NginxProvider().name
|
||||||
|
@ -533,7 +537,6 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logError(e)
|
logError(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadThemes(this)
|
loadThemes(this)
|
||||||
|
|
|
@ -2,13 +2,13 @@ package com.lagradost.cloudstream3.movieproviders
|
||||||
|
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.mvvm.logError
|
import com.lagradost.cloudstream3.mvvm.logError
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
|
|
||||||
class CineblogProvider : MainAPI() {
|
class CineblogProvider : MainAPI() {
|
||||||
override val lang = "it"
|
override val lang = "it"
|
||||||
override var mainUrl = "https://cb01.rip"
|
override var mainUrl = "https://cb01.rip"
|
||||||
override var name = "CineBlog01"
|
override var name = "CineBlog"
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
override val hasChromecastSupport = true
|
override val hasChromecastSupport = true
|
||||||
override val supportedTypes = setOf(
|
override val supportedTypes = setOf(
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.httpsify
|
import com.lagradost.cloudstream3.utils.httpsify
|
||||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
import okhttp3.Interceptor
|
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
|
|
||||||
class HDMovie5 : MainAPI() {
|
class HDMovie5 : MainAPI() {
|
||||||
|
@ -137,7 +136,8 @@ class HDMovie5 : MainAPI() {
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
): Boolean {
|
): Boolean {
|
||||||
return data.split(",").apmapIndexed { index, it ->
|
return data.split(",").apmapIndexed { index, it ->
|
||||||
val html = app.post(
|
//println("loadLinks:::: $index $it")
|
||||||
|
val p = app.post(
|
||||||
"$mainUrl/wp-admin/admin-ajax.php",
|
"$mainUrl/wp-admin/admin-ajax.php",
|
||||||
data = mapOf(
|
data = mapOf(
|
||||||
"action" to "doo_player_ajax",
|
"action" to "doo_player_ajax",
|
||||||
|
@ -145,10 +145,12 @@ class HDMovie5 : MainAPI() {
|
||||||
"nume" to "${index + 1}",
|
"nume" to "${index + 1}",
|
||||||
"type" to "movie"
|
"type" to "movie"
|
||||||
)
|
)
|
||||||
).parsed<PlayerAjaxResponse>().embedURL ?: return@apmapIndexed false
|
)
|
||||||
|
// println("TEXT::::: ${p.text}")
|
||||||
|
val html = p.parsedSafe<PlayerAjaxResponse>()?.embedURL ?: return@apmapIndexed false
|
||||||
val doc = Jsoup.parse(html)
|
val doc = Jsoup.parse(html)
|
||||||
val link = doc.select("iframe").attr("src")
|
val link = doc.select("iframe").attr("src")
|
||||||
loadExtractor(httpsify(link), "$mainUrl/",callback)
|
loadExtractor(httpsify(link), "$mainUrl/", callback)
|
||||||
}.contains(true)
|
}.contains(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -227,7 +227,7 @@ class HomeFragment : Fragment() {
|
||||||
listView?.choiceMode = AbsListView.CHOICE_MODE_SINGLE
|
listView?.choiceMode = AbsListView.CHOICE_MODE_SINGLE
|
||||||
|
|
||||||
listView?.setOnItemClickListener { _, _, i, _ ->
|
listView?.setOnItemClickListener { _, _, i, _ ->
|
||||||
if (!currentValidApis.isNullOrEmpty()) {
|
if (currentValidApis.isNotEmpty()) {
|
||||||
currentApiName = currentValidApis[i].name
|
currentApiName = currentValidApis[i].name
|
||||||
//to switch to apply simply remove this
|
//to switch to apply simply remove this
|
||||||
currentApiName?.let(callback)
|
currentApiName?.let(callback)
|
||||||
|
|
|
@ -1508,7 +1508,7 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
|
||||||
when (startAction) {
|
when (startAction) {
|
||||||
START_ACTION_RESUME_LATEST -> {
|
START_ACTION_RESUME_LATEST -> {
|
||||||
for (ep in episodeList) {
|
for (ep in episodeList) {
|
||||||
println("WATCH STATUS::: S${ep.season} E ${ep.episode} - ${ep.getWatchProgress()}")
|
//println("WATCH STATUS::: S${ep.season} E ${ep.episode} - ${ep.getWatchProgress()}")
|
||||||
if (ep.getWatchProgress() > 0.90f) { // watched too much
|
if (ep.getWatchProgress() > 0.90f) { // watched too much
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -1528,7 +1528,7 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
|
||||||
var found = false
|
var found = false
|
||||||
for (ep in episodeList) {
|
for (ep in episodeList) {
|
||||||
if (ep.id == startValue) { // watched too much
|
if (ep.id == startValue) { // watched too much
|
||||||
println("WATCH STATUS::: START_ACTION_LOAD_EP S${ep.season} E ${ep.episode} - ${ep.getWatchProgress()}")
|
//println("WATCH STATUS::: START_ACTION_LOAD_EP S${ep.season} E ${ep.episode} - ${ep.getWatchProgress()}")
|
||||||
handleAction(EpisodeClickEvent(ACTION_PLAY_EPISODE_IN_PLAYER, ep))
|
handleAction(EpisodeClickEvent(ACTION_PLAY_EPISODE_IN_PLAYER, ep))
|
||||||
found = true
|
found = true
|
||||||
break
|
break
|
||||||
|
@ -1537,7 +1537,7 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
|
||||||
if (!found)
|
if (!found)
|
||||||
for (ep in episodeList) {
|
for (ep in episodeList) {
|
||||||
if (ep.episode == resumeEpisode && ep.season == resumeSeason) {
|
if (ep.episode == resumeEpisode && ep.season == resumeSeason) {
|
||||||
println("WATCH STATUS::: START_ACTION_LOAD_EP S${ep.season} E ${ep.episode} - ${ep.getWatchProgress()}")
|
//println("WATCH STATUS::: START_ACTION_LOAD_EP S${ep.season} E ${ep.episode} - ${ep.getWatchProgress()}")
|
||||||
handleAction(
|
handleAction(
|
||||||
EpisodeClickEvent(
|
EpisodeClickEvent(
|
||||||
ACTION_PLAY_EPISODE_IN_PLAYER,
|
ACTION_PLAY_EPISODE_IN_PLAYER,
|
||||||
|
|
|
@ -46,7 +46,6 @@ object SearchHelper {
|
||||||
activity.loadSearchResult(card, START_ACTION_LOAD_EP, id)
|
activity.loadSearchResult(card, START_ACTION_LOAD_EP, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
handleSearchClickCallback(
|
handleSearchClickCallback(
|
||||||
activity,
|
activity,
|
||||||
|
|
Loading…
Reference in a new issue