mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fix Samehadaku
This commit is contained in:
parent
0740da3b1a
commit
fd5d4afc22
2 changed files with 67 additions and 63 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 19
|
version = 20
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||||
|
import com.lagradost.cloudstream3.network.CloudflareKiller
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.Qualities
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
|
@ -20,7 +21,7 @@ class Samehadaku : MainAPI() {
|
||||||
TvType.AnimeMovie,
|
TvType.AnimeMovie,
|
||||||
TvType.OVA
|
TvType.OVA
|
||||||
)
|
)
|
||||||
|
private val interceptor = CloudflareKiller()
|
||||||
companion object {
|
companion object {
|
||||||
const val acefile = "https://acefile.co"
|
const val acefile = "https://acefile.co"
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ class Samehadaku : MainAPI() {
|
||||||
val items = mutableListOf<HomePageList>()
|
val items = mutableListOf<HomePageList>()
|
||||||
|
|
||||||
if (request.name != "Episode Terbaru" && page <= 1) {
|
if (request.name != "Episode Terbaru" && page <= 1) {
|
||||||
val doc = app.get(request.data).document
|
val doc = app.get(request.data, interceptor = interceptor).document
|
||||||
doc.select("div.widget_senction:not(:contains(Baca Komik))").forEach { block ->
|
doc.select("div.widget_senction:not(:contains(Baca Komik))").forEach { block ->
|
||||||
val header = block.selectFirst("div.widget-title h3")?.ownText() ?: return@forEach
|
val header = block.selectFirst("div.widget-title h3")?.ownText() ?: return@forEach
|
||||||
val home = block.select("div.animepost").mapNotNull {
|
val home = block.select("div.animepost").mapNotNull {
|
||||||
|
@ -62,7 +63,7 @@ class Samehadaku : MainAPI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.name == "Episode Terbaru") {
|
if (request.name == "Episode Terbaru") {
|
||||||
val home = app.get(request.data + page).document.selectFirst("div.post-show")?.select("ul li")
|
val home = app.get(request.data + page, interceptor = interceptor).document.selectFirst("div.post-show")?.select("ul li")
|
||||||
?.mapNotNull {
|
?.mapNotNull {
|
||||||
it.toSearchResult()
|
it.toSearchResult()
|
||||||
} ?: throw ErrorLoadingException("No Media Found")
|
} ?: throw ErrorLoadingException("No Media Found")
|
||||||
|
@ -82,12 +83,13 @@ class Samehadaku : MainAPI() {
|
||||||
return newAnimeSearchResponse(title, href ?: return null, TvType.Anime) {
|
return newAnimeSearchResponse(title, href ?: return null, TvType.Anime) {
|
||||||
this.posterUrl = posterUrl
|
this.posterUrl = posterUrl
|
||||||
addSub(epNum)
|
addSub(epNum)
|
||||||
|
posterHeaders = interceptor.getCookieHeaders(mainUrl).toMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun search(query: String): List<SearchResponse> {
|
override suspend fun search(query: String): List<SearchResponse> {
|
||||||
val document = app.get("$mainUrl/?s=$query").document
|
val document = app.get("$mainUrl/?s=$query", interceptor = interceptor).document
|
||||||
return document.select("main#main div.animepost").mapNotNull {
|
return document.select("main#main div.animepost").mapNotNull {
|
||||||
it.toSearchResult()
|
it.toSearchResult()
|
||||||
}
|
}
|
||||||
|
@ -97,10 +99,10 @@ class Samehadaku : MainAPI() {
|
||||||
val fixUrl = if (url.contains("/anime/")) {
|
val fixUrl = if (url.contains("/anime/")) {
|
||||||
url
|
url
|
||||||
} else {
|
} else {
|
||||||
app.get(url).document.selectFirst("div.nvs.nvsc a")?.attr("href")
|
app.get(url, interceptor = interceptor).document.selectFirst("div.nvs.nvsc a")?.attr("href")
|
||||||
}
|
}
|
||||||
|
|
||||||
val document = app.get(fixUrl ?: return null).document
|
val document = app.get(fixUrl ?: return null, interceptor = interceptor).document
|
||||||
val title = document.selectFirst("h1.entry-title")?.text()?.removeBloat() ?: return null
|
val title = document.selectFirst("h1.entry-title")?.text()?.removeBloat() ?: return null
|
||||||
val poster = document.selectFirst("div.thumb > img")?.attr("src")
|
val poster = document.selectFirst("div.thumb > img")?.attr("src")
|
||||||
val tags = document.select("div.genre-info > a").map { it.text() }
|
val tags = document.select("div.genre-info > a").map { it.text() }
|
||||||
|
@ -145,6 +147,7 @@ class Samehadaku : MainAPI() {
|
||||||
this.recommendations = recommendations
|
this.recommendations = recommendations
|
||||||
addMalId(tracker?.malId)
|
addMalId(tracker?.malId)
|
||||||
addAniListId(tracker?.aniId?.toIntOrNull())
|
addAniListId(tracker?.aniId?.toIntOrNull())
|
||||||
|
posterHeaders = interceptor.getCookieHeaders(mainUrl).toMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -156,7 +159,7 @@ class Samehadaku : MainAPI() {
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
): Boolean {
|
): Boolean {
|
||||||
|
|
||||||
val document = app.get(data).document
|
val document = app.get(data, interceptor = interceptor).document
|
||||||
|
|
||||||
argamap(
|
argamap(
|
||||||
{
|
{
|
||||||
|
@ -175,6 +178,7 @@ class Samehadaku : MainAPI() {
|
||||||
),
|
),
|
||||||
referer = data,
|
referer = data,
|
||||||
headers = mapOf("X-Requested-With" to "XMLHttpRequest"),
|
headers = mapOf("X-Requested-With" to "XMLHttpRequest"),
|
||||||
|
interceptor = interceptor
|
||||||
).document.select("iframe").attr("src")
|
).document.select("iframe").attr("src")
|
||||||
|
|
||||||
loadFixedExtractor(fixedIframe(iframe), it.text(), "$mainUrl/", subtitleCallback, callback)
|
loadFixedExtractor(fixedIframe(iframe), it.text(), "$mainUrl/", subtitleCallback, callback)
|
||||||
|
|
Loading…
Reference in a new issue