Skip to content

Commit

Permalink
feat(src/fr): New source: HDS (#3081)
Browse files Browse the repository at this point in the history
Co-authored-by: Secozzi <[email protected]>
  • Loading branch information
hollowshiroyuki and Secozzi authored Mar 29, 2024
1 parent 7bc4aee commit 4f8b337
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/fr/hds/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ext {
extName = 'HDS'
extClass = '.Hds'
themePkg = 'dooplay'
baseUrl = 'https://www.hds.quest'
overrideVersionCode = 0
}

apply from: "$rootDir/common.gradle"

dependencies {
implementation(project(':lib:filemoon-extractor'))
implementation(project(':lib:streamhidevid-extractor'))
}
Binary file added src/fr/hds/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/fr/hds/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/fr/hds/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/fr/hds/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/fr/hds/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions src/fr/hds/src/eu/kanade/tachiyomi/animeextension/fr/hds/Hds.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package eu.kanade.tachiyomi.animeextension.fr.hds

import eu.kanade.tachiyomi.animesource.model.SAnime
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.lib.filemoonextractor.FilemoonExtractor
import eu.kanade.tachiyomi.lib.streamhidevidextractor.StreamHideVidExtractor
import eu.kanade.tachiyomi.multisrc.dooplay.DooPlay
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.asJsoup
import eu.kanade.tachiyomi.util.parallelCatchingFlatMapBlocking
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import okhttp3.Response
import org.jsoup.nodes.Document
import uy.kohesive.injekt.injectLazy

class Hds : DooPlay(
"fr",
"HDS",
"https://www.hds.quest",
) {

private val json: Json by injectLazy()

// ============================== Popular ===============================
override fun popularAnimeRequest(page: Int) = GET("$baseUrl/tendance/page/$page/", headers)

override fun popularAnimeSelector() = latestUpdatesSelector()

override fun popularAnimeNextPageSelector() = "#nextpagination"

// =============================== Latest ===============================
override val supportsLatest = false

// =============================== Search ===============================
override fun searchAnimeNextPageSelector() = popularAnimeNextPageSelector()

// ============================== Filters ===============================
override fun genresListSelector() = ".genres.scrolling li a"

// =========================== Anime Details ============================
override fun animeDetailsParse(document: Document) = super.animeDetailsParse(document).apply {
if (document.select(".dt-breadcrumb li:nth-child(2)").text() == "Films") {
status = SAnime.COMPLETED
}
}

// ============================ Video Links =============================
@Serializable
data class VideoLinkDTO(@SerialName("embed_url") val url: String)

private val fileMoonExtractor by lazy { FilemoonExtractor(client) }
private val streamHideVidExtractor by lazy { StreamHideVidExtractor(client) }

override fun videoListParse(response: Response): List<Video> {
val document = response.asJsoup()
val players = document.select("#playeroptions li:not(#player-option-trailer)")
return players.parallelCatchingFlatMapBlocking { it ->
val post = it.attr("data-post")
val nume = it.attr("data-nume")
val type = it.attr("data-type")
val raw = client.newCall(GET("$baseUrl/wp-json/dooplayer/v1/post/$post?type=$type&source=$nume", headers))
.execute()
.body.string()
val securedUrl = json.decodeFromString<VideoLinkDTO>(raw).url
val playerUrl = client.newCall(GET(securedUrl, headers)).execute().use { it.request.url.toString() }
when {
playerUrl.contains("sentinel") -> fileMoonExtractor.videosFromUrl(playerUrl)
playerUrl.contains("hdsplay.online") -> streamHideVidExtractor.videosFromUrl(playerUrl)
else -> emptyList()
}
}
}
}

0 comments on commit 4f8b337

Please sign in to comment.