Initial commit
This commit is contained in:
commit
98ed7e8839
2263 changed files with 108711 additions and 0 deletions
14
src/en/donghuastream/build.gradle
Normal file
14
src/en/donghuastream/build.gradle
Normal file
|
@ -0,0 +1,14 @@
|
|||
ext {
|
||||
extName = 'DonghuaStream'
|
||||
extClass = '.DonghuaStream'
|
||||
themePkg = 'animestream'
|
||||
baseUrl = 'https://donghuastream.co.in'
|
||||
overrideVersionCode = 6
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
||||
dependencies {
|
||||
implementation(project(':lib:dailymotion-extractor'))
|
||||
implementation(project(':lib:playlist-utils'))
|
||||
}
|
BIN
src/en/donghuastream/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
src/en/donghuastream/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.8 KiB |
BIN
src/en/donghuastream/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
src/en/donghuastream/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
src/en/donghuastream/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
src/en/donghuastream/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
src/en/donghuastream/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
src/en/donghuastream/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
BIN
src/en/donghuastream/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
src/en/donghuastream/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
|
@ -0,0 +1,41 @@
|
|||
package eu.kanade.tachiyomi.animeextension.en.donghuastream
|
||||
|
||||
import eu.kanade.tachiyomi.animeextension.en.donghuastream.extractors.StreamPlayExtractor
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.lib.dailymotionextractor.DailymotionExtractor
|
||||
import eu.kanade.tachiyomi.multisrc.animestream.AnimeStream
|
||||
|
||||
class DonghuaStream : AnimeStream(
|
||||
"en",
|
||||
"DonghuaStream",
|
||||
"https://donghuastream.co.in",
|
||||
) {
|
||||
override val fetchFilters: Boolean
|
||||
get() = false
|
||||
|
||||
// ============================ Video Links =============================
|
||||
|
||||
private val dailymotionExtractor by lazy { DailymotionExtractor(client, headers) }
|
||||
private val streamPlayExtractor by lazy { StreamPlayExtractor(client, headers) }
|
||||
|
||||
override fun getVideoList(url: String, name: String): List<Video> {
|
||||
val prefix = "$name - "
|
||||
return when {
|
||||
url.contains("dailymotion") -> dailymotionExtractor.videosFromUrl(url, prefix = prefix)
|
||||
url.contains("streamplay") -> streamPlayExtractor.videosFromUrl(url, prefix = prefix)
|
||||
else -> emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
// ============================= Utilities ==============================
|
||||
|
||||
override fun List<Video>.sort(): List<Video> {
|
||||
val quality = preferences.getString(videoSortPrefKey, videoSortPrefDefault)!!
|
||||
return sortedWith(
|
||||
compareBy(
|
||||
{ it.quality.contains(quality) },
|
||||
{ Regex("""(\d+)p""").find(it.quality)?.groupValues?.get(1)?.toIntOrNull() ?: 0 },
|
||||
),
|
||||
).reversed()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package eu.kanade.tachiyomi.animeextension.en.donghuastream.extractors
|
||||
|
||||
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.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import eu.kanade.tachiyomi.util.parseAs
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.OkHttpClient
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class StreamPlayExtractor(private val client: OkHttpClient, private val headers: Headers) {
|
||||
|
||||
private val json: Json by injectLazy()
|
||||
|
||||
private val playlistUtils by lazy { PlaylistUtils(client, headers) }
|
||||
|
||||
fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
|
||||
val document = client.newCall(
|
||||
GET(url, headers),
|
||||
).execute().asJsoup()
|
||||
|
||||
val apiUrl = document.selectFirst("script:containsData(/api/)")
|
||||
?.data()
|
||||
?.substringAfter("url:")
|
||||
?.substringAfter("\"")
|
||||
?.substringBefore("\"")
|
||||
?: return emptyList()
|
||||
|
||||
val apiHeaders = headers.newBuilder().apply {
|
||||
add("Accept", "application/json, text/javascript, */*; q=0.01")
|
||||
add("Host", apiUrl.toHttpUrl().host)
|
||||
add("Referer", url)
|
||||
add("X-Requested-With", "XMLHttpRequest")
|
||||
}.build()
|
||||
|
||||
val apiResponse = client.newCall(
|
||||
GET("$apiUrl&_=${System.currentTimeMillis() / 1000}", headers = apiHeaders),
|
||||
).execute().parseAs<APIResponse>()
|
||||
|
||||
val subtitleList = apiResponse.tracks?.let { t ->
|
||||
t.map { Track(it.file, it.label) }
|
||||
} ?: emptyList()
|
||||
|
||||
return apiResponse.sources.flatMap { source ->
|
||||
val sourceUrl = source.file.replace("^//".toRegex(), "https://")
|
||||
playlistUtils.extractFromHls(sourceUrl, referer = url, subtitleList = subtitleList, videoNameGen = { q -> "$prefix$q (StreamPlay)" })
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class APIResponse(
|
||||
val sources: List<SourceObject>,
|
||||
val tracks: List<TrackObject>? = null,
|
||||
) {
|
||||
@Serializable
|
||||
data class SourceObject(
|
||||
val file: String,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class TrackObject(
|
||||
val file: String,
|
||||
val label: String,
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue