exts: Fix player parsing
This commit is contained in:
parent
ac28139783
commit
aec0fb49eb
12 changed files with 99 additions and 78 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 8
|
||||
version = 9
|
||||
|
||||
dependencies {
|
||||
testImplementation(libs.junit)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.lagradost
|
||||
|
||||
import android.util.Log
|
||||
import com.lagradost.models.PlayerJson
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
|
||||
|
@ -17,6 +16,7 @@ class EneyidaProvider : MainAPI() {
|
|||
override var name = "Eneyida"
|
||||
override val hasMainPage = true
|
||||
override var lang = "uk"
|
||||
override val hasQuickSearch = true
|
||||
override val hasDownloadSupport = true
|
||||
override val supportedTypes = setOf(
|
||||
TvType.Movie,
|
||||
|
@ -56,6 +56,8 @@ class EneyidaProvider : MainAPI() {
|
|||
|
||||
}
|
||||
|
||||
override suspend fun quickSearch(query: String): List<SearchResponse> = search(query)
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val document = app.post(
|
||||
url = mainUrl,
|
||||
|
@ -83,7 +85,7 @@ class EneyidaProvider : MainAPI() {
|
|||
val year = fullInfo[0].select("a").text().toIntOrNull()
|
||||
val playerUrl = document.select(".tabs_b.visible iframe").attr("src")
|
||||
|
||||
val tvType = if (tags.contains("фільм") or playerUrl.contains("/vod/")) TvType.Movie else TvType.TvSeries
|
||||
val tvType = if (tags.contains("фільм") or tags.contains("мультьфільм") or playerUrl.contains("/vod/")) TvType.Movie else TvType.TvSeries
|
||||
val description = document.selectFirst(".full_content-desc p")?.text()?.trim()
|
||||
val trailer = document.selectFirst("div#trailer_place iframe")?.attr("src").toString()
|
||||
val rating = document.selectFirst(".r_kp span, .r_imdb span")?.text().toRatingInt()
|
||||
|
@ -101,16 +103,16 @@ class EneyidaProvider : MainAPI() {
|
|||
.substringAfterLast("file: \'")
|
||||
.substringBefore("\',")
|
||||
|
||||
tryParseJson<List<PlayerJson>>(playerRawJson)?.map { dubs -> // Dubs
|
||||
for(season in dubs.folder){ // Seasons
|
||||
for(episode in season.folder){ // Episodes
|
||||
tryParseJson<List<PlayerJson>>(playerRawJson)?.map { season -> // Dubs
|
||||
for (episode in season.folder) { // Seasons
|
||||
for (dubs in episode.folder) { // Episodes
|
||||
episodes.add(
|
||||
Episode(
|
||||
"${season.title}, ${episode.title}, $playerUrl",
|
||||
episode.title,
|
||||
season.title.replace(" Сезон ","").toIntOrNull(),
|
||||
episode.title.replace("Серія ","").toIntOrNull(),
|
||||
episode.poster
|
||||
season.title.replace(" сезон","").toIntOrNull(),
|
||||
episode.title.replace(" серія","").toIntOrNull(),
|
||||
dubs.poster
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -118,7 +120,7 @@ class EneyidaProvider : MainAPI() {
|
|||
}
|
||||
newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) {
|
||||
this.posterUrl = poster
|
||||
this.backgroundPosterUrl = banner
|
||||
this.backgroundPosterUrl = "$mainUrl$banner"
|
||||
this.year = year
|
||||
this.plot = description
|
||||
this.tags = tags
|
||||
|
@ -130,7 +132,7 @@ class EneyidaProvider : MainAPI() {
|
|||
} else { // Parse as Movie.
|
||||
newMovieLoadResponse(title, url, TvType.Movie, "$title, $playerUrl") {
|
||||
this.posterUrl = poster
|
||||
this.backgroundPosterUrl = banner
|
||||
this.backgroundPosterUrl = "$mainUrl$banner"
|
||||
this.year = year
|
||||
this.plot = description
|
||||
this.tags = tags
|
||||
|
@ -180,28 +182,26 @@ class EneyidaProvider : MainAPI() {
|
|||
.substringAfterLast("file: \'")
|
||||
.substringBefore("\',")
|
||||
|
||||
tryParseJson<List<PlayerJson>>(playerRawJson)?.map { dubs -> // Dubs
|
||||
for(season in dubs.folder){ // Seasons
|
||||
if(season.title == dataList[0]){
|
||||
for(episode in season.folder){ // Episodes
|
||||
if(episode.title == dataList[1]){
|
||||
// Add as source
|
||||
M3u8Helper.generateM3u8(
|
||||
source = dubs.title,
|
||||
streamUrl = episode.file.replace("https://", "http://"),
|
||||
referer = "https://tortuga.wtf/"
|
||||
).last().let(callback)
|
||||
tryParseJson<List<PlayerJson>>(playerRawJson)?.map { season ->
|
||||
if(season.title != dataList[0]) return@map
|
||||
|
||||
if(episode.subtitle.isBlank()) return@map
|
||||
episode.subtitle.split(",").forEach{
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
it.substringAfterLast("[").substringBefore("]"),
|
||||
it.substringAfter("]")
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
for (episode in season.folder) {
|
||||
if(episode.title != dataList[1]) return@map
|
||||
|
||||
for (dubs in episode.folder) {
|
||||
M3u8Helper.generateM3u8(
|
||||
source = dubs.title,
|
||||
streamUrl = dubs.file,
|
||||
referer = "https://tortuga.wtf/"
|
||||
).last().let(callback)
|
||||
|
||||
if(dubs.subtitle.isNullOrBlank()) {
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
dubs.subtitle.substringAfterLast("[").substringBefore("]"),
|
||||
dubs.subtitle.substringAfter("]")
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package com.lagradost.models
|
|||
data class PlayerJson (
|
||||
|
||||
val title : String,
|
||||
val season : Int,
|
||||
val folder : List<Season>
|
||||
)
|
||||
|
||||
data class Season (
|
||||
|
||||
val title : String,
|
||||
val number: Int,
|
||||
val folder : List<Episode>
|
||||
)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 5
|
||||
version = 6
|
||||
|
||||
dependencies {
|
||||
testImplementation(libs.junit)
|
||||
|
|
|
@ -14,6 +14,7 @@ class KinoVezhaProvider : MainAPI() {
|
|||
override var name = "KinoVezha"
|
||||
override val hasMainPage = true
|
||||
override var lang = "uk"
|
||||
override val hasQuickSearch = true
|
||||
override val hasDownloadSupport = true
|
||||
override val supportedTypes = setOf(
|
||||
TvType.Movie,
|
||||
|
@ -53,6 +54,8 @@ class KinoVezhaProvider : MainAPI() {
|
|||
|
||||
}
|
||||
|
||||
override suspend fun quickSearch(query: String): List<SearchResponse> = search(query)
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val document = app.post(
|
||||
url = "$mainUrl/index.php?do=search",
|
||||
|
@ -95,16 +98,16 @@ class KinoVezhaProvider : MainAPI() {
|
|||
.substringAfterLast("file: \'")
|
||||
.substringBefore("\',")
|
||||
|
||||
AppUtils.tryParseJson<List<PlayerJson>>(playerRawJson)?.map { dubs -> // Dubs
|
||||
for(season in dubs.folder){ // Seasons
|
||||
for(episode in season.folder){ // Episodes
|
||||
AppUtils.tryParseJson<List<PlayerJson>>(playerRawJson)?.map { season -> // Dubs
|
||||
for (episode in season.folder) { // Seasons
|
||||
for (dubs in episode.folder) { // Episodes
|
||||
episodes.add(
|
||||
Episode(
|
||||
"${season.title}, ${episode.title}, $playerUrl",
|
||||
episode.title,
|
||||
season.title.replace(" Сезон ","").toIntOrNull(),
|
||||
episode.title.replace("Серія ","").toIntOrNull(),
|
||||
episode.poster
|
||||
season.season,
|
||||
episode.number,
|
||||
dubs.poster
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -156,18 +159,26 @@ class KinoVezhaProvider : MainAPI() {
|
|||
.substringAfterLast("file: \'")
|
||||
.substringBefore("\',")
|
||||
|
||||
AppUtils.tryParseJson<List<PlayerJson>>(playerRawJson)?.map { dubs -> // Dubs
|
||||
for(season in dubs.folder){ // Seasons
|
||||
if(season.title == dataList[0]){
|
||||
for(episode in season.folder){ // Episodes
|
||||
if(episode.title == dataList[1]){
|
||||
// Add as source
|
||||
M3u8Helper.generateM3u8(
|
||||
source = dubs.title,
|
||||
streamUrl = episode.file,
|
||||
referer = "https://tortuga.wtf/"
|
||||
).last().let(callback)
|
||||
}
|
||||
AppUtils.tryParseJson<List<PlayerJson>>(playerRawJson)?.map { season ->
|
||||
if(season.title != dataList[0]) return@map
|
||||
|
||||
for (episode in season.folder) {
|
||||
if(episode.title != dataList[1]) return@map
|
||||
|
||||
for (dubs in episode.folder) {
|
||||
M3u8Helper.generateM3u8(
|
||||
source = dubs.title,
|
||||
streamUrl = dubs.file,
|
||||
referer = "https://tortuga.wtf/"
|
||||
).last().let(callback)
|
||||
|
||||
if(dubs.subtitle.isNullOrBlank()) {
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
dubs.subtitle.substringAfterLast("[").substringBefore("]"),
|
||||
dubs.subtitle.substringAfter("]")
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package com.lagradost.models
|
|||
data class PlayerJson (
|
||||
|
||||
val title : String,
|
||||
val season : Int,
|
||||
val folder : List<Season>
|
||||
)
|
||||
|
||||
data class Season (
|
||||
|
||||
val title : String,
|
||||
val number: Int,
|
||||
val folder : List<Episode>
|
||||
)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 6
|
||||
version = 7
|
||||
|
||||
dependencies {
|
||||
testImplementation(libs.junit)
|
||||
|
|
|
@ -10,7 +10,7 @@ data class GeneralInfo (
|
|||
val isFamilyFriendly : Boolean,
|
||||
val timeRequired : Int,
|
||||
val datePublished : String,
|
||||
val director : List<Director>,
|
||||
val director : List<Director>?,
|
||||
val actor : List<Actor>,
|
||||
val countryOfOrigin : List<CountryOfOrigin>,
|
||||
val aggregateRating : AggregateRating?,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 6
|
||||
version = 7
|
||||
|
||||
dependencies {
|
||||
testImplementation(libs.junit)
|
||||
|
|
|
@ -27,6 +27,7 @@ class SerialnoProvider : MainAPI() {
|
|||
override var name = "Serialno"
|
||||
override val hasMainPage = true
|
||||
override var lang = "uk"
|
||||
override val hasQuickSearch = true
|
||||
override val hasDownloadSupport = true
|
||||
override val supportedTypes = setOf(
|
||||
TvType.Movie,
|
||||
|
@ -66,6 +67,8 @@ class SerialnoProvider : MainAPI() {
|
|||
|
||||
}
|
||||
|
||||
override suspend fun quickSearch(query: String): List<SearchResponse> = search(query)
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val document = app.post(
|
||||
url = "$mainUrl/",
|
||||
|
@ -115,16 +118,16 @@ class SerialnoProvider : MainAPI() {
|
|||
.substringAfterLast("file: \'")
|
||||
.substringBefore("\',")
|
||||
|
||||
AppUtils.tryParseJson<List<PlayerJson>>(playerRawJson)?.map { dubs -> // Dubs
|
||||
for (season in dubs.folder) { // Seasons
|
||||
for (episode in season.folder) { // Episodes
|
||||
AppUtils.tryParseJson<List<PlayerJson>>(playerRawJson)?.map { season -> // Dubs
|
||||
for (episode in season.folder) { // Seasons
|
||||
for (dubs in episode.folder) { // Episodes
|
||||
episodes.add(
|
||||
Episode(
|
||||
"${season.title}, ${episode.title}, $playerUrl",
|
||||
episode.title,
|
||||
season.title.replace(" Сезон ", "").toIntOrNull(),
|
||||
episode.title.replace("Серія ", "").toIntOrNull(),
|
||||
episode.poster
|
||||
season.season,
|
||||
episode.number,
|
||||
dubs.poster
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -153,26 +156,26 @@ class SerialnoProvider : MainAPI() {
|
|||
.substringAfterLast("file: \'")
|
||||
.substringBefore("\',")
|
||||
|
||||
AppUtils.tryParseJson<List<PlayerJson>>(playerRawJson)?.map { dubs -> // Dubs
|
||||
for(season in dubs.folder){ // Seasons
|
||||
if(season.title == dataList[0]){
|
||||
for(episode in season.folder){ // Episodes
|
||||
if(episode.title == dataList[1]){
|
||||
// Add as source
|
||||
M3u8Helper.generateM3u8(
|
||||
source = dubs.title,
|
||||
streamUrl = episode.file,
|
||||
referer = "https://tortuga.wtf/"
|
||||
).last().let(callback)
|
||||
AppUtils.tryParseJson<List<PlayerJson>>(playerRawJson)?.map { season ->
|
||||
if(season.title != dataList[0]) return@map
|
||||
|
||||
if(episode.subtitle.isNullOrBlank()) return true
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
episode.subtitle.substringAfterLast("[").substringBefore("]"),
|
||||
episode.subtitle.substringAfter("]")
|
||||
)
|
||||
for (episode in season.folder) {
|
||||
if(episode.title != dataList[1]) return@map
|
||||
|
||||
for (dubs in episode.folder) {
|
||||
M3u8Helper.generateM3u8(
|
||||
source = dubs.title,
|
||||
streamUrl = dubs.file,
|
||||
referer = "https://tortuga.wtf/"
|
||||
).last().let(callback)
|
||||
|
||||
if(dubs.subtitle.isNullOrBlank()) {
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
dubs.subtitle.substringAfterLast("[").substringBefore("]"),
|
||||
dubs.subtitle.substringAfter("]")
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package com.lagradost.models
|
|||
data class PlayerJson (
|
||||
|
||||
val title : String,
|
||||
val season : Int,
|
||||
val folder : List<Season>
|
||||
)
|
||||
|
||||
data class Season (
|
||||
|
||||
val title : String,
|
||||
val number: Int,
|
||||
val folder : List<Episode>
|
||||
)
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.lagradost
|
||||
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
||||
import com.lagradost.cloudstreamtest.ProviderTester
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Test
|
||||
|
|
Loading…
Reference in a new issue