show type on title page + animepahe

This commit is contained in:
LagradOst 2022-01-31 21:47:59 +01:00
parent 06bafa9801
commit 4bac7eb33b
19 changed files with 147 additions and 68 deletions

View file

@ -65,25 +65,41 @@
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="https" android:host="gogoanime.vc" android:pathPrefix="/"/>
<data android:scheme="https" android:host="pelisplus.icu" android:pathPrefix="/"/>
<data android:scheme="https" android:host="pelisplushd.net" android:pathPrefix="/"/>
<data android:scheme="https" android:host="pelismart.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="gogoanime.wiki" android:pathPrefix="/"/>
<data android:scheme="https" android:host="allanime.site" android:pathPrefix="/"/>
<data android:scheme="https" android:host="animeflick.net" android:pathPrefix="/"/>
<data android:scheme="https" android:host="kawaiifu.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="m.animeflv.net" android:pathPrefix="/"/>
<data android:scheme="https" android:host="tenshi.moe" android:pathPrefix="/"/>
<data android:scheme="https" android:host="wcostream.cc" android:pathPrefix="/"/>
<data android:scheme="https" android:host="bestdubbedanime.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="hdm.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="doramasyt.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="cinecalidad.lol" android:pathPrefix="/"/>
<data android:scheme="https" android:host="ihavenotv.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.vmovee.watch" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.wcostream.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="allmoviesforyou.net" android:pathPrefix="/"/>
<data android:scheme="https" android:host="monoschinos2.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="vidembed.cc" android:pathPrefix="/"/>
<data android:scheme="https" android:host="vf-film.me" android:pathPrefix="/"/>
<data android:scheme="https" android:host="vf-serie.org" android:pathPrefix="/"/>
<data android:scheme="https" android:host="french-stream.re" android:pathPrefix="/"/>
<data android:scheme="https" android:host="asianembed.io" android:pathPrefix="/"/>
<data android:scheme="https" android:host="sflix.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="dopebox.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="trailers.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="filman.cc" android:pathPrefix="/"/>
<data android:scheme="https" android:host="zoro.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="pinoymoviepedia.ru" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.pinoy-hd.xyz" android:pathPrefix="/"/>
<data android:scheme="https" android:host="pinoymovies.es" android:pathPrefix="/"/>
<data android:scheme="https" android:host="trailers.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="dramasee.net" android:pathPrefix="/"/>
<data android:scheme="https" android:host="watchasian.sh" android:pathPrefix="/"/>
<data android:scheme="https" android:host="kdramahood.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="akwam.io" android:pathPrefix="/"/>
<data android:scheme="https" android:host="animepahe.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="asiaflix.app" android:pathPrefix="/"/>
</intent-filter>
<intent-filter>

View file

@ -74,7 +74,8 @@ object APIHolder {
DramaSeeProvider(),
WatchAsianProvider(),
KdramaHoodProvider(),
AkwamProvider()
AkwamProvider(),
AnimePaheProvider(),
)
val restrictedApis = arrayListOf(
@ -194,7 +195,7 @@ object APIHolder {
allApis
} else {
// Filter API depending on preferred media type
val listEnumAnime = listOf(TvType.Anime, TvType.AnimeMovie, TvType.ONA)
val listEnumAnime = listOf(TvType.Anime, TvType.AnimeMovie, TvType.OVA)
val listEnumMovieTv = listOf(TvType.Movie, TvType.TvSeries, TvType.Cartoon)
val mediaTypeList = if (currentPrefMedia == 1) listEnumMovieTv else listEnumAnime
@ -232,7 +233,7 @@ abstract class MainAPI {
TvType.TvSeries,
TvType.Cartoon,
TvType.Anime,
TvType.ONA,
TvType.OVA,
)
open val vpnStatus = VPNStatus.None
@ -386,7 +387,7 @@ enum class TvType {
TvSeries,
Cartoon,
Anime,
ONA,
OVA,
Torrent,
Documentary,
}
@ -398,7 +399,7 @@ fun TvType.isMovieType(): Boolean {
// returns if the type has an anime opening
fun TvType.isAnimeOp(): Boolean {
return this == TvType.Anime || this == TvType.ONA
return this == TvType.Anime || this == TvType.OVA
}
data class SubtitleFile(val lang: String, val url: String)
@ -478,7 +479,7 @@ interface LoadResponse {
val posterUrl: String?
val year: Int?
val plot: String?
val rating: Int? // 0-100
val rating: Int? // 1-1000
val tags: List<String>?
var duration: Int? // in minutes
val trailerUrl: String?
@ -492,7 +493,7 @@ fun LoadResponse?.isEpisodeBased(): Boolean {
fun LoadResponse?.isAnimeBased(): Boolean {
if (this == null) return false
return (this.type == TvType.Anime || this.type == TvType.ONA) // && (this is AnimeLoadResponse)
return (this.type == TvType.Anime || this.type == TvType.OVA) // && (this is AnimeLoadResponse)
}
fun TvType?.isEpisodeBased(): Boolean {

View file

@ -10,7 +10,7 @@ import java.util.*
class AnimeFlickProvider : MainAPI() {
companion object {
fun getType(t: String): TvType {
return if (t.contains("OVA") || t.contains("Special")) TvType.ONA
return if (t.contains("OVA") || t.contains("Special")) TvType.OVA
else if (t.contains("Movie")) TvType.AnimeMovie
else TvType.Anime
}
@ -24,7 +24,7 @@ class AnimeFlickProvider : MainAPI() {
override val supportedTypes = setOf(
TvType.AnimeMovie,
TvType.Anime,
TvType.ONA
TvType.OVA
)
override suspend fun search(query: String): ArrayList<SearchResponse> {

View file

@ -6,6 +6,7 @@ import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall
import com.lagradost.cloudstream3.network.AppResponse
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.JsUnpacker
import com.lagradost.cloudstream3.utils.getQualityFromName
import org.jsoup.Jsoup
import java.util.*
@ -18,7 +19,7 @@ class AnimePaheProvider : MainAPI() {
var cookies: Map<String, String> = mapOf()
private fun getType(t: String): TvType {
return if (t.contains("OVA") || t.contains("Special")) TvType.ONA
return if (t.contains("OVA") || t.contains("Special")) TvType.OVA
else if (t.contains("Movie")) TvType.AnimeMovie
else TvType.Anime
}
@ -51,7 +52,7 @@ class AnimePaheProvider : MainAPI() {
override val supportedTypes = setOf(
TvType.AnimeMovie,
TvType.Anime,
TvType.ONA
TvType.OVA
)
override suspend fun getMainPage(): HomePageResponse {
@ -428,7 +429,7 @@ class AnimePaheProvider : MainAPI() {
@JsonProperty("id") val id: Int?,
@JsonProperty("audio") val audio: String?,
@JsonProperty("kwik") val kwik: String?,
@JsonProperty("kwik_adfly") val kwikAdfly: String
@JsonProperty("kwik_pahewin") val kwikPahewin: String
)
private data class AnimePaheEpisodeLoadLinks(
@ -460,7 +461,25 @@ class AnimePaheProvider : MainAPI() {
return decodeAdfly(YTSM.find(adflyContent?.text.toString())!!.destructured.component1())
}
private suspend fun getStreamUrlFromKwik(adflyUri: String): String {
private suspend fun getStreamUrlFromKwik(url: String?): String? {
if (url == null) return null
val response =
app.get(
url,
headers = mapOf("referer" to mainUrl),
cookies = cookies
).text
Regex("eval((.|\\n)*?)</script>").find(response)?.groupValues?.get(1)?.let { jsEval ->
JsUnpacker("eval$jsEval").unpack()?.let { unPacked ->
Regex("source=\'(.*?)\'").find(unPacked)?.groupValues?.get(1)?.let { link ->
return link
}
}
}
return null
}
private suspend fun getStreamUrlFromKwikAdfly(adflyUri: String): String {
val fContent =
app.get(
bypassAdfly(adflyUri),
@ -495,7 +514,10 @@ class AnimePaheProvider : MainAPI() {
return content?.headers?.values("location").toString()
}
private suspend fun extractVideoLinks(episodeLink: String): List<ExtractorLink> {
private suspend fun extractVideoLinks(
episodeLink: String,
callback: (ExtractorLink) -> Unit
) {
var link = episodeLink
val headers = mapOf("referer" to "$mainUrl/")
@ -520,23 +542,22 @@ class AnimePaheProvider : MainAPI() {
val req = app.get(link, headers = headers).text
val data = mapper.readValue<AnimePaheEpisodeLoadLinks>(req)
val qualities = ArrayList<ExtractorLink>()
data.data.forEach {
it.entries.forEach { quality ->
qualities.add(
it.entries.toList().apmap { quality ->
getStreamUrlFromKwik(quality.value.kwik)?.let { link ->
callback(
ExtractorLink(
"KWIK",
"KWIK - ${quality.key} [${quality.value.audio ?: "jpn"}]",
getStreamUrlFromKwik(quality.value.kwikAdfly),
"",
link,
"https://kwik.cx/",
getQualityFromName(quality.key),
false
link.contains(".m3u8")
)
)
}
}
return qualities
}
}
override suspend fun loadLinks(
@ -545,9 +566,7 @@ class AnimePaheProvider : MainAPI() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
for (server in extractVideoLinks(data)) {
callback.invoke(server)
}
extractVideoLinks(data, callback)
return true
}
}

View file

@ -9,7 +9,7 @@ import kotlin.collections.ArrayList
class AnimeflvnetProvider : MainAPI() {
companion object {
fun getType(t: String): TvType {
return if (t.contains("OVA") || t.contains("Especial")) TvType.ONA
return if (t.contains("OVA") || t.contains("Especial")) TvType.OVA
else if (t.contains("Película")) TvType.AnimeMovie
else TvType.Anime
}
@ -23,7 +23,7 @@ class AnimeflvnetProvider : MainAPI() {
override val hasDownloadSupport = true
override val supportedTypes = setOf(
TvType.AnimeMovie,
TvType.ONA,
TvType.OVA,
TvType.Anime,
)

View file

@ -14,7 +14,7 @@ import javax.crypto.spec.SecretKeySpec
class GogoanimeProvider : MainAPI() {
companion object {
fun getType(t: String): TvType {
return if (t.contains("OVA") || t.contains("Special")) TvType.ONA
return if (t.contains("OVA") || t.contains("Special")) TvType.OVA
else if (t.contains("Movie")) TvType.AnimeMovie
else TvType.Anime
}
@ -58,7 +58,7 @@ class GogoanimeProvider : MainAPI() {
override val supportedTypes = setOf(
TvType.AnimeMovie,
TvType.Anime,
TvType.ONA
TvType.OVA
)
override suspend fun getMainPage(): HomePageResponse {

View file

@ -12,7 +12,7 @@ class KawaiifuProvider : MainAPI() {
override val hasQuickSearch = false
override val hasMainPage = true
override val supportedTypes = setOf(TvType.Anime, TvType.AnimeMovie, TvType.ONA)
override val supportedTypes = setOf(TvType.Anime, TvType.AnimeMovie)
override suspend fun getMainPage(): HomePageResponse {
val items = ArrayList<HomePageList>()

View file

@ -11,7 +11,7 @@ import kotlin.collections.ArrayList
class MonoschinosProvider : MainAPI() {
companion object {
fun getType(t: String): TvType {
return if (t.contains("OVA") || t.contains("Especial")) TvType.ONA
return if (t.contains("OVA") || t.contains("Especial")) TvType.OVA
else if (t.contains("Pelicula")) TvType.AnimeMovie
else TvType.Anime
}
@ -25,7 +25,7 @@ class MonoschinosProvider : MainAPI() {
override val hasDownloadSupport = true
override val supportedTypes = setOf(
TvType.AnimeMovie,
TvType.ONA,
TvType.OVA,
TvType.Anime,
)

View file

@ -20,7 +20,7 @@ class TenshiProvider : MainAPI() {
//var cookie: Map<String, String> = mapOf()
fun getType(t: String): TvType {
return if (t.contains("OVA") || t.contains("Special")) TvType.ONA
return if (t.contains("OVA") || t.contains("Special")) TvType.OVA
else if (t.contains("Movie")) TvType.AnimeMovie
else TvType.Anime
}
@ -30,7 +30,7 @@ class TenshiProvider : MainAPI() {
override val name = "Tenshi.moe"
override val hasQuickSearch = false
override val hasMainPage = true
override val supportedTypes = setOf(TvType.Anime, TvType.AnimeMovie, TvType.ONA)
override val supportedTypes = setOf(TvType.Anime, TvType.AnimeMovie, TvType.OVA)
private var ddosGuardKiller = DdosGuardKiller(true)
/*private fun loadToken(): Boolean {

View file

@ -12,7 +12,7 @@ import java.util.*
class WcoProvider : MainAPI() {
companion object {
fun getType(t: String): TvType {
return if (t.contains("OVA") || t.contains("Special")) TvType.ONA
return if (t.contains("OVA") || t.contains("Special")) TvType.OVA
else if (t.contains("Movie")) TvType.AnimeMovie
else TvType.Anime
}
@ -26,7 +26,7 @@ class WcoProvider : MainAPI() {
override val supportedTypes = setOf(
TvType.AnimeMovie,
TvType.Anime,
TvType.ONA
TvType.OVA
)
override suspend fun getMainPage(): HomePageResponse {

View file

@ -26,12 +26,12 @@ class ZoroProvider : MainAPI() {
override val supportedTypes = setOf(
TvType.Anime,
TvType.AnimeMovie,
TvType.ONA
TvType.OVA
)
companion object {
fun getType(t: String): TvType {
return if (t.contains("OVA") || t.contains("Special")) TvType.ONA
return if (t.contains("OVA") || t.contains("Special")) TvType.OVA
else if (t.contains("Movie")) TvType.AnimeMovie
else TvType.Anime
}

View file

@ -11,7 +11,7 @@ import kotlin.collections.ArrayList
class DoramasYTProvider : MainAPI() {
companion object {
fun getType(t: String): TvType {
return if (t.contains("OVA") || t.contains("Especial")) TvType.ONA
return if (t.contains("OVA") || t.contains("Especial")) TvType.OVA
else if (t.contains("Pelicula")) TvType.Movie
else TvType.TvSeries
}

View file

@ -119,9 +119,9 @@ class TrailersTwoProvider : TmdbProvider() {
override val supportedTypes = setOf(
TvType.Movie,
TvType.TvSeries,
TvType.AnimeMovie,
TvType.Anime,
TvType.Cartoon
//TvType.AnimeMovie,
//TvType.Anime,
//TvType.Cartoon
)
override suspend fun loadLinks(

View file

@ -146,7 +146,7 @@ class HomeFragment : Fragment() {
movies: MaterialButton?
): List<Pair<MaterialButton?, List<TvType>>> {
return listOf(
Pair(anime, listOf(TvType.Anime, TvType.ONA, TvType.AnimeMovie)),
Pair(anime, listOf(TvType.Anime, TvType.OVA, TvType.AnimeMovie)),
Pair(cartoons, listOf(TvType.Cartoon)),
Pair(tvs, listOf(TvType.TvSeries)),
Pair(docs, listOf(TvType.Documentary)),
@ -376,7 +376,7 @@ class HomeFragment : Fragment() {
Pair(R.string.tv_series, listOf(TvType.TvSeries)),
Pair(R.string.documentaries, listOf(TvType.Documentary)),
Pair(R.string.cartoons, listOf(TvType.Cartoon)),
Pair(R.string.anime, listOf(TvType.Anime, TvType.ONA, TvType.AnimeMovie)),
Pair(R.string.anime, listOf(TvType.Anime, TvType.OVA, TvType.AnimeMovie)),
Pair(R.string.torrent, listOf(TvType.Torrent)),
).filter { item -> currentApi.supportedTypes.any { type -> item.second.contains(type) } }
home_provider_meta_info?.text =

View file

@ -221,9 +221,10 @@ class CS3IPlayer : IPlayer {
}
}
private fun releasePlayer() {
private fun releasePlayer(saveTime: Boolean = true) {
Log.i(TAG, "releasePlayer")
if (saveTime)
updatedTime()
exoPlayer?.release()
@ -559,6 +560,7 @@ class CS3IPlayer : IPlayer {
duration < 20000L
} ?: false
if (invalid) {
releasePlayer(saveTime = false)
playerError?.invoke(InvalidFileException("Too short playback"))
return
}

View file

@ -517,7 +517,7 @@ class ResultFragment : Fragment() {
TvType.Movie -> "Movies"
TvType.AnimeMovie -> "Movies"
TvType.TvSeries -> "TVSeries/$titleName"
TvType.ONA -> "ONA"
TvType.OVA -> "OVA"
TvType.Cartoon -> "Cartoons/$titleName"
TvType.Torrent -> "Torrent"
TvType.Documentary -> "Documentaries"
@ -1339,6 +1339,22 @@ class ResultFragment : Fragment() {
lateFixDownloadButton(false)
}
context?.getString(
when (d.type) {
TvType.TvSeries -> R.string.tv_series_singular
TvType.Anime -> R.string.anime_singular
TvType.OVA -> R.string.ova_singular
TvType.AnimeMovie -> R.string.movies_singular
TvType.Cartoon -> R.string.cartoons_singular
TvType.Documentary -> R.string.documentaries_singular
TvType.Movie -> R.string.movies_singular
TvType.Torrent -> R.string.torrent_singular
}
)?.let {
result_meta_type?.text = it
}
when (d) {
is AnimeLoadResponse -> {

View file

@ -1,5 +1,6 @@
package com.lagradost.cloudstream3.utils
import com.lagradost.cloudstream3.mvvm.logError
import java.util.regex.Pattern
import kotlin.math.pow
@ -57,7 +58,7 @@ class JsUnpacker(packedJS: String?) {
val word = m.group(0)
val x = unbase.unbase(word)
var value: String? = null
if (x < symtab.size) {
if (x < symtab.size && x >= 0) {
value = symtab[x]
}
if (value != null && value.isNotEmpty()) {
@ -68,7 +69,7 @@ class JsUnpacker(packedJS: String?) {
return decoded.toString()
}
} catch (e: Exception) {
// logError(e)
logError(e)
}
return null
}

View file

@ -321,16 +321,16 @@
<TextView
android:maxLines="2"
android:layout_marginBottom="10dp"
android:layout_marginBottom="5dp"
android:id="@+id/result_title"
tools:text="The Perfect Run The Perfect Run The Perfect Run"
tools:text="The Perfect Run The Perfect Run"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="?attr/textColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
<com.lagradost.cloudstream3.widget.FlowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -339,8 +339,24 @@
style="@style/SmallBlackButton"
android:layout_gravity="center_vertical"
tools:text="Gogoanime" />
<TextView
android:id="@+id/result_meta_type"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:minHeight="24dp"
android:gravity="center"
tools:text="Movie"
android:layout_gravity="center_vertical"
android:textColor="?attr/textColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:minHeight="24dp"
android:gravity="center"
android:id="@+id/result_meta_year"
android:layout_marginStart="10dp"
tools:text="2021"
@ -351,7 +367,10 @@
<TextView
android:id="@+id/result_meta_rating"
android:layout_marginStart="10dp"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:minHeight="24dp"
android:gravity="center"
tools:text="Rated: 8.5/10.0"
android:layout_gravity="center_vertical"
@ -360,15 +379,18 @@
android:layout_height="wrap_content" />
<TextView
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:minHeight="24dp"
android:gravity="center"
android:id="@+id/result_meta_duration"
android:layout_marginStart="10dp"
tools:text="121min"
android:layout_gravity="center_vertical"
android:textColor="?attr/textColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</com.lagradost.cloudstream3.widget.FlowLayout>
<FrameLayout
android:layout_width="match_parent"

View file

@ -258,12 +258,14 @@
<string name="anime">Anime</string>
<string name="torrent">Torrents</string>
<string name="documentaries">Documentaries</string>
<string name="ova">OVA</string>
<!--singular-->
<string name="movies_singular">Movie</string>
<string name="tv_series_singular">Series</string>
<string name="cartoons_singular">Cartoon</string>
<string name="anime_singular">@string/anime</string>
<string name="ova_singular">@string/ova</string>
<string name="torrent_singular">Torrent</string>
<string name="documentaries_singular">Documentary</string>