Skip to content

Commit

Permalink
fix #425 ??
Browse files Browse the repository at this point in the history
  • Loading branch information
jackjohn committed Dec 11, 2023
1 parent 4cdfa58 commit 7f966fa
Show file tree
Hide file tree
Showing 13 changed files with 112 additions and 341 deletions.
33 changes: 5 additions & 28 deletions AnimeIndoProvider/src/main/kotlin/com/hexated/AnimeIndoProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.network.CloudflareKiller
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.httpsify
import com.lagradost.cloudstream3.utils.loadExtractor
import okhttp3.Interceptor
import okhttp3.Response
import org.jsoup.Jsoup
import org.jsoup.nodes.Element

Expand All @@ -18,26 +15,12 @@ class AnimeIndoProvider : MainAPI() {
override var name = "AnimeIndo"
override val hasMainPage = true
override var lang = "id"
private val cloudflareKiller by lazy { CloudflareKiller() }
private val interceptor by lazy { CloudflareInterceptor(cloudflareKiller) }
override val supportedTypes = setOf(
TvType.Anime,
TvType.AnimeMovie,
TvType.OVA
)

class CloudflareInterceptor(private val cloudflareKiller: CloudflareKiller): Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val response = chain.proceed(request)
val doc = Jsoup.parse(response.peekBody(1024 * 1024).string())
if (doc.select("title").text() == "Just a moment...") {
return cloudflareKiller.intercept(chain)
}
return response
}
}

companion object {
fun getType(t: String): TvType {
return if (t.contains("OVA", true) || t.contains("Special")) TvType.OVA
Expand Down Expand Up @@ -66,8 +49,7 @@ class AnimeIndoProvider : MainAPI() {
page: Int,
request: MainPageRequest
): HomePageResponse {
val url = "$mainUrl/${request.data}/page/$page"
val document = app.get(url, interceptor = interceptor).document
val document = app.get("$mainUrl/${request.data}/page/$page").document
val home = document.select("main#main div.animposx").mapNotNull {
it.toSearchResult()
}
Expand Down Expand Up @@ -101,24 +83,21 @@ class AnimeIndoProvider : MainAPI() {
return newAnimeSearchResponse(title, href, TvType.Anime) {
this.posterUrl = posterUrl
addSub(epNum)
posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap()
}

}

override suspend fun search(query: String): List<SearchResponse> {
val anime = mutableListOf<SearchResponse>()
(1..2).forEach { page ->
val link = "$mainUrl/page/$page/?s=$query"
val document = app.get(link, interceptor = interceptor).document
val document = app.get("$mainUrl/page/$page/?s=$query").document
val media = document.select(".site-main.relat > article").mapNotNull {
val title = it.selectFirst("div.title > h2")!!.ownText().trim()
val href = it.selectFirst("a")!!.attr("href")
val posterUrl = it.selectFirst("img")!!.attr("src").toString()
val type = getType(it.select("div.type").text().trim())
newAnimeSearchResponse(title, href, type) {
this.posterUrl = posterUrl
posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap()
}
}
if(media.isNotEmpty()) anime.addAll(media)
Expand All @@ -127,8 +106,7 @@ class AnimeIndoProvider : MainAPI() {
}

override suspend fun load(url: String): LoadResponse? {
val document = app.get(url, interceptor = interceptor).document

val document = app.get(url).document
val title = document.selectFirst("h1.entry-title")?.text()?.replace("Subtitle Indonesia", "")
?.trim() ?: return null
val poster = document.selectFirst("div.thumb > img[itemprop=image]")?.attr("src")
Expand Down Expand Up @@ -168,7 +146,6 @@ class AnimeIndoProvider : MainAPI() {
addTrailer(trailer)
addMalId(tracker?.malId)
addAniListId(tracker?.aniId?.toIntOrNull())
posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap()
}
}

Expand All @@ -179,12 +156,12 @@ class AnimeIndoProvider : MainAPI() {
callback: (ExtractorLink) -> Unit
): Boolean {

val document = app.get(data, interceptor = interceptor).document
val document = app.get(data).document
document.select("div.itemleft > .mirror > option").mapNotNull {
fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("src"))
}.apmap {
if (it.startsWith(mainUrl)) {
app.get(it, referer = "$mainUrl/", interceptor = interceptor).document.select("iframe").attr("src")
app.get(it, referer = "$mainUrl/").document.select("iframe").attr("src")
} else {
it
}
Expand Down
2 changes: 1 addition & 1 deletion Gomov/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.konan.properties.Properties

// use an integer for version numbers
version = 28
version = 29

android {
defaultConfig {
Expand Down
2 changes: 1 addition & 1 deletion Gomov/src/main/kotlin/com/hexated/DutaMovie.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.lagradost.cloudstream3.utils.httpsify
import com.lagradost.cloudstream3.utils.loadExtractor

class DutaMovie : Gomov() {
override var mainUrl = "https://boxoffice.dutamovie21.club"
override var mainUrl = "https://bioskop.dutamovie21.vip"
override var name = "DutaMovie"
override val mainPage = mainPageOf(
"category/box-office/page/%d/" to "Box Office",
Expand Down
2 changes: 1 addition & 1 deletion Gomov/src/main/kotlin/com/hexated/Ngefilm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.hexated
import com.lagradost.cloudstream3.mainPageOf

class Ngefilm : Gomov() {
override var mainUrl = "https://nge-film21.fun"
override var mainUrl = "https://nge-film21.pics"
override var name = "Ngefilm"

override val mainPage = mainPageOf(
Expand Down
2 changes: 1 addition & 1 deletion Gomov/src/main/kotlin/com/hexated/Nodrakorid.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.jsoup.nodes.Element
import java.net.URI

class Nodrakorid : Gomov() {
override var mainUrl = "https://no-drakor.xyz"
override var mainUrl = "https://nodra-kor.xyz"
override var name = "Nodrakorid"

override val mainPage = mainPageOf(
Expand Down
27 changes: 3 additions & 24 deletions Minioppai/src/main/kotlin/com/hexated/Minioppai.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ package com.hexated

import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.network.CloudflareKiller
import com.lagradost.cloudstream3.utils.*
import okhttp3.Interceptor
import okhttp3.Response
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import java.net.URLDecoder
Expand All @@ -17,24 +14,10 @@ class Minioppai : MainAPI() {
override var lang = "id"
override val hasDownloadSupport = true
override val hasQuickSearch = true
private val cloudflareKiller by lazy { CloudflareKiller() }
private val interceptor by lazy { CloudflareInterceptor(cloudflareKiller) }
override val supportedTypes = setOf(
TvType.NSFW,
)

class CloudflareInterceptor(private val cloudflareKiller: CloudflareKiller): Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val response = chain.proceed(request)
val doc = Jsoup.parse(response.peekBody(1024 * 1024).string())
if (doc.select("title").text() == "Just a moment...") {
return cloudflareKiller.intercept(chain)
}
return response
}
}

companion object {
fun getStatus(t: String?): ShowStatus {
return when (t) {
Expand All @@ -54,7 +37,7 @@ class Minioppai : MainAPI() {
page: Int,
request: MainPageRequest
): HomePageResponse {
val document = app.get("${request.data}/page/$page", interceptor = interceptor).document
val document = app.get("${request.data}/page/$page").document
val home = document.select("div.latest a").mapNotNull {
it.toSearchResult()
}
Expand Down Expand Up @@ -84,7 +67,6 @@ class Minioppai : MainAPI() {
return newAnimeSearchResponse(title, href, TvType.NSFW) {
this.posterUrl = posterUrl
addSub(epNum)
posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap()
}

}
Expand All @@ -97,21 +79,19 @@ class Minioppai : MainAPI() {
"action" to "ts_ac_do_search",
"ts_ac_query" to query,
), headers = mapOf("X-Requested-With" to "XMLHttpRequest"),
interceptor = interceptor
).parsedSafe<SearchResponses>()?.post?.firstOrNull()?.all?.mapNotNull { item ->
newAnimeSearchResponse(
item.postTitle ?: "",
item.postLink ?: return@mapNotNull null,
TvType.NSFW
) {
this.posterUrl = item.postImage
posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap()
}
}
}

override suspend fun load(url: String): LoadResponse? {
val document = app.get(url, interceptor = interceptor).document
val document = app.get(url).document

val title = document.selectFirst("h1.entry-title")?.text()?.trim() ?: return null
val poster = fixUrlNull(document.selectFirst("div.limage img")?.attr("src"))
Expand All @@ -137,7 +117,6 @@ class Minioppai : MainAPI() {
showStatus = status
plot = description
this.tags = tags
posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap()
}
}

Expand All @@ -147,7 +126,7 @@ class Minioppai : MainAPI() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
val document = app.get(data, interceptor = interceptor).document
val document = app.get(data).document
document.select("div.server ul.mirror li a").mapNotNull {
Jsoup.parse(base64Decode(it.attr("data-em"))).select("iframe").attr("src")
}.apmap { link ->
Expand Down
30 changes: 4 additions & 26 deletions Movierulzhd/src/main/kotlin/com/hexated/Movierulzhd.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.network.CloudflareKiller
import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.toJson
import org.jsoup.nodes.Element
Expand Down Expand Up @@ -34,16 +33,11 @@ open class Movierulzhd : MainAPI() {
"episodes" to "Episode",
)

val interceptor = CloudflareKiller()

override suspend fun getMainPage(
page: Int,
request: MainPageRequest
): HomePageResponse {
var document = app.get("$mainUrl/${request.data}/page/$page").document
if (document.select("title").text() == "Just a moment...") {
document = app.get(request.data + page, interceptor = interceptor).document
}
val document = app.get("$mainUrl/${request.data}/page/$page").document
val home =
document.select("div.items.normal article, div#archive-content article, div.items.full article").mapNotNull {
it.toSearchResult()
Expand Down Expand Up @@ -79,36 +73,26 @@ open class Movierulzhd : MainAPI() {
return newMovieSearchResponse(title, href, TvType.Movie) {
this.posterUrl = posterUrl
this.quality = quality
posterHeaders = interceptor.getCookieHeaders(mainUrl).toMap()
}

}

override suspend fun search(query: String): List<SearchResponse> {
val link = "$mainUrl/search/$query"
var document = app.get(link).document
if (document.select("title").text() == "Just a moment...") {
document = app.get(link, interceptor = interceptor).document
}

val document = app.get("$mainUrl/search/$query").document
return document.select("div.result-item").map {
val title =
it.selectFirst("div.title > a")!!.text().replace(Regex("\\(\\d{4}\\)"), "").trim()
val href = getProperLink(it.selectFirst("div.title > a")!!.attr("href"))
val posterUrl = it.selectFirst("img")!!.attr("src").toString()
newMovieSearchResponse(title, href, TvType.TvSeries) {
this.posterUrl = posterUrl
posterHeaders = interceptor.getCookieHeaders(mainUrl).toMap()
}
}
}

override suspend fun load(url: String): LoadResponse {
val request = app.get(url)
var document = request.document
if (document.select("title").text() == "Just a moment...") {
document = app.get(url, interceptor = interceptor).document
}
val document = request.document
directUrl = getBaseUrl(request.url)
val title =
document.selectFirst("div.data > h1")?.text()?.trim().toString()
Expand Down Expand Up @@ -142,7 +126,6 @@ open class Movierulzhd : MainAPI() {
val recPosterUrl = it.selectFirst("img")?.imageFromElement()
newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) {
this.posterUrl = recPosterUrl
posterHeaders = interceptor.getCookieHeaders(url).toMap()
}
}

Expand Down Expand Up @@ -187,7 +170,6 @@ open class Movierulzhd : MainAPI() {
addActors(actors)
this.recommendations = recommendations
addTrailer(trailer)
posterHeaders = interceptor.getCookieHeaders(url).toMap()
}
} else {
newMovieLoadResponse(title, url, TvType.Movie, url) {
Expand All @@ -199,7 +181,6 @@ open class Movierulzhd : MainAPI() {
addActors(actors)
this.recommendations = recommendations
addTrailer(trailer)
posterHeaders = interceptor.getCookieHeaders(url).toMap()
}
}
}
Expand Down Expand Up @@ -232,10 +213,7 @@ open class Movierulzhd : MainAPI() {
).parsed<ResponseHash>().embed_url
if (!source.contains("youtube")) loadCustomExtractor(source, "$directUrl/", subtitleCallback, callback)
} else {
var document = app.get(data).document
if (document.select("title").text() == "Just a moment...") {
document = app.get(data, interceptor = interceptor).document
}
val document = app.get(data).document

document.select("ul#playeroptionsul > li").map {
Triple(
Expand Down
Loading

0 comments on commit 7f966fa

Please sign in to comment.