Skip to content

Commit

Permalink
fix sora sources, fix #583 and more
Browse files Browse the repository at this point in the history
  • Loading branch information
olivia committed Feb 10, 2024
1 parent d17d1e8 commit 36d0a97
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 128 deletions.
2 changes: 1 addition & 1 deletion Hentaiheaven/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 3
version = 4


cloudstream {
Expand Down
2 changes: 1 addition & 1 deletion Hentaiheaven/src/main/kotlin/com/hexated/Hentaiheaven.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Hentaiheaven : MainAPI() {
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 {
return document.select("div.c-tabs-item > div.c-tabs-item__content").mapNotNull {
it.toSearchResult()
}
}
Expand Down
2 changes: 1 addition & 1 deletion OploverzProvider/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 29
version = 30


cloudstream {
Expand Down
17 changes: 4 additions & 13 deletions OploverzProvider/src/main/kotlin/com/hexated/OploverzProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.lagradost.cloudstream3.utils.*
import org.jsoup.nodes.Element

class OploverzProvider : MainAPI() {
override var mainUrl = "https://oploverz.guru"
override var mainUrl = "https://oploverz.gold"
override var name = "Oploverz"
override val hasMainPage = true
override var lang = "id"
Expand All @@ -20,7 +20,6 @@ class OploverzProvider : MainAPI() {
)

companion object {
const val acefile = "https://acefile.co"
fun getType(t: String): TvType {
return if (t.contains("OVA", true) || t.contains("Special")) TvType.OVA
else if (t.contains("Movie", true)) TvType.AnimeMovie
Expand Down Expand Up @@ -170,14 +169,14 @@ class OploverzProvider : MainAPI() {
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
).document.select("iframe").attr("src")

loadExtractor(fixedIframe(iframe), "$mainUrl/", subtitleCallback, callback)
loadExtractor(fixUrl(iframe), "$mainUrl/", subtitleCallback, callback)

}
},
{
document.select("div#download tr").map { el ->
document.select("div#download tr").apmap { el ->
el.select("a").apmap {
loadFixedExtractor(fixedIframe(it.attr("href")), el.select("strong").text(), "$mainUrl/", subtitleCallback, callback)
loadFixedExtractor(fixUrl(it.attr("href")), el.select("strong").text(), "$mainUrl/", subtitleCallback, callback)
}
}
}
Expand Down Expand Up @@ -217,12 +216,4 @@ class OploverzProvider : MainAPI() {
}
}

private fun fixedIframe(url: String): String {
val id = Regex("""(?:/f/|/file/)(\w+)""").find(url)?.groupValues?.getOrNull(1)
return when {
url.startsWith(acefile) -> "${acefile}/player/$id"
else -> fixUrl(url)
}
}

}
2 changes: 1 addition & 1 deletion Samehadaku/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 21
version = 22


cloudstream {
Expand Down
116 changes: 40 additions & 76 deletions Samehadaku/src/main/kotlin/com/hexated/Samehadaku.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,17 @@ import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.nodes.Element

class Samehadaku : MainAPI() {
override var mainUrl = "https://samehadaku.guru"
override var mainUrl = "https://samehadaku.show"
override var name = "Samehadaku"
override val hasMainPage = true
override var lang = "id"
override val hasDownloadSupport = true
override val supportedTypes = setOf(
TvType.Anime,
TvType.AnimeMovie,
TvType.OVA
TvType.Anime,
TvType.AnimeMovie,
TvType.OVA
)
companion object {
const val acefile = "https://acefile.co"

fun getType(t: String): TvType {
return if (t.contains("OVA", true) || t.contains("Special", true)) TvType.OVA
else if (t.contains("Movie", true)) TvType.AnimeMovie
Expand All @@ -39,13 +37,13 @@ class Samehadaku : MainAPI() {
}

override val mainPage = mainPageOf(
"$mainUrl/page/" to "Episode Terbaru",
"$mainUrl/" to "HomePage",
"$mainUrl/page/" to "Episode Terbaru",
"$mainUrl/" to "HomePage",
)

override suspend fun getMainPage(
page: Int,
request: MainPageRequest
page: Int,
request: MainPageRequest
): HomePageResponse {
val items = mutableListOf<HomePageList>()

Expand All @@ -62,9 +60,9 @@ class Samehadaku : MainAPI() {

if (request.name == "Episode Terbaru") {
val home = app.get(request.data + page).document.selectFirst("div.post-show")?.select("ul li")
?.mapNotNull {
it.toSearchResult()
} ?: throw ErrorLoadingException("No Media Found")
?.mapNotNull {
it.toSearchResult()
} ?: throw ErrorLoadingException("No Media Found")
items.add(HomePageList(request.name, home, true))
}

Expand All @@ -74,7 +72,7 @@ class Samehadaku : MainAPI() {

private fun Element.toSearchResult(): AnimeSearchResponse? {
val title = this.selectFirst("div.title, h2.entry-title a, div.lftinfo h2")?.text()?.trim()
?: return null
?: return null
val href = fixUrlNull(this.selectFirst("a")?.attr("href") ?: return null)
val posterUrl = fixUrlNull(this.select("img").attr("src"))
val epNum = this.selectFirst("div.dtla author")?.text()?.toIntOrNull()
Expand Down Expand Up @@ -107,19 +105,19 @@ class Samehadaku : MainAPI() {
Regex("\\d,\\s(\\d*)").find(it)?.groupValues?.getOrNull(1)?.toIntOrNull()
}
val status = getStatus(
document.selectFirst("div.spe > span:contains(Status)")?.ownText() ?: return null
document.selectFirst("div.spe > span:contains(Status)")?.ownText() ?: return null
)
val type =
getType(document.selectFirst("div.spe > span:contains(Type)")?.ownText()?.trim()?.lowercase()
?: "tv")
getType(document.selectFirst("div.spe > span:contains(Type)")?.ownText()?.trim()?.lowercase()
?: "tv")
val rating = document.selectFirst("span.ratingValue")?.text()?.trim()?.toRatingInt()
val description = document.select("div.desc p").text().trim()
val trailer = document.selectFirst("div.trailer-anime iframe")?.attr("src")

val episodes = document.select("div.lstepsiode.listeps ul li").mapNotNull {
val header = it.selectFirst("span.lchx > a") ?: return@mapNotNull null
val episode = Regex("Episode\\s?(\\d+)").find(header.text())?.groupValues?.getOrNull(1)
?.toIntOrNull()
?.toIntOrNull()
val link = fixUrl(header.attr("href"))
Episode(link, episode = episode)
}.reversed()
Expand Down Expand Up @@ -149,68 +147,42 @@ class Samehadaku : MainAPI() {
}

override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {

val document = app.get(data).document

argamap(
{
document.select("div#server ul li div").apmap {
val dataPost = it.attr("data-post")
val dataNume = it.attr("data-nume")
val dataType = it.attr("data-type")

val iframe = app.post(
url = "$mainUrl/wp-admin/admin-ajax.php",
data = mapOf(
"action" to "player_ajax",
"post" to dataPost,
"nume" to dataNume,
"type" to dataType
),
referer = data,
headers = mapOf("X-Requested-With" to "XMLHttpRequest"),
).document.select("iframe").attr("src")

loadFixedExtractor(fixedIframe(iframe), it.text(), "$mainUrl/", subtitleCallback, callback)

}
},
{
document.select("div#downloadb li").map { el ->
el.select("a").apmap {
loadFixedExtractor(fixedIframe(it.attr("href")), el.select("strong").text(), "$mainUrl/", subtitleCallback, callback)
}
}
}
)
document.select("div#downloadb li").map { el ->
el.select("a").apmap {
loadFixedExtractor(fixUrl(it.attr("href")), el.select("strong").text(), "$mainUrl/", subtitleCallback, callback)
}
}

return true
}

private suspend fun loadFixedExtractor(
url: String,
name: String,
referer: String? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
url: String,
name: String,
referer: String? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
loadExtractor(url, referer, subtitleCallback) { link ->
callback.invoke(
ExtractorLink(
link.name,
link.name,
link.url,
link.referer,
name.fixQuality(),
link.type,
link.headers,
link.extractorData
)
ExtractorLink(
link.name,
link.name,
link.url,
link.referer,
name.fixQuality(),
link.type,
link.headers,
link.extractorData
)
)
}
}
Expand All @@ -224,14 +196,6 @@ class Samehadaku : MainAPI() {
}
}

private fun fixedIframe(url: String): String {
val id = Regex("""(?:/f/|/file/)(\w+)""").find(url)?.groupValues?.getOrNull(1)
return when {
url.startsWith(acefile) -> "${acefile}/player/$id"
else -> fixUrl(url)
}
}

private fun String.removeBloat(): String {
return this.replace(Regex("(Nonton)|(Anime)|(Subtitle\\sIndonesia)"), "").trim()
}
Expand Down
2 changes: 1 addition & 1 deletion SoraStream/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 = 222
version = 223

android {
defaultConfig {
Expand Down
Loading

0 comments on commit 36d0a97

Please sign in to comment.