Add docchi, fix lib lycoris/vk/lulustream (#674)

* feat(pl/OgladajAnime): Update OgladajANime and Add new Lib

* feat(lib/Lycoris): little fix key

* Add docchi, fix lycoris/vk, add lib lulustream(luluvdo)

* fix(lulustream), undo the changes OgladajAnime

* undo change OgladajAnime

* feat(pl/docchi): add lib googledrive
This commit is contained in:
Cezary 2025-02-15 03:33:12 +01:00 committed by GitHub
parent 0e7a942879
commit 29a94748b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 766 additions and 136 deletions

View file

@ -0,0 +1,20 @@
ext {
extName = 'Docchi'
extClass = '.Docchi'
extVersionCode = 1
isNsfw = true
}
apply from: "$rootDir/common.gradle"
dependencies {
implementation(project(':lib:dailymotion-extractor'))
implementation(project(':lib:mp4upload-extractor'))
implementation(project(':lib:sibnet-extractor'))
implementation(project(':lib:vk-extractor'))
implementation(project(':lib:googledrive-extractor'))
implementation(project(':lib:cda-extractor'))
implementation(project(':lib:dood-extractor'))
implementation(project(':lib:lycoris-extractor'))
implementation(project(':lib:lulu-extractor'))
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,349 @@
package eu.kanade.tachiyomi.animeextension.pl.docchi
import android.app.Application
import android.content.SharedPreferences
import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
import eu.kanade.tachiyomi.animesource.model.AnimesPage
import eu.kanade.tachiyomi.animesource.model.SAnime
import eu.kanade.tachiyomi.animesource.model.SEpisode
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource
import eu.kanade.tachiyomi.lib.cdaextractor.CdaPlExtractor
import eu.kanade.tachiyomi.lib.dailymotionextractor.DailymotionExtractor
import eu.kanade.tachiyomi.lib.doodextractor.DoodExtractor
import eu.kanade.tachiyomi.lib.googledriveextractor.GoogleDriveExtractor
import eu.kanade.tachiyomi.lib.luluextractor.LuluExtractor
import eu.kanade.tachiyomi.lib.lycorisextractor.LycorisCafeExtractor
import eu.kanade.tachiyomi.lib.mp4uploadextractor.Mp4uploadExtractor
import eu.kanade.tachiyomi.lib.sibnetextractor.SibnetExtractor
import eu.kanade.tachiyomi.lib.vkextractor.VkExtractor
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.parallelCatchingFlatMapBlocking
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import okhttp3.Request
import okhttp3.Response
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy
class Docchi : ConfigurableAnimeSource, AnimeHttpSource() {
override val name = "Docchi"
override val baseUrl = "https://docchi.pl"
private val baseApiUrl = "https://api.docchi.pl"
override val lang = "pl"
override val supportsLatest = true
private val json: Json by injectLazy()
private val preferences: SharedPreferences by lazy {
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
}
// ============================== Popular ===============================
override fun popularAnimeRequest(page: Int) =
GET("$baseApiUrl/v1/series/list?limit=20&before=${(page - 1) * 20}")
override fun popularAnimeParse(response: Response): AnimesPage {
val animeArray: List<ApiList> = json.decodeFromString(response.body.string())
val entries = animeArray.map { animeDetail ->
SAnime.create().apply {
title = animeDetail.title
url = "$baseUrl/production/as/${animeDetail.slug}"
thumbnail_url = animeDetail.cover
}
}
val hasNextPage = animeArray.isNotEmpty()
return AnimesPage(entries, hasNextPage)
}
// =============================== Latest ===============================
override fun latestUpdatesRequest(page: Int): Request =
GET("$baseApiUrl/v1/series/list?limit=20&before=${(page - 1) * 20}&sort=DESC")
override fun latestUpdatesParse(response: Response): AnimesPage = popularAnimeParse(response)
// =============================== Search ===============================
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request =
GET("$baseApiUrl/v1/series/related/$query")
override fun searchAnimeParse(response: Response): AnimesPage {
val animeArray: List<ApiSearch> = json.decodeFromString(response.body.string())
val entries = animeArray.map { animeDetail ->
SAnime.create().apply {
title = animeDetail.title
url = "$baseUrl/production/as/${animeDetail.slug}"
thumbnail_url = animeDetail.cover
}
}
return AnimesPage(entries, false)
}
// ============================== Episodes ==============================
override fun episodeListRequest(anime: SAnime): Request =
GET("$baseApiUrl/v1/episodes/count/${anime.url.substringAfterLast("/")}")
override fun episodeListParse(response: Response): List<SEpisode> {
val episodeList: List<EpisodeList> = json.decodeFromString(response.body.string())
return episodeList.map { episode ->
SEpisode.create().apply {
name = "${episode.anime_episode_number.toInt()} Odcinek"
url = "$baseUrl/production/as/${episode.anime_id}/${episode.anime_episode_number}"
episode_number = episode.anime_episode_number
// date_upload = episode.created_at.toLong()
}
}.reversed()
}
// =========================== Anime Details ============================
override fun animeDetailsRequest(anime: SAnime): Request =
GET("$baseApiUrl/v1/series/find/${anime.url.substringAfterLast("/")}")
override fun animeDetailsParse(response: Response): SAnime {
val animeDetail: ApiDetail = json.decodeFromString(response.body.string())
return SAnime.create().apply {
title = animeDetail.title
description = animeDetail.description
genre = animeDetail.genres.joinToString(", ")
}
}
// ============================ Video Links =============================
override fun videoListRequest(episode: SEpisode): Request = GET(
"$baseApiUrl/v1/episodes/find/${
episode.url.substringBeforeLast("/").substringAfterLast("/")
}/${episode.episode_number}",
)
private val vkExtractor by lazy { VkExtractor(client, headers) }
private val cdaExtractor by lazy { CdaPlExtractor(client) }
private val mp4uploadExtractor by lazy { Mp4uploadExtractor(client) }
private val dailymotionExtractor by lazy { DailymotionExtractor(client, headers) }
private val sibnetExtractor by lazy { SibnetExtractor(client) }
private val doodExtractor by lazy { DoodExtractor(client) }
private val lycorisExtractor by lazy { LycorisCafeExtractor(client) }
private val luluExtractor by lazy { LuluExtractor(client) }
private val googledriveExtractor by lazy { GoogleDriveExtractor(client, headers) }
override fun videoListParse(response: Response): List<Video> {
val videolist: List<VideoList> = json.decodeFromString(response.body.string())
val serverList = videolist.mapNotNull { player ->
var sub = player.translator_title.uppercase()
val prefix = if (player.isInverted) {
"[Odwrócone Kolory] $sub - "
} else {
"$sub - "
}
val playerName = player.player_hosting.lowercase()
if (playerName !in listOf(
"vk",
"cda",
"mp4upload",
"sibnet",
"dailymotion",
"dood",
"lycoris.cafe",
"lulustream",
"gdrive",
"google drive",
)
) {
return@mapNotNull null
}
Pair(player.player, prefix)
}
// Jeśli dodadzą opcje z mozliwością edytowania mpv to zrobić tak ze jak bedą odwrócone kolory to ustawia dane do mkv <3
return serverList.parallelCatchingFlatMapBlocking { (serverUrl, prefix) ->
when {
serverUrl.contains("vk.com") -> {
vkExtractor.videosFromUrl(serverUrl, prefix)
}
serverUrl.contains("mp4upload") -> {
mp4uploadExtractor.videosFromUrl(serverUrl, headers, prefix)
}
serverUrl.contains("cda.pl") -> {
cdaExtractor.getVideosFromUrl(serverUrl, headers, prefix)
}
serverUrl.contains("dailymotion") -> {
dailymotionExtractor.videosFromUrl(serverUrl, "$prefix Dailymotion -")
}
serverUrl.contains("sibnet.ru") -> {
sibnetExtractor.videosFromUrl(serverUrl, prefix)
}
serverUrl.contains("dood") -> {
doodExtractor.videosFromUrl(serverUrl, "$prefix Dood")
}
serverUrl.contains("lycoris.cafe") -> {
lycorisExtractor.getVideosFromUrl(serverUrl, headers, prefix)
}
serverUrl.contains("luluvdo.com") -> {
luluExtractor.videosFromUrl(serverUrl, prefix)
}
serverUrl.contains("drive.google.com") -> {
val regex = Regex("/d/([a-zA-Z0-9_-]+)")
val id = regex.find(serverUrl)?.groupValues?.get(1).toString()
googledriveExtractor.videosFromUrl(id, "${prefix}Gdrive -")
}
else -> emptyList()
}
}
}
// ============================= Utilities ==============================
override fun List<Video>.sort(): List<Video> {
val quality = preferences.getString("preferred_quality", "1080")!!
val server = preferences.getString("preferred_server", "cda.pl")!!
return this.sortedWith(
compareBy(
{ it.quality.contains(quality) },
{ it.quality.contains(server, true) },
),
).reversed()
}
override fun setupPreferenceScreen(screen: PreferenceScreen) {
val videoQualityPref = ListPreference(screen.context).apply {
key = "preferred_quality"
title = "Preferowana jakość"
entries = arrayOf("1080p", "720p", "480p", "360p")
entryValues = arrayOf("1080", "720", "480", "360")
setDefaultValue("1080")
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()
}
}
val videoServerPref = ListPreference(screen.context).apply {
key = "preferred_server"
title = "Preferowany serwer"
entries = arrayOf("cda.pl", "Dailymotion", "Mp4upload", "Sibnet", "vk.com")
entryValues = arrayOf("cda.pl", "Dailymotion", "Mp4upload", "Sibnet", "vk.com")
setDefaultValue("cda.pl")
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()
}
}
screen.addPreference(videoQualityPref)
screen.addPreference(videoServerPref)
}
@Serializable
data class ApiList(
val mal_id: Int,
val adult_content: String,
val title: String,
val title_en: String,
val slug: String,
val cover: String,
val genres: List<String>,
val broadcast_day: String?,
val aired_from: String?,
val episodes: Int,
val season: String,
val season_year: Int,
val series_type: String,
)
@Serializable
data class ApiSearch(
val mal_id: Int,
val ani_id: Int?,
val title: String,
val title_en: String,
val slug: String,
val cover: String,
val adult_content: String,
val series_type: String,
val episodes: Int,
val season: String,
val season_year: Int,
)
@Serializable
data class ApiDetail(
val id: Int,
val mal_id: Int,
val ani_id: Int?,
val adult_content: String,
val title: String,
val title_en: String,
val slug: String,
val slug_oa: String?,
val description: String,
val cover: String,
val bg: String?,
val genres: List<String>,
val broadcast_day: String?,
val aired_from: String?,
val episodes: Int,
val season: String,
val season_year: Int,
val series_type: String,
val ads: String?,
val modified: String?,
)
@Serializable
data class EpisodeList(
val anime_id: String,
val anime_episode_number: Float,
val isInverted: String,
val created_at: String,
val bg: String?,
)
@Serializable
data class VideoList(
val id: Int,
val anime_id: String,
val anime_episode_number: Float,
val player: String,
val player_hosting: String,
val created_at: String,
val translator: Boolean,
val translator_title: String,
val translator_url: String?,
val isInverted: Boolean,
val bg: String?,
)
}

View file

@ -7,11 +7,3 @@ ext {
apply from: "$rootDir/common.gradle"
dependencies {
implementation(project(':lib:dailymotion-extractor'))
implementation(project(':lib:mp4upload-extractor'))
implementation(project(':lib:sibnet-extractor'))
implementation(project(':lib:vk-extractor'))
implementation(project(':lib:googledrive-extractor'))
implementation(project(':lib:cda-extractor'))
}

View file

@ -10,17 +10,9 @@ import eu.kanade.tachiyomi.animesource.model.SAnime
import eu.kanade.tachiyomi.animesource.model.SEpisode
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource
import eu.kanade.tachiyomi.lib.cdaextractor.CdaPlExtractor
import eu.kanade.tachiyomi.lib.dailymotionextractor.DailymotionExtractor
import eu.kanade.tachiyomi.lib.mp4uploadextractor.Mp4uploadExtractor
import eu.kanade.tachiyomi.lib.sibnetextractor.SibnetExtractor
import eu.kanade.tachiyomi.lib.vkextractor.VkExtractor
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.util.parallelCatchingFlatMapBlocking
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import okhttp3.FormBody
import okhttp3.Headers
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Request
@ -57,7 +49,7 @@ class OgladajAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// ============================== Popular ===============================
override fun popularAnimeRequest(page: Int): Request {
return GET("$baseUrl/search/page/$page", headers)
return GET("$baseUrl/search/page/$page", apiHeaders)
}
override fun popularAnimeSelector(): String = "div#anime_main div.card.bg-white"
@ -72,7 +64,7 @@ class OgladajAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// =============================== Latest ===============================
override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/search/new/$page", headers)
override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/search/new/$page", apiHeaders)
override fun latestUpdatesSelector(): String = popularAnimeSelector()
@ -82,7 +74,7 @@ class OgladajAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// =============================== Search ===============================
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request = GET("$baseUrl/search/name/$query", headers)
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request = GET("$baseUrl/search/name/$query", apiHeaders)
override fun searchAnimeFromElement(element: Element): SAnime = popularAnimeFromElement(element)
@ -90,8 +82,6 @@ class OgladajAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
override fun searchAnimeNextPageSelector(): String? = null
// prosta bez filtrów jak na razie :) są dziury ale to kiedyś sie naprawi hihi. Wystarczy dobrze wyszukać animca i powinno wyszukać.
// =========================== Anime Details ============================
override fun animeDetailsParse(document: Document): SAnime {
return SAnime.create().apply {
@ -148,89 +138,25 @@ class OgladajAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
// ============================ Video Links =============================
private fun getPlayerUrl(id: String): String {
val body = FormBody.Builder()
.add("action", "change_player_url")
.add("id", id)
.build()
return client.newCall(POST("$baseUrl/manager.php", apiHeaders, body))
.execute()
.use { response ->
response.body.string()
.substringAfter("\"data\":\"")
.substringBefore("\",")
.replace("\\", "")
}
}
override fun videoListRequest(episode: SEpisode): Request {
val body = FormBody.Builder()
.add("action", "get_player_list")
.add("id", episode.url)
.build()
return POST("$baseUrl/manager.php", apiHeaders, body)
return GET("$baseUrl:8443/Player/${episode.url}", apiHeaders)
}
private val vkExtractor by lazy { VkExtractor(client, headers) }
private val cdaExtractor by lazy { CdaPlExtractor(client) }
private val mp4uploadExtractor by lazy { Mp4uploadExtractor(client) }
private val dailymotionExtractor by lazy { DailymotionExtractor(client, headers) }
private val sibnetExtractor by lazy { SibnetExtractor(client) }
override fun videoListParse(response: Response): List<Video> {
val jsonResponse = json.decodeFromString<ApiResponse>(response.body.string())
val dataObject = json.decodeFromString<ApiData>(jsonResponse.data)
val serverList = dataObject.players.mapNotNull { player ->
var sub = player.sub.uppercase()
if (player.audio == "pl") {
sub = "Lektor"
} else if (player.sub.isEmpty() && sub != "Lektor") {
sub = "Dub " + player.sub.uppercase()
}
val players = json.decodeFromString<List<ApiPlayer>>(response.body.string())
val subGroup = if (sub == player.sub_group?.uppercase()) "" else player.sub_group
val subGroupPart = if (subGroup?.isNotEmpty() == true) " $subGroup - " else " "
val prefix = if (player.ismy > 0) {
if (player.sub == "pl" && player.sub_group?.isNotEmpty() == true) {
"[Odwrócone Kolory] $subGroup - "
} else {
"[$sub/Odwrócone Kolory]$subGroupPart"
}
} else {
if (player.sub == "pl" && player.sub_group?.isNotEmpty() == true) {
"$subGroup - "
} else {
"[$sub]$subGroupPart"
}
}
if (player.url !in listOf("vk", "cda", "mp4upload", "sibnet", "dailymotion")) {
return@mapNotNull null
}
val url = getPlayerUrl(player.id)
Pair(url, prefix)
}
// Jeśli dodadzą opcje z mozliwością edytowania mpv to zrobić tak ze jak bedą odwrócone kolory to ustawia dane do mkv <3
return serverList.parallelCatchingFlatMapBlocking { (serverUrl, prefix) ->
when {
serverUrl.contains("vk.com") -> {
vkExtractor.videosFromUrl(serverUrl, prefix)
}
serverUrl.contains("mp4upload") -> {
mp4uploadExtractor.videosFromUrl(serverUrl, headers, prefix)
}
serverUrl.contains("cda.pl") -> {
cdaExtractor.getVideosFromUrl(serverUrl, headers, prefix)
}
serverUrl.contains("dailymotion") -> {
dailymotionExtractor.videosFromUrl(serverUrl, "$prefix Dailymotion -")
}
serverUrl.contains("sibnet.ru") -> {
sibnetExtractor.videosFromUrl(serverUrl, prefix)
}
else -> emptyList()
}
return players.map { player ->
val host = Regex("""https?://(?:www\.)?([^/]+)""")
.find(player.mainUrl)
?.groupValues
?.get(1)
?: "unknown-host"
Video(
url = player.mainUrl,
quality = if (player.extra == "inv") "[Odwrócone Kolory] $host - ${player.res}p" else "$host - ${player.res}p",
videoUrl = player.src,
headers = null,
)
}
}
@ -244,32 +170,23 @@ class OgladajAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
@Serializable
data class ApiPlayer(
val id: String,
val audio: String? = null,
val sub: String,
val url: String,
val sub_group: String? = null,
val ismy: Int,
)
@Serializable
data class ApiData(
val players: List<ApiPlayer>,
)
@Serializable
data class ApiResponse(
val data: String,
val mainUrl: String,
val label: String,
val res: Int,
val src: String,
val type: String,
val extra: String,
val startTime: Int,
val endTime: Int,
val ageValidation: Boolean,
val youtube: String? = null,
)
override fun List<Video>.sort(): List<Video> {
val quality = preferences.getString("preferred_quality", "1080")!!
val server = preferences.getString("preferred_server", "cda.pl")!!
return this.sortedWith(
compareBy(
{ it.quality.contains(quality) },
{ it.quality.contains(server, true) },
),
).reversed()
}
@ -290,23 +207,7 @@ class OgladajAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
preferences.edit().putString(key, entry).commit()
}
}
val videoServerPref = ListPreference(screen.context).apply {
key = "preferred_server"
title = "Preferowany serwer"
entries = arrayOf("cda.pl", "Dailymotion", "Mp4upload", "Sibnet", "vk.com")
entryValues = arrayOf("cda.pl", "Dailymotion", "Mp4upload", "Sibnet", "vk.com")
setDefaultValue("cda.pl")
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()
}
}
screen.addPreference(videoQualityPref)
screen.addPreference(videoServerPref)
}
}