mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
added new providers
This commit is contained in:
parent
4f77c2e7d4
commit
c7a1c77389
17 changed files with 802 additions and 11 deletions
25
Hentaiheaven/build.gradle.kts
Normal file
25
Hentaiheaven/build.gradle.kts
Normal file
|
@ -0,0 +1,25 @@
|
|||
// use an integer for version numbers
|
||||
version = 1
|
||||
|
||||
|
||||
cloudstream {
|
||||
language = "en"
|
||||
// All of these properties are optional, you can safely remove them
|
||||
|
||||
// description = "Lorem Ipsum"
|
||||
authors = listOf("Hexated")
|
||||
|
||||
/**
|
||||
* Status int as the following:
|
||||
* 0: Down
|
||||
* 1: Ok
|
||||
* 2: Slow
|
||||
* 3: Beta only
|
||||
* */
|
||||
status = 1 // will be 3 if unspecified
|
||||
tvTypes = listOf(
|
||||
"NSFW",
|
||||
)
|
||||
|
||||
iconUrl = "https://www.google.com/s2/favicons?domain=hentaihaven.xxx&sz=%size%"
|
||||
}
|
2
Hentaiheaven/src/main/AndroidManifest.xml
Normal file
2
Hentaiheaven/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="com.hexated"/>
|
156
Hentaiheaven/src/main/kotlin/com/hexated/Hentaiheaven.kt
Normal file
156
Hentaiheaven/src/main/kotlin/com/hexated/Hentaiheaven.kt
Normal file
|
@ -0,0 +1,156 @@
|
|||
package com.hexated
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||
import com.lagradost.cloudstream3.utils.*
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class Hentaiheaven : MainAPI() {
|
||||
override var mainUrl = "https://hentaihaven.xxx"
|
||||
override var name = "Hentaiheaven"
|
||||
override val hasMainPage = true
|
||||
override var lang = "en"
|
||||
override val hasDownloadSupport = true
|
||||
|
||||
override val supportedTypes = setOf(
|
||||
TvType.NSFW)
|
||||
|
||||
override val mainPage = mainPageOf(
|
||||
"?m_orderby=new-manga" to "New",
|
||||
"?m_orderby=views" to "Most Views",
|
||||
"?m_orderby=rating" to "Rating",
|
||||
"?m_orderby=alphabet" to "A-Z",
|
||||
)
|
||||
|
||||
override suspend fun getMainPage(
|
||||
page: Int,
|
||||
request: MainPageRequest
|
||||
): HomePageResponse {
|
||||
val document = app.get("$mainUrl/page/$page/${request.data}").document
|
||||
val home =
|
||||
document.select("div.page-listing-item div.col-6.col-md-zarat.badge-pos-1").mapNotNull {
|
||||
it.toSearchResult()
|
||||
}
|
||||
return newHomePageResponse(request.name, home)
|
||||
}
|
||||
|
||||
private fun Element.toSearchResult(): AnimeSearchResponse? {
|
||||
val href = fixUrl(this.selectFirst("a")!!.attr("href"))
|
||||
val title =
|
||||
this.selectFirst("h3 a, h5 a")?.text()?.trim() ?: this.selectFirst("a")?.attr("title")
|
||||
?: return null
|
||||
val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("src"))
|
||||
val episode = this.selectFirst("span.chapter.font-meta a")?.text()?.filter { it.isDigit() }
|
||||
?.toIntOrNull()
|
||||
|
||||
return newAnimeSearchResponse(title, href, TvType.Anime) {
|
||||
this.posterUrl = posterUrl
|
||||
addSub(episode)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val link = "$mainUrl/?s=$query&post_type=wp-manga"
|
||||
val document = app.get(link).document
|
||||
|
||||
return document.select("div.c-tabs-item div.row.c-tabs-item__content").mapNotNull {
|
||||
it.toSearchResult()
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun load(url: String): LoadResponse? {
|
||||
val document = app.get(url).document
|
||||
|
||||
val title = document.selectFirst("div.post-title h1")?.text()?.trim() ?: return null
|
||||
val poster = document.select("div.summary_image img").attr("src")
|
||||
val tags = document.select("div.genres-content > a").map { it.text() }
|
||||
|
||||
val description = document.select("div.description-summary p").text().trim()
|
||||
val trailer = document.selectFirst("a.trailerbutton")?.attr("href")
|
||||
|
||||
val episodes = document.select("div.listing-chapters_wrap ul li").mapNotNull {
|
||||
val name = it.selectFirst("a")?.text() ?: return@mapNotNull null
|
||||
val image = fixUrlNull(it.selectFirst("a img")?.attr("src"))
|
||||
val link = fixUrlNull(it.selectFirst("a")?.attr("href")) ?: return@mapNotNull null
|
||||
Episode(link, name, posterUrl = image)
|
||||
}.reversed()
|
||||
|
||||
val recommendations =
|
||||
document.select("div.row div.col-6.col-md-zarat").mapNotNull {
|
||||
it.toSearchResult()
|
||||
}
|
||||
|
||||
return newAnimeLoadResponse(title, url, TvType.Anime) {
|
||||
engName = title
|
||||
posterUrl = poster
|
||||
addEpisodes(DubStatus.Subbed, episodes)
|
||||
plot = description
|
||||
this.tags = tags
|
||||
this.recommendations = recommendations
|
||||
addTrailer(trailer)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override suspend fun loadLinks(
|
||||
data: String,
|
||||
isCasting: Boolean,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
|
||||
app.get(data).document.select("div.player_logic_item iframe").attr("src").let { iframe ->
|
||||
val document = app.get(iframe, referer = data).text
|
||||
val en = Regex("var\\sen\\s=\\s'(\\S+)';").find(document)?.groupValues?.getOrNull(1)
|
||||
val iv = Regex("var\\siv\\s=\\s'(\\S+)';").find(document)?.groupValues?.getOrNull(1)
|
||||
|
||||
app.post(
|
||||
"$mainUrl/wp-content/plugins/player-logic/api.php",
|
||||
data = mapOf(
|
||||
"action" to "zarat_get_data_player_ajax",
|
||||
"a" to "$en",
|
||||
"b" to "$iv"
|
||||
),
|
||||
headers = mapOf("Sec-Fetch-Mode" to "cors")
|
||||
).parsedSafe<Response>()?.data?.sources?.map { res ->
|
||||
// M3u8Helper.generateM3u8(
|
||||
// this.name,
|
||||
// res.src ?: return@map null,
|
||||
// referer = "$mainUrl/",
|
||||
// headers = mapOf(
|
||||
// "Origin" to mainUrl,
|
||||
// )
|
||||
// ).forEach(callback)
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
this.name,
|
||||
this.name,
|
||||
res.src ?: return@map null,
|
||||
referer = "$mainUrl/",
|
||||
quality = Qualities.Unknown.value,
|
||||
isM3u8 = true
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
data class Response(
|
||||
@JsonProperty("data") val data: Data? = null,
|
||||
)
|
||||
|
||||
data class Data(
|
||||
@JsonProperty("sources") val sources: ArrayList<Sources>? = arrayListOf(),
|
||||
)
|
||||
|
||||
data class Sources(
|
||||
@JsonProperty("src") val src: String? = null,
|
||||
@JsonProperty("type") val type: String? = null,
|
||||
@JsonProperty("label") val label: String? = null,
|
||||
)
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.hexated
|
||||
|
||||
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
|
||||
import com.lagradost.cloudstream3.plugins.Plugin
|
||||
import android.content.Context
|
||||
|
||||
@CloudstreamPlugin
|
||||
class HentaiheavenPlugin: Plugin() {
|
||||
override fun load(context: Context) {
|
||||
// All providers should be added in this manner. Please don't edit the providers list directly.
|
||||
registerMainAPI(Hentaiheaven())
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue