Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Dark25 committed Dec 10, 2024
1 parent ac7692d commit 62183fd
Show file tree
Hide file tree
Showing 15 changed files with 315 additions and 364 deletions.
4 changes: 2 additions & 2 deletions src/en/donghuastream/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ext {
extName = 'DonghuaStream'
extClass = '.DonghuaStream'
themePkg = 'animestream'
baseUrl = 'https://donghuastream.co.in'
overrideVersionCode = 8
baseUrl = 'https://donghuastream.org'
overrideVersionCode = 9
}

apply from: "$rootDir/common.gradle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.multisrc.animestream.AnimeStream
class DonghuaStream : AnimeStream(
"en",
"DonghuaStream",
"https://donghuastream.co.in",
"https://donghuastream.org",
) {
override val fetchFilters: Boolean
get() = false
Expand Down
9 changes: 8 additions & 1 deletion src/es/homecine/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
ext {
extName = 'HomeCine'
extClass = '.HomeCine'
extVersionCode = 2
extVersionCode = 3
}

apply from: "$rootDir/common.gradle"

dependencies {
implementation(project(':lib:burstcloud-extractor'))
implementation(project(':lib:mp4upload-extractor'))
implementation(project(':lib:streamwish-extractor'))
implementation(project(':lib:voe-extractor'))
implementation(project(':lib:yourupload-extractor'))
implementation(project(':lib:fastream-extractor'))
implementation(project(':lib:upstream-extractor'))
implementation(project(':lib:filemoon-extractor'))
}

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/es/metroseries/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
extName = 'MetroSeries'
extClass = '.MetroSeries'
extVersionCode = 14
extVersionCode = 15
}

apply from: "$rootDir/common.gradle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,24 @@ import eu.kanade.tachiyomi.lib.fastreamextractor.FastreamExtractor
import eu.kanade.tachiyomi.lib.filemoonextractor.FilemoonExtractor
import eu.kanade.tachiyomi.lib.mp4uploadextractor.Mp4uploadExtractor
import eu.kanade.tachiyomi.lib.streamwishextractor.StreamWishExtractor
import eu.kanade.tachiyomi.lib.universalextractor.UniversalExtractor
import eu.kanade.tachiyomi.lib.upstreamextractor.UpstreamExtractor
import eu.kanade.tachiyomi.lib.voeextractor.VoeExtractor
import eu.kanade.tachiyomi.lib.youruploadextractor.YourUploadExtractor
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.await
import eu.kanade.tachiyomi.util.asJsoup
import eu.kanade.tachiyomi.util.parallelCatchingFlatMapBlocking
import eu.kanade.tachiyomi.util.parallelMapBlocking
import okhttp3.FormBody
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Element
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.text.SimpleDateFormat
import java.util.Locale

class MetroSeries : ConfigurableAnimeSource, AnimeHttpSource() {

override val name = "MetroSeries"

override val baseUrl = "https://metroseries.net"
override val baseUrl = "https://www3.seriesmetro.net"

override val lang = "es"

Expand Down Expand Up @@ -72,11 +66,11 @@ class MetroSeries : ConfigurableAnimeSource, AnimeHttpSource() {
)
}

override fun popularAnimeRequest(page: Int) = GET("$baseUrl/series/page/$page", headers)
override fun popularAnimeRequest(page: Int) = GET("$baseUrl/cartelera-series/page/$page", headers)

override fun popularAnimeParse(response: Response): AnimesPage {
val document = response.asJsoup()
val elements = document.select(".post-list, .results-post > .post")
val elements = document.select(".post")
val nextPage = document.select(".nav-links .current ~ a").any()
val animeList = elements.map { element ->
SAnime.create().apply {
Expand All @@ -100,11 +94,11 @@ class MetroSeries : ConfigurableAnimeSource, AnimeHttpSource() {
override fun animeDetailsParse(response: Response): SAnime {
val document = response.asJsoup()
return SAnime.create().apply {
title = document.selectFirst("main .entry-header .entry-title")?.text() ?: ""
description = document.select("main .entry-content p").joinToString { it.text() }
thumbnail_url = document.selectFirst("main .post-thumbnail img")?.let { getImageUrl(it) }
genre = document.select("main .entry-content .tagcloud a").joinToString { it.text() }
status = SAnime.UNKNOWN
title = document.selectFirst("aside .entry-header .entry-title")?.text() ?: ""
description = document.select("aside .description p:not([class])").joinToString { it.text() }
thumbnail_url = document.selectFirst(".post-thumbnail img")?.let { getImageUrl(it)?.replace("/w185/", "/w500/") }
genre = document.select(".genres a").joinToString { it.text() }
status = if (document.location().contains("pelicula")) SAnime.COMPLETED else SAnime.UNKNOWN
}
}

Expand All @@ -119,149 +113,113 @@ class MetroSeries : ConfigurableAnimeSource, AnimeHttpSource() {
override fun episodeListParse(response: Response): List<SEpisode> {
val document = response.asJsoup()
val referer = response.request.url.toString()
val chunkSize = Runtime.getRuntime().availableProcessors()
val objectNumber = document.select("#aa-season").attr("data-object")
val episodes = document.select(".season-list li a")
.sortedByDescending { it.attr("data-season") }
.chunked(chunkSize).flatMap { chunk ->
chunk.parallelCatchingFlatMapBlocking { season ->
val pages = getDetailSeason(season, objectNumber, referer)
getPageEpisodeList(pages, referer, objectNumber, season.attr("data-season"))
return if (referer.contains("pelicula")) {
listOf(
SEpisode.create().apply {
episode_number = 1f
name = "Película"
setUrlWithoutDomain(referer)
},
)
} else {
val chunkSize = Runtime.getRuntime().availableProcessors()
document.select(".sel-temp a")
.sortedByDescending { it.attr("data-season") }
.chunked(chunkSize).flatMap { chunk ->
chunk.parallelCatchingFlatMapBlocking { season ->
getDetailSeason(season, referer)
}
}.sortedByDescending {
it.name.substringBeforeLast("-")
}
}.sortedByDescending {
it.name.substringBeforeLast("-")
}
return episodes
}
}

private fun getDetailSeason(element: Element, objectNumber: String, referer: String): IntRange {
try {
private fun getDetailSeason(element: Element, referer: String): List<SEpisode> {
return try {
val post = element.attr("data-post")
val season = element.attr("data-season")
val formBody = FormBody.Builder()
.add("action", "action_select_season")
.add("season", season)
.add("post", post)
.add("object", objectNumber)
.build()

val request = Request.Builder()
.url("https://metroseries.net/wp-admin/admin-ajax.php")
.url("$baseUrl/wp-admin/admin-ajax.php")
.post(formBody)
.header("Origin", baseUrl)
.header("Referer", referer)
.header("Content-Type", "application/x-www-form-urlencoded")
.build()
val detail = client.newCall(request).execute().asJsoup()

val firstPage = try { detail.selectFirst("#aa-season > nav > span.page-numbers")?.text()?.toInt() ?: 1 } catch (_: Exception) { 1 }
val lastPage = try { detail.select(".pagination a.page-numbers:not(.next)").last()?.text()?.toInt() ?: firstPage } catch (_: Exception) { firstPage }
detail.select(".post").reversed().mapIndexed { idx, it ->
val epNumber = try {
it.select(".entry-header .num-epi").text().substringAfter("x").substringBefore("").trim()
} catch (_: Exception) { "${idx + 1}" }

return firstPage.rangeTo(lastPage)
SEpisode.create().apply {
setUrlWithoutDomain(it.select("a").attr("abs:href"))
name = "T$season - Episodio $epNumber"
episode_number = epNumber.toFloat()
}
}
} catch (_: Exception) {
return 1..1
emptyList()
}
}

private fun getPageEpisodeList(pages: IntRange, referer: String, objectNumber: String, season: String): List<SEpisode> {
val episodes = mutableListOf<SEpisode>()
try {
pages.parallelMapBlocking {
val formBody = FormBody.Builder()
.add("action", "action_pagination_ep")
.add("page", "$it")
.add("object", objectNumber)
.add("season", season)
.build()

val requestPage = Request.Builder()
.url("https://metroseries.net/wp-admin/admin-ajax.php")
.post(formBody)
.header("authority", baseUrl.toHttpUrl().host)
.header("Origin", "https://${baseUrl.toHttpUrl().host}")
.header("Referer", referer)
.header("Content-Type", "application/x-www-form-urlencoded")
.build()

client.newCall(requestPage).await().parseAsEpisodeList().also(episodes::addAll)
}
} catch (_: Exception) { }
return episodes
}

override fun videoListParse(response: Response): List<Video> {
val document = response.asJsoup()
val videoList = mutableListOf<Video>()
val termId = document.select("#option-players").attr("data-term")
document.select(".player-options-list li a").forEach {
document.select(".aa-tbs-video a").forEach {
val prefix = runCatching {
val lang = it.select(".option").text().lowercase()
val lang = it.select(".server").text().lowercase()
when {
lang.contains("latino") -> "[LAT]"
lang.contains("castellano") -> "[CAST]"
lang.contains("sub") -> "[SUB]"
lang.contains("sub") || lang.contains("vose") -> "[SUB]"
else -> ""
}
}.getOrDefault("")

val ide = it.attr("data-opt")
val formBody = FormBody.Builder()
.add("action", "action_player_series")
.add("ide", ide)
.add("term_id", termId)
.build()

val postRequest = Request.Builder()
.url("https://metroseries.net/wp-admin/admin-ajax.php")
.post(formBody)
.header("Origin", baseUrl)
.header("Referer", response.request.url.toString())
.header("Content-Type", "application/x-www-form-urlencoded")
.build()

val playerDocument = client.newCall(postRequest).execute().asJsoup()
playerDocument.select("iframe").forEach {
var src = it.attr("src").replace("#038;", "&").replace("&amp;", "")
try {
if (src.contains("metroseries")) {
src = client.newCall(GET(src)).execute().asJsoup().selectFirst("iframe")?.attr("src") ?: ""
}

if (src.contains("fastream")) {
if (src.contains("emb.html")) {
val key = src.split("/").last()
src = "https://fastream.to/embed-$key.html"
}
FastreamExtractor(client, headers).videosFromUrl(src, needsSleep = false, prefix = "$prefix Fastream:").also(videoList::addAll)
}
val ide = it.attr("href")
var src = document.select("$ide iframe").attr("data-src").replace("#038;", "&").replace("&amp;", "")
try {
if (src.contains("metro")) {
src = client.newCall(GET(src)).execute().asJsoup().selectFirst("iframe")?.attr("src") ?: ""
}

if (src.contains("upstream")) {
UpstreamExtractor(client).videosFromUrl(src, prefix = "$prefix ").let { videoList.addAll(it) }
}
if (src.contains("yourupload")) {
YourUploadExtractor(client).videoFromUrl(src, headers, prefix = "$prefix ").let { videoList.addAll(it) }
if (src.contains("fastream")) {
if (src.contains("emb.html")) {
val key = src.split("/").last()
src = "https://fastream.to/embed-$key.html"
}
if (src.contains("voe")) {
VoeExtractor(client).videosFromUrl(src, prefix = "$prefix ").also(videoList::addAll)
}
if (src.contains("wishembed") || src.contains("streamwish") || src.contains("wish")) {
StreamWishExtractor(client, headers).videosFromUrl(src) { "$prefix StreamWish:$it" }.also(videoList::addAll)
}
if (src.contains("mp4upload")) {
Mp4uploadExtractor(client).videosFromUrl(src, headers, prefix = "$prefix ").let { videoList.addAll(it) }
}
if (src.contains("burst")) {
BurstCloudExtractor(client).videoFromUrl(src, headers = headers, prefix = "$prefix ").let { videoList.addAll(it) }
}
if (src.contains("filemoon") || src.contains("moonplayer")) {
FilemoonExtractor(client).videosFromUrl(src, headers = headers, prefix = "$prefix Filemoon:").let { videoList.addAll(it) }
}
// si los demas fallan intenta con universal
if (videoList.isEmpty()) {
UniversalExtractor(client).videosFromUrl(src, headers, prefix = prefix).let { videoList.addAll(it) }
}
} catch (_: Exception) {}
}
FastreamExtractor(client, headers).videosFromUrl(src, needsSleep = false, prefix = "$prefix Fastream:").also(videoList::addAll)
}
if (src.contains("upstream")) {
UpstreamExtractor(client).videosFromUrl(src, prefix = "$prefix ").let { videoList.addAll(it) }
}
if (src.contains("yourupload")) {
YourUploadExtractor(client).videoFromUrl(src, headers, prefix = "$prefix ").let { videoList.addAll(it) }
}
if (src.contains("voe")) {
VoeExtractor(client).videosFromUrl(src, prefix = "$prefix ").also(videoList::addAll)
}
if (src.contains("wishembed") || src.contains("streamwish") || src.contains("wish")) {
StreamWishExtractor(client, headers).videosFromUrl(src) { "$prefix StreamWish:$it" }.also(videoList::addAll)
}
if (src.contains("mp4upload")) {
Mp4uploadExtractor(client).videosFromUrl(src, headers, prefix = "$prefix ").let { videoList.addAll(it) }
}
if (src.contains("burst")) {
BurstCloudExtractor(client).videoFromUrl(src, headers = headers, prefix = "$prefix ").let { videoList.addAll(it) }
}
if (src.contains("filemoon") || src.contains("moonplayer")) {
FilemoonExtractor(client).videosFromUrl(src, headers = headers, prefix = "$prefix Filemoon:").let { videoList.addAll(it) }
}
} catch (_: Exception) {}
}
return videoList
}
Expand Down Expand Up @@ -329,21 +287,4 @@ class MetroSeries : ConfigurableAnimeSource, AnimeHttpSource() {
}
}.also(screen::addPreference)
}

private fun Response.parseAsEpisodeList(): List<SEpisode> {
return asJsoup().select(".episodes-list li a").reversed().mapIndexed { idx, it ->
val epNumber = try { it.ownText().substringAfter("x").substringBefore("").trim() } catch (_: Exception) { "${idx + 1}" }
val season = it.ownText().substringBefore("x").trim()
SEpisode.create().apply {
setUrlWithoutDomain(it.attr("abs:href"))
name = "T$season - E$epNumber - ${it.ownText().substringAfter("").trim()}"
episode_number = epNumber.toFloat()
date_upload = try {
SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH).parse(it.select("span").text()).time
} catch (_: Exception) {
System.currentTimeMillis()
}
}
}
}
}
3 changes: 2 additions & 1 deletion src/es/pelisforte/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
extName = 'PelisForte'
extClass = '.PelisForte'
extVersionCode = 25
extVersionCode = 26
}

apply from: "$rootDir/common.gradle"
Expand All @@ -21,4 +21,5 @@ dependencies {
implementation(project(':lib:playlist-utils'))
implementation(project(':lib:streamlare-extractor'))
implementation(project(':lib:okru-extractor'))
implementation(project(':lib:vidguard-extractor'))
}
Loading

0 comments on commit 62183fd

Please sign in to comment.