Merge branch 'Kohi-den:main' into main
This commit is contained in:
commit
85610e7f46
14 changed files with 320 additions and 22 deletions
|
@ -19,11 +19,11 @@ kotlin-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", ver
|
|||
coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines_version" }
|
||||
coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines_version" }
|
||||
|
||||
injekt-core = { module = "com.github.inorichi.injekt:injekt-core", version = "65b0440" }
|
||||
injekt = "com.github.mihonapp:injekt:91edab2317"
|
||||
rxjava = { module = "io.reactivex:rxjava", version = "1.3.8" }
|
||||
jsoup = { module = "org.jsoup:jsoup", version = "1.16.1" }
|
||||
okhttp = { module = "com.squareup.okhttp3:okhttp", version = "5.0.0-alpha.11" }
|
||||
quickjs = { module = "app.cash.quickjs:quickjs-android", version = "0.9.2" }
|
||||
|
||||
[bundles]
|
||||
common = ["kotlin-stdlib", "injekt-core", "rxjava", "kotlin-protobuf", "kotlin-json", "jsoup", "okhttp", "aniyomi-lib", "quickjs", "coroutines-core", "coroutines-android"]
|
||||
common = ["kotlin-stdlib", "injekt", "rxjava", "kotlin-protobuf", "kotlin-json", "jsoup", "okhttp", "aniyomi-lib", "quickjs", "coroutines-core", "coroutines-android"]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
ext {
|
||||
extName = 'Torrentio Anime (Torrent / Debrid)'
|
||||
extClass = '.Torrentio'
|
||||
extVersionCode = 8
|
||||
extVersionCode = 9
|
||||
containsNsfw = false
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class Torrentio : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||
currentPage
|
||||
hasNextPage
|
||||
}
|
||||
media(type: ANIME, sort: ${"$"}sort, search: ${"$"}search, status_in:[RELEASING,FINISHED]) {
|
||||
media(type: ANIME, sort: ${"$"}sort, search: ${"$"}search, status_in:[RELEASING,FINISHED,NOT_YET_RELEASED]) {
|
||||
id
|
||||
title {
|
||||
romaji
|
||||
|
|
|
@ -2,7 +2,7 @@ ext {
|
|||
extName = 'AniPlay'
|
||||
extClass = '.AniPlay'
|
||||
themePkg = 'anilist'
|
||||
overrideVersionCode = 2
|
||||
overrideVersionCode = 3
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.kanade.tachiyomi.animeextension.en.aniplay
|
||||
|
||||
import android.app.Application
|
||||
import android.net.Uri
|
||||
import android.util.Base64
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
|
@ -14,7 +15,6 @@ import eu.kanade.tachiyomi.animesource.model.Track
|
|||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.lib.playlistutils.PlaylistUtils
|
||||
import eu.kanade.tachiyomi.multisrc.anilist.AniListAnimeHttpSource
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.POST
|
||||
import eu.kanade.tachiyomi.util.parallelFlatMapBlocking
|
||||
import eu.kanade.tachiyomi.util.parseAs
|
||||
|
@ -73,14 +73,27 @@ class AniPlay : AniListAnimeHttpSource(), ConfigurableAnimeSource {
|
|||
val httpUrl = anime.url.toHttpUrl()
|
||||
val animeId = httpUrl.pathSegments[2]
|
||||
|
||||
return GET("$baseUrl/api/anime/episode/$animeId")
|
||||
val requestBody = "[\"${animeId}\",true,false]"
|
||||
.toRequestBody("text/plain;charset=UTF-8".toMediaType())
|
||||
|
||||
val headersWithAction =
|
||||
headers.newBuilder()
|
||||
// next.js stuff I guess
|
||||
.add("Next-Action", HEADER_NEXT_ACTION_EPISODE_LIST_VALUE)
|
||||
.build()
|
||||
|
||||
return POST(url = "$baseUrl/anime/info/$animeId", headersWithAction, requestBody)
|
||||
}
|
||||
|
||||
override fun episodeListParse(response: Response): List<SEpisode> {
|
||||
val isMarkFiller = preferences.getBoolean(PREF_MARK_FILLER_EPISODE_KEY, PREF_MARK_FILLER_EPISODE_DEFAULT)
|
||||
val episodeListUrl = response.request.url
|
||||
val animeId = episodeListUrl.pathSegments[3]
|
||||
val providers = response.parseAs<List<EpisodeListResponse>>()
|
||||
val animeId = episodeListUrl.pathSegments[2]
|
||||
|
||||
val responseString = response.body.string()
|
||||
val episodesArrayString = responseString.split("1:").last()
|
||||
|
||||
val providers = episodesArrayString.parseAs<List<EpisodeListResponse>>()
|
||||
val episodes = mutableMapOf<Int, EpisodeListResponse.Episode>()
|
||||
val episodeExtras = mutableMapOf<Int, List<EpisodeExtra>>()
|
||||
|
||||
|
@ -94,6 +107,7 @@ class AniPlay : AniListAnimeHttpSource(), ConfigurableAnimeSource {
|
|||
val episodeExtra = EpisodeExtra(
|
||||
source = provider.providerId,
|
||||
episodeId = episode.id,
|
||||
episodeNum = episode.number,
|
||||
hasDub = episode.hasDub,
|
||||
)
|
||||
episodeExtras[episodeNumber] = existingEpisodeExtras + listOf(episodeExtra)
|
||||
|
@ -142,7 +156,7 @@ class AniPlay : AniListAnimeHttpSource(), ConfigurableAnimeSource {
|
|||
override suspend fun getVideoList(episode: SEpisode): List<Video> {
|
||||
val episodeUrl = episode.url.toHttpUrl()
|
||||
val animeId = episodeUrl.queryParameter("id") ?: return emptyList()
|
||||
val episodeNum = episodeUrl.queryParameter("ep") ?: return emptyList()
|
||||
// val episodeNum = episodeUrl.queryParameter("ep") ?: return emptyList()
|
||||
val extras = episodeUrl.queryParameter("extras")
|
||||
?.let {
|
||||
try {
|
||||
|
@ -162,33 +176,55 @@ class AniPlay : AniListAnimeHttpSource(), ConfigurableAnimeSource {
|
|||
}
|
||||
?: emptyList()
|
||||
|
||||
val headersWithAction =
|
||||
headers.newBuilder()
|
||||
// next.js stuff I guess
|
||||
.add("Next-Action", HEADER_NEXT_ACTION_SOURCES_LIST_VALUE)
|
||||
.build()
|
||||
|
||||
val episodeDataList = extras.parallelFlatMapBlocking { extra ->
|
||||
val languages = mutableListOf("sub").apply {
|
||||
if (extra.hasDub) add("dub")
|
||||
}
|
||||
val url = "$baseUrl/api/anime/source/$animeId"
|
||||
|
||||
languages.map { language ->
|
||||
val requestBody = json.encodeToString(
|
||||
VideoSourceRequest(
|
||||
source = extra.source,
|
||||
episodeId = extra.episodeId,
|
||||
episodeNum = episodeNum,
|
||||
subType = language,
|
||||
),
|
||||
).toRequestBody("application/json".toMediaType())
|
||||
val epNum = if (extra.episodeNum == extra.episodeNum.toInt().toFloat()) {
|
||||
extra.episodeNum.toInt().toString() // If it has no fractional part, convert it to an integer
|
||||
} else {
|
||||
extra.episodeNum.toString() // If it has a fractional part, leave it as a float
|
||||
}
|
||||
|
||||
val requestBody = "[\"$animeId\",\"${extra.source}\",\"${extra.episodeId}\",\"$epNum\",\"$language\"]"
|
||||
.toRequestBody("application/json".toMediaType())
|
||||
|
||||
val params = mapOf(
|
||||
"id" to animeId,
|
||||
"host" to extra.source,
|
||||
"ep" to epNum,
|
||||
"type" to language,
|
||||
)
|
||||
val builder = Uri.parse("$baseUrl/anime/watch").buildUpon()
|
||||
params.map { (k, v) -> builder.appendQueryParameter(k, v); }
|
||||
val url = builder.build().toString()
|
||||
Log.i("AniPlay", "Url: $url")
|
||||
try {
|
||||
val response = client.newCall(POST(url = url, body = requestBody)).execute().parseAs<VideoSourceResponse>()
|
||||
val request = POST(url, headersWithAction, requestBody)
|
||||
val response = client.newCall(request).execute()
|
||||
|
||||
val responseString = response.body.string()
|
||||
val sourcesString = responseString.split("1:").last()
|
||||
if (sourcesString.startsWith("null")) return@map null
|
||||
val data = sourcesString.parseAs<VideoSourceResponse>()
|
||||
|
||||
EpisodeData(
|
||||
source = extra.source,
|
||||
language = language,
|
||||
response = response,
|
||||
response = data,
|
||||
)
|
||||
} catch (e: IOException) {
|
||||
Log.w("AniPlay", "VideoList $url IOException", e)
|
||||
null // Return null to be filtered out
|
||||
} catch (e: Exception) {
|
||||
Log.w("AniPlay", "VideoList $url Exception", e)
|
||||
null // Return null to be filtered out
|
||||
}
|
||||
}.filterNotNull() // Filter out null values due to errors
|
||||
|
@ -384,6 +420,10 @@ class AniPlay : AniListAnimeHttpSource(), ConfigurableAnimeSource {
|
|||
private const val PREF_MARK_FILLER_EPISODE_KEY = "mark_filler_episode"
|
||||
private const val PREF_MARK_FILLER_EPISODE_DEFAULT = true
|
||||
|
||||
// These values has probably something to do with Next.js server and hydration
|
||||
private const val HEADER_NEXT_ACTION_EPISODE_LIST_VALUE = "f3422af67c84852f5e63d50e1f51718f1c0225c4"
|
||||
private const val HEADER_NEXT_ACTION_SOURCES_LIST_VALUE = "5dbcd21c7c276c4d15f8de29d9ef27aef5ea4a5e"
|
||||
|
||||
private val DATE_FORMATTER = SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ data class VideoSourceResponse(
|
|||
@Serializable
|
||||
data class EpisodeExtra(
|
||||
val source: String,
|
||||
val episodeNum: Float,
|
||||
val episodeId: String,
|
||||
val hasDub: Boolean,
|
||||
)
|
||||
|
|
15
src/en/pinoymoviepedia/build.gradle
Normal file
15
src/en/pinoymoviepedia/build.gradle
Normal file
|
@ -0,0 +1,15 @@
|
|||
ext {
|
||||
extName = 'PinoyMoviePedia'
|
||||
extClass = '.PinoyMoviePedia'
|
||||
themePkg = 'dooplay'
|
||||
baseUrl = 'https://pinoymoviepedia.ru'
|
||||
overrideVersionCode = 0
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
||||
dependencies {
|
||||
implementation(project(':lib:mixdrop-extractor'))
|
||||
implementation(project(':lib:dood-extractor'))
|
||||
}
|
BIN
src/en/pinoymoviepedia/res/mipmap-hdpi/ic_launcher.webp
Normal file
BIN
src/en/pinoymoviepedia/res/mipmap-hdpi/ic_launcher.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 6 KiB |
BIN
src/en/pinoymoviepedia/res/mipmap-mdpi/ic_launcher.webp
Normal file
BIN
src/en/pinoymoviepedia/res/mipmap-mdpi/ic_launcher.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
BIN
src/en/pinoymoviepedia/res/mipmap-xhdpi/ic_launcher.webp
Normal file
BIN
src/en/pinoymoviepedia/res/mipmap-xhdpi/ic_launcher.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.1 KiB |
BIN
src/en/pinoymoviepedia/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
BIN
src/en/pinoymoviepedia/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
src/en/pinoymoviepedia/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
BIN
src/en/pinoymoviepedia/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
|
@ -0,0 +1,156 @@
|
|||
package eu.kanade.tachiyomi.animeextension.en.pinoymoviepedia
|
||||
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.lib.doodextractor.DoodExtractor
|
||||
import eu.kanade.tachiyomi.lib.mixdropextractor.MixDropExtractor
|
||||
import eu.kanade.tachiyomi.multisrc.dooplay.DooPlay
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.POST
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import eu.kanade.tachiyomi.util.parallelFlatMapBlocking
|
||||
import okhttp3.FormBody
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class PinoyMoviePedia : DooPlay(
|
||||
"en",
|
||||
"PinoyMoviePedia",
|
||||
"https://pinoymoviepedia.ru",
|
||||
) {
|
||||
override val supportsLatest = false
|
||||
|
||||
// ============================== Popular ===============================
|
||||
override fun popularAnimeRequest(page: Int) = GET("$baseUrl/ratings/$page")
|
||||
|
||||
override fun popularAnimeSelector() = latestUpdatesSelector()
|
||||
|
||||
override fun popularAnimeNextPageSelector() = latestUpdatesNextPageSelector()
|
||||
|
||||
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/ano/2024/page/$page", headers)
|
||||
|
||||
override fun videoListSelector() = "li.dooplay_player_option" // ul#playeroptionsul
|
||||
|
||||
override val episodeMovieText = "Movie"
|
||||
|
||||
override val episodeSeasonPrefix = "Season"
|
||||
override val prefQualityTitle = "Preferred quality"
|
||||
|
||||
private val doodExtractor by lazy { DoodExtractor(client) }
|
||||
private val mixDropExtractor by lazy { MixDropExtractor(client) }
|
||||
|
||||
// ============================ Video Links =============================
|
||||
override fun videoListParse(response: Response): List<Video> {
|
||||
val document = response.asJsoup()
|
||||
val players = document.select("ul#playeroptionsul li")
|
||||
return players.parallelFlatMapBlocking { player ->
|
||||
val name = player.selectFirst("span.title")!!.text()
|
||||
val url = getPlayerUrl(player)
|
||||
?: return@parallelFlatMapBlocking emptyList<Video>()
|
||||
extractVideos(url, name)
|
||||
}
|
||||
}
|
||||
|
||||
private fun extractVideos(url: String, lang: String): List<Video> {
|
||||
return when {
|
||||
"dood" in url -> doodExtractor.videosFromUrl(url, lang)
|
||||
"mixdrop" in url -> mixDropExtractor.videosFromUrl(url, lang)
|
||||
else -> null
|
||||
} ?: emptyList()
|
||||
}
|
||||
|
||||
private fun getPlayerUrl(player: Element): String? {
|
||||
val body = FormBody.Builder()
|
||||
.add("action", "doo_player_ajax")
|
||||
.add("post", player.attr("data-post"))
|
||||
.add("nume", player.attr("data-nume"))
|
||||
.add("type", player.attr("data-type"))
|
||||
.build()
|
||||
|
||||
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
|
||||
.execute().body.string()
|
||||
.substringAfter("\"embed_url\":\"")
|
||||
.substringBefore("\",")
|
||||
.replace("\\", "")
|
||||
.takeIf(String::isNotBlank)
|
||||
}
|
||||
|
||||
// ============================== Filters ===============================
|
||||
override val fetchGenres = false
|
||||
|
||||
override fun getFilterList() = PinoyMoviePediaFilters.FILTER_LIST
|
||||
|
||||
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request {
|
||||
val params = PinoyMoviePediaFilters.getSearchParameters(filters)
|
||||
val path = when {
|
||||
params.genre.isNotBlank() -> {
|
||||
if (params.genre in listOf("ratings")) {
|
||||
"/${params.genre}"
|
||||
} else {
|
||||
"/genre/${params.genre}"
|
||||
}
|
||||
}
|
||||
else -> buildString {
|
||||
append(
|
||||
when {
|
||||
query.isNotBlank() -> "/?s=$query"
|
||||
else -> "/"
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return if (path.startsWith("/?s=")) {
|
||||
GET("$baseUrl/page/$page$path")
|
||||
} else {
|
||||
GET("$baseUrl$path/page/$page")
|
||||
}
|
||||
}
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
super.setupPreferenceScreen(screen) // Quality preference
|
||||
|
||||
ListPreference(screen.context).apply {
|
||||
key = PREF_SERVER_KEY
|
||||
title = "Preferred server"
|
||||
entries = SERVER_LIST
|
||||
entryValues = SERVER_LIST
|
||||
setDefaultValue(PREF_SERVER_DEFAULT)
|
||||
summary = "%s"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = findIndexOfValue(selected)
|
||||
val entry = entryValues[index] as String
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
}
|
||||
}.also(screen::addPreference)
|
||||
}
|
||||
|
||||
// ============================= Utilities ==============================
|
||||
override fun String.toDate() = 0L
|
||||
|
||||
override fun List<Video>.sort(): List<Video> {
|
||||
val quality = preferences.getString(prefQualityKey, prefQualityDefault)!!
|
||||
val server = preferences.getString(PREF_SERVER_KEY, PREF_SERVER_DEFAULT)!!
|
||||
return sortedWith(
|
||||
compareBy(
|
||||
{ it.quality.contains(lang) },
|
||||
{ it.quality.contains(server, true) },
|
||||
{ it.quality.contains(quality) },
|
||||
),
|
||||
).reversed()
|
||||
}
|
||||
|
||||
override val prefQualityValues = arrayOf("480p", "720p", "1080p")
|
||||
override val prefQualityEntries = prefQualityValues
|
||||
|
||||
companion object {
|
||||
private const val PREF_SERVER_KEY = "preferred_server"
|
||||
private const val PREF_SERVER_DEFAULT = "DoodStream"
|
||||
private val SERVER_LIST = arrayOf("DoodStream", "MixDrop")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package eu.kanade.tachiyomi.animeextension.en.pinoymoviepedia
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilter
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
|
||||
|
||||
object PinoyMoviePediaFilters {
|
||||
|
||||
open class UriPartFilter(
|
||||
displayName: String,
|
||||
private val vals: Array<Pair<String, String>>,
|
||||
) : AnimeFilter.Select<String>(
|
||||
displayName,
|
||||
vals.map { it.first }.toTypedArray(),
|
||||
) {
|
||||
|
||||
fun toUriPart() = vals[state].second
|
||||
}
|
||||
|
||||
private inline fun <reified R> AnimeFilterList.getFirst(): R {
|
||||
return first { it is R } as R
|
||||
}
|
||||
|
||||
private inline fun <reified R> AnimeFilterList.asUriPart(): String {
|
||||
return getFirst<R>().let {
|
||||
(it as UriPartFilter).toUriPart()
|
||||
}
|
||||
}
|
||||
|
||||
class GenreFilter : UriPartFilter("Genre", AnimesOnlineNinjaData.GENRES)
|
||||
|
||||
private inline fun <reified R> AnimeFilter.Group<UriPartFilter>.getItemUri(): String {
|
||||
return state.first { it is R }.toUriPart()
|
||||
}
|
||||
|
||||
val FILTER_LIST get() = AnimeFilterList(
|
||||
AnimeFilter.Header("These filters do not affect text searches."),
|
||||
GenreFilter(),
|
||||
)
|
||||
|
||||
data class FilterSearchParams(
|
||||
val genre: String = "",
|
||||
)
|
||||
|
||||
internal fun getSearchParameters(filters: AnimeFilterList): FilterSearchParams {
|
||||
if (filters.isEmpty()) return FilterSearchParams()
|
||||
|
||||
return FilterSearchParams(
|
||||
genre = filters.asUriPart<GenreFilter>(),
|
||||
)
|
||||
}
|
||||
|
||||
private object AnimesOnlineNinjaData {
|
||||
val EVERY = Pair("Select Genre", "")
|
||||
|
||||
val GENRES = arrayOf(
|
||||
EVERY,
|
||||
Pair("Fantasy", "fantasy"),
|
||||
Pair("Comedy", "comedy"),
|
||||
Pair("Family", "family"),
|
||||
Pair("Action", "action"),
|
||||
Pair("Drama", "drama"),
|
||||
Pair("Romance", "romance"),
|
||||
Pair("Mystery", "mystery"),
|
||||
Pair("Music", "music"),
|
||||
Pair("Adventure", "adventure"),
|
||||
Pair("Horror", "horror"),
|
||||
Pair("Digitally Restored", "digitally-restored"),
|
||||
Pair("Science Fiction", "science-fiction"),
|
||||
Pair("Pinay Sexy Movies", "pinay-sexy-movies"),
|
||||
Pair("Crime", "crime"),
|
||||
Pair("Thriller", "thriller"),
|
||||
Pair("History", "history"),
|
||||
Pair("Documentary", "documentary"),
|
||||
Pair("Biography", "biography"),
|
||||
Pair("Animation", "animation"),
|
||||
Pair("War", "war"),
|
||||
Pair("Musical", "musical"),
|
||||
Pair("Indie", "indie"),
|
||||
Pair("LGBT", "lgbt"),
|
||||
Pair("Concert", "concert"),
|
||||
Pair("Short Movie", "short-movie"),
|
||||
Pair("2022", "2022"),
|
||||
Pair("Tagalog Dubbed", "tagalog-dubbed"),
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue