[sora] fixed Kimcartoon

This commit is contained in:
hexated 2023-01-20 17:10:37 +07:00
parent 7da4d9b5e6
commit f3b06e2a3b
1 changed files with 18 additions and 18 deletions

View File

@ -719,29 +719,31 @@ object SoraExtractor : SoraStream() {
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val fixTitle = title.fixTitle() val fixTitle = title.fixTitle()
val url = if (season == null) { val doc = if (season == null || season == 1) {
"$kimcartoonAPI/Cartoon/$fixTitle" app.get("$kimcartoonAPI/Cartoon/$fixTitle").document
} else { } else {
"$kimcartoonAPI/Cartoon/$fixTitle-season-$season" val res = app.get("$kimcartoonAPI/Cartoon/$fixTitle-Season-$season")
if (res.url == "$kimcartoonAPI/")
app.get("$kimcartoonAPI/Cartoon/$fixTitle-Season-0$season").document else res.document
} }
val doc = app.get(url).document
val iframe = if (season == null) { val iframe = if (season == null) {
doc.select("table.listing tr td a").firstNotNullOf { it.attr("href") } doc.select("table.listing tr td a").firstNotNullOf { it.attr("href") }
} else { } else {
doc.select("table.listing tr td a").map { doc.select("table.listing tr td a").find {
it.attr("href") it.attr("href").contains(Regex("(?i)Episode-0*$episode"))
}.first { it.contains("Season-$season", true) && it.contains("Episode-$episode", true) } }?.attr("href")
} ?: return } ?: return
val source = val source =
app.get(fixUrl(iframe, kimcartoonAPI)).document.select("div#divContentVideo iframe") app.get(
.attr("src") fixUrl(iframe, kimcartoonAPI)
).document.selectFirst("div#divContentVideo iframe")
?.attr("src") ?: return
loadExtractor(source, "$kimcartoonAPI/", subtitleCallback) { link -> loadExtractor(source, "$kimcartoonAPI/", subtitleCallback) { link ->
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(
"Luxubu", "Kimcartoon",
"Luxubu", "Kimcartoon",
link.url, link.url,
link.referer, link.referer,
link.quality, link.quality,
@ -904,15 +906,13 @@ object SoraExtractor : SoraStream() {
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val fixTitle = title.fixTitle() val fixTitle = title.fixTitle()
val url = if (season == null) { val doc = if(season == null) {
val tempUrl = "$xMovieAPI/movies/$fixTitle/watch" val res = app.get("$xMovieAPI/movies/$fixTitle/watch")
val newUrl = app.get(tempUrl).url if(res.url == "$xMovieAPI/") app.get("$xMovieAPI/movies/$fixTitle-$year/watch").document else res.document
if (newUrl == "$xMovieAPI/") "$xMovieAPI/movies/$fixTitle-$year/watch" else tempUrl
} else { } else {
"$xMovieAPI/series/$fixTitle-season-$season-episode-$episode/watch" app.get("$xMovieAPI/series/$fixTitle-season-$season-episode-$episode/watch").document
} }
val doc = app.get(url).document
val script = doc.selectFirst("script:containsData(const player =)")?.data() ?: return val script = doc.selectFirst("script:containsData(const player =)")?.data() ?: return
val link = val link =
Regex("[\"|']file[\"|']:\\s?[\"|'](http.*?.(mp4|m3u8))[\"|'],").find(script)?.groupValues?.getOrNull( Regex("[\"|']file[\"|']:\\s?[\"|'](http.*?.(mp4|m3u8))[\"|'],").find(script)?.groupValues?.getOrNull(