Skip to content

Commit

Permalink
Mass update: fix 5
Browse files Browse the repository at this point in the history
  • Loading branch information
adly98 committed Sep 10, 2024
1 parent 2007905 commit 27ee759
Show file tree
Hide file tree
Showing 18 changed files with 327 additions and 101 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.lib.universalextractor
package eu.kanade.tachiyomi.lib.urlresolver

import android.annotation.SuppressLint
import android.app.Application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ class Akwam : ConfigurableAnimeSource, ParsedAnimeHttpSource() {

override fun videoListParse(response: Response): List<Video> {
val document = response.asJsoup()
val iframe = "https://akw-cdn1.link/watch" + document.select("a.link-show").attr("href").substringAfter("watch") + "/" + document.ownerDocument()!!.select("input#page_id").attr("value")
val iframe = "https://akw-cdn1.link/watch" + document.select("a.link-show").attr("href")
.substringAfter("watch") + "/" + document.ownerDocument()!!.select("input#page_id")
.attr("value")
val referer = response.request.url.toString()
val refererHeaders = Headers.headersOf("referer", referer)
val iframeResponse = client.newCall(GET(iframe, refererHeaders))
Expand All @@ -108,7 +110,11 @@ class Akwam : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
override fun videoListSelector() = "source"

override fun videoFromElement(element: Element): Video {
return Video(element.attr("src").replace("https", "http"), element.attr("size") + "p", element.attr("src").replace("https", "http"))
return Video(
element.attr("src").replace("https", "http"),
element.attr("size") + "p",
element.attr("src").replace("https", "http"),
)
}

override fun List<Video>.sort(): List<Video> {
Expand Down Expand Up @@ -143,7 +149,8 @@ class Akwam : ConfigurableAnimeSource, ParsedAnimeHttpSource() {

override fun searchAnimeNextPageSelector(): String = "ul.pagination li.page-item a[rel=next]"

override fun searchAnimeSelector(): String = "div.widget div.widget-body div.col-lg-auto div.entry-box div.entry-image a.box"
override fun searchAnimeSelector(): String =
"div.widget div.widget-body div.col-lg-auto div.entry-box div.entry-image a.box"

override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request {
val url = if (query.isNotBlank()) {
Expand Down Expand Up @@ -182,7 +189,9 @@ class Akwam : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val anime = SAnime.create()
// anime.thumbnail_url = document.select("div.container div div a picture > img.img-fluid").attr("data-src")
anime.title = document.select("picture > img.img-fluid").attr("alt")
anime.genre = document.select("div.font-size-16.d-flex.align-items-center.mt-3 a.badge, span.badge-info, span:contains(جودة الفيلم), span:contains(انتاج)").joinToString(", ") { it.text().replace("جودة الفيلم : ", "") }
anime.genre =
document.select("div.font-size-16.d-flex.align-items-center.mt-3 a.badge, span.badge-info, span:contains(جودة الفيلم), span:contains(انتاج)")
.joinToString(", ") { it.text().replace("جودة الفيلم : ", "") }
anime.author = document.select("span:contains(انتاج)").text().replace("انتاج : ", "")
anime.description = document.select("div.widget:contains(قصة )").text()
anime.status = SAnime.COMPLETED
Expand All @@ -193,7 +202,8 @@ class Akwam : ConfigurableAnimeSource, ParsedAnimeHttpSource() {

override fun latestUpdatesNextPageSelector(): String = throw UnsupportedOperationException()

override fun latestUpdatesFromElement(element: Element): SAnime = throw UnsupportedOperationException()
override fun latestUpdatesFromElement(element: Element): SAnime =
throw UnsupportedOperationException()

override fun latestUpdatesRequest(page: Int): Request = throw UnsupportedOperationException()

Expand Down Expand Up @@ -222,12 +232,16 @@ class Akwam : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
private class QualityFilter(vals: Array<Pair<String?, String>>) : UriPartFilter("الدقة", vals)
private class TypeFilter(vals: Array<Pair<String?, String>>) : UriPartFilter("النوع", vals)
private class SectionSFilter(vals: Array<Pair<String?, String>>) : UriPartFilter("القسم", vals)
private class CategorySFilter(vals: Array<Pair<String?, String>>) : UriPartFilter("التصنيف", vals)
private class CategorySFilter(vals: Array<Pair<String?, String>>) :
UriPartFilter("التصنيف", vals)

private class RatingSFilter(vals: Array<Pair<String?, String>>) : UriPartFilter("التقييم", vals)

private fun getTypeFilter(): Array<Pair<String?, String>> = arrayOf(
Pair("movies", "افلام"),
Pair("series", "مسلسلات"),
)

private fun getSectionFilter(): Array<Pair<String?, String>> = arrayOf(
Pair("0", "الكل"),
Pair("movie", "افلام"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class AnimeBlkom : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
}

// ============================== Popular ===============================
override fun popularAnimeRequest(page: Int) = GET("$baseUrl/animes-list/?sort_by=rate&page=$page", headers)
override fun popularAnimeRequest(page: Int) =
GET("$baseUrl/animes-list/?sort_by=rate&page=$page", headers)

override fun popularAnimeSelector() = "div.contents div.poster > a"

Expand All @@ -57,9 +58,11 @@ class AnimeBlkom : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val newH = headers.newBuilder().add("x-requested-with", "XMLHttpRequest").build()
return GET("$baseUrl/?page=$page", newH)
}

override fun latestUpdatesSelector(): String = "div.recent-episode > a"

override fun latestUpdatesFromElement(element: Element): SAnime = popularAnimeFromElement(element)
override fun latestUpdatesFromElement(element: Element): SAnime =
popularAnimeFromElement(element)

override fun latestUpdatesNextPageSelector(): String = "a"

Expand Down Expand Up @@ -94,13 +97,14 @@ class AnimeBlkom : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
genre = document.select("p.genres a").joinToString { it.text() }
description = document.selectFirst("div.story p, div.story")?.text()
author = document.selectFirst("div:contains(الاستديو) span > a")?.text()
status = document.selectFirst("div.info-table div:contains(حالة الأنمي) span.info")?.text()?.let {
when {
it.contains("مستمر") -> SAnime.ONGOING
it.contains("مكتمل") -> SAnime.COMPLETED
else -> null
}
} ?: SAnime.UNKNOWN
status = document.selectFirst("div.info-table div:contains(حالة الأنمي) span.info")?.text()
?.let {
when {
it.contains("مستمر") -> SAnime.ONGOING
it.contains("مكتمل") -> SAnime.COMPLETED
else -> null
}
} ?: SAnime.UNKNOWN
artist = document.selectFirst("div:contains(المخرج) > span.info")?.text()
}

Expand Down Expand Up @@ -156,6 +160,7 @@ class AnimeBlkom : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
.asJsoup()
videoDoc.select(videoListSelector()).map(::videoFromElement)
}

"ok.ru" in url -> okruExtractor.videosFromUrl(url)
"mp4upload" in url -> mp4uploadExtractor.videosFromUrl(url, headers)
else -> emptyList()
Expand All @@ -179,6 +184,7 @@ class AnimeBlkom : ConfigurableAnimeSource, ParsedAnimeHttpSource() {

private class TypeList(types: Array<String>) : AnimeFilter.Select<String>("نوع الأنمي", types)
private data class Type(val name: String, val query: String)

private val typesName = getTypeList().map {
it.name
}.toTypedArray()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@ class Animeiat : ConfigurableAnimeSource, AnimeHttpSource() {
is TypeCategoryList -> {
type = getTypeFilterList()[filter.state].query
}

is StatCategoryList -> {
status = getStatFilterList()[filter.state].query
}

else -> {}
}
}
Expand All @@ -169,16 +171,21 @@ class Animeiat : ConfigurableAnimeSource, AnimeHttpSource() {
return AnimesPage(animeList, hasNextPage)
}

override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/home/sticky-episodes?page=$page")
override fun latestUpdatesRequest(page: Int): Request =
GET("$baseUrl/home/sticky-episodes?page=$page")

// ============================== filters ==============================
override fun getFilterList() = AnimeFilterList(
AnimeFilter.Header("فلترة الموقع"),
TypeCategoryList(typeFilterList),
StatCategoryList(statFilterList),
)
private class TypeCategoryList(categories: Array<String>) : AnimeFilter.Select<String>("النوع", categories)
private class StatCategoryList(categories: Array<String>) : AnimeFilter.Select<String>("الحالة", categories)

private class TypeCategoryList(categories: Array<String>) :
AnimeFilter.Select<String>("النوع", categories)

private class StatCategoryList(categories: Array<String>) :
AnimeFilter.Select<String>("الحالة", categories)

private data class CatUnit(val name: String, val query: String)

Expand All @@ -192,6 +199,7 @@ class Animeiat : ConfigurableAnimeSource, AnimeHttpSource() {
CatUnit("اونا", "ona"),
CatUnit("حلقة خاصة", "special"),
)

private fun getStatFilterList() = listOf(
CatUnit("اختر", ""),
CatUnit("جارى رفعة", "uploading"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,39 +107,49 @@ class AnimeLek : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
Video(it.url, "${it.name}: ${it.quality}", it.url, headers = newH)
}
}

"iframe" in url -> {
return multiServers.extractedUrls(url).parallelCatchingFlatMapBlocking {
extractVideos(it.url, it.name, it.quality)
}
}

"ok.ru" in url -> {
okRuExtractor.videosFromUrl(url)
}

"vadbam" in server -> {
val newH = headers.newBuilder().add("Referer", baseUrl).build()
vidBomExtractor.videosFromUrl(url, newH)
}

"dood" in server -> {
dooDExtractor.videoFromUrl(url, "Dood: ${customQuality ?: "Mirror"}")?.let(::listOf)
?: emptyList()
}

"mp4" in server -> {
mp4uploadExtractor.videosFromUrl(url, headers)
}

"upstream" in server || "lulustream" in server || "streamwish" in server || "vidhide" in server -> {
streamWishExtractor.videosFromUrl(url, server)
}

"mixdrop" in server -> {
mixDropExtractor.videosFromUrl(url, customQuality?.let { "$it " } ?: "")
}

"streamtape" in server -> {
streamTapeExtractor.videosFromUrl(url)
}

"krakenfiles" in server -> {
val req = client.newCall(GET(url)).execute().asJsoup()
val source = req.select("source").attr("src")
Video(source, "Kraken: ${customQuality ?: "Mirror"}", source).let(::listOf)
}

else -> emptyList()
}
}
Expand All @@ -156,7 +166,8 @@ class AnimeLek : ConfigurableAnimeSource, ParsedAnimeHttpSource() {

override fun searchAnimeSelector() = "div.anime-list-content div.anime-card-container"

override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList) = GET("$baseUrl/search/?s=$query&page=$page")
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList) =
GET("$baseUrl/search/?s=$query&page=$page")

// =========================== Anime Details ============================
override fun animeDetailsParse(document: Document): SAnime {
Expand Down Expand Up @@ -227,6 +238,7 @@ class AnimeLek : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
private const val PREF_QUALITY_KEY = "preferred_quality"
private const val PREF_QUALITY_TITLE = "Preferred quality"
private const val PREF_QUALITY_DEFAULT = "720p"
private val PREF_QUALITY_ENTRIES = arrayOf("1080p", "720p", "480p", "360p", "Doodstream", "StreamTape")
private val PREF_QUALITY_ENTRIES =
arrayOf("1080p", "720p", "480p", "360p", "Doodstream", "StreamTape")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ class Animerco : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// =============================== Latest ===============================
override fun latestUpdatesRequest(page: Int): Request = throw UnsupportedOperationException()
override fun latestUpdatesSelector(): String = throw UnsupportedOperationException()
override fun latestUpdatesFromElement(element: Element): SAnime = throw UnsupportedOperationException()
override fun latestUpdatesFromElement(element: Element): SAnime =
throw UnsupportedOperationException()

override fun latestUpdatesNextPageSelector(): String = throw UnsupportedOperationException()

// =============================== Search ===============================
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList) = GET("$baseUrl/page/$page/?s=$query")
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList) =
GET("$baseUrl/page/$page/?s=$query")

override fun searchAnimeSelector() = popularAnimeSelector()
override fun searchAnimeFromElement(element: Element) = popularAnimeFromElement(element)
Expand Down Expand Up @@ -138,14 +141,15 @@ class Animerco : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
}.reversed()
}

private fun episodeFromElement(element: Element, seasonName: String, seasonNum: Int) = SEpisode.create().apply {
setUrlWithoutDomain(element.attr("href"))
val epText = element.selectFirst("h3")!!.ownText()
name = "$seasonName: " + epText
val epNum = epText.filter(Char::isDigit)
// good luck trying to track this xD
episode_number = "$seasonNum.${epNum.padStart(3, '0')}".toFloatOrNull() ?: 1F
}
private fun episodeFromElement(element: Element, seasonName: String, seasonNum: Int) =
SEpisode.create().apply {
setUrlWithoutDomain(element.attr("href"))
val epText = element.selectFirst("h3")!!.ownText()
name = "$seasonName: " + epText
val epNum = epText.filter(Char::isDigit)
// good luck trying to track this xD
episode_number = "$seasonNum.${epNum.padStart(3, '0')}".toFloatOrNull() ?: 1F
}

override fun episodeFromElement(element: Element) = throw UnsupportedOperationException()

Expand Down Expand Up @@ -182,6 +186,7 @@ class Animerco : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val newUrl = "https://gdriveplayer.to/embed2.php?link=$url"
gdrivePlayerExtractor.videosFromUrl(newUrl, "GdrivePlayer", headers)
}

"streamtape" in url -> streamTapeExtractor.videoFromUrl(url)?.let(::listOf)
"4shared" in url -> sharedExtractor.videoFromUrl(url)?.let(::listOf)
"uqload" in url -> uqloadExtractor.videosFromUrl(url)
Expand Down Expand Up @@ -245,8 +250,10 @@ class Animerco : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
private const val PREF_QUALITY_KEY = "preferred_quality"
private const val PREF_QUALITY_TITLE = "Preferred quality"
private const val PREF_QUALITY_DEFAULT = "1080"
private val PREF_QUALITY_ENTRIES = arrayOf("1080p", "720p", "480p", "360p", "Doodstream", "StreamTape")
private val PREF_QUALITY_VALUES = arrayOf("1080", "720", "480", "360", "Doodstream", "StreamTape")
private val PREF_QUALITY_ENTRIES =
arrayOf("1080p", "720p", "480p", "360p", "Doodstream", "StreamTape")
private val PREF_QUALITY_VALUES =
arrayOf("1080", "720", "480", "360", "Doodstream", "StreamTape")

private val VIDBOM_DOMAINS = listOf(
"vidbom.com", "vidbem.com", "vidbm.com", "vedpom.com",
Expand Down
Loading

0 comments on commit 27ee759

Please sign in to comment.