chore(it/StreamingCommunity): video-list empty and change domain (#132)

* chore(src/es): Change Domain on Hackstore and add VidHideExtractor

* chore(src/ar): fix VideoListParse on Anime4up

* fix(es/PelisplusHD): Change parallelCatchingFlatMapBlocking to flatMap

* chore(it/StreamingCommunity): video-list empty and change domain
This commit is contained in:
Dark25 2024-08-13 11:03:24 +01:00 committed by GitHub
parent 8b2fed2aff
commit 355911204d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 63 deletions

View file

@ -1,7 +1,7 @@
ext { ext {
extName = 'StreamingCommunity' extName = 'StreamingCommunity'
extClass = '.StreamingCommunity' extClass = '.StreamingCommunity'
extVersionCode = 4 extVersionCode = 5
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View file

@ -30,7 +30,7 @@ class StreamingCommunity : ConfigurableAnimeSource, AnimeHttpSource() {
override val name = "StreamingCommunity" override val name = "StreamingCommunity"
override val baseUrl = "https://streamingcommunity.forum" override val baseUrl = "https://streamingcommunity.photos"
override val lang = "it" override val lang = "it"
@ -254,72 +254,40 @@ class StreamingCommunity : ConfigurableAnimeSource, AnimeHttpSource() {
// ============================ Video Links ============================= // ============================ Video Links =============================
override suspend fun getVideoList(episode: SEpisode): List<Video> { override suspend fun getVideoList(episode: SEpisode): List<Video> {
val videoList = mutableListOf<Video>() val videoSet = mutableSetOf<Video>()
val doc = val doc = client.newCall(
client GET("$baseUrl/iframe/${episode.url}", headers),
.newCall( ).execute().asJsoup()
GET("$baseUrl/iframe/${episode.url}", headers),
).execute()
.asJsoup()
val iframeUrl =
doc.selectFirst("iframe[src]")?.attr("abs:src")
?: error("Failed to extract iframe")
val iframeHeaders =
headers
.newBuilder()
.add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8")
.add("Host", iframeUrl.toHttpUrl().host)
.add("Referer", "$baseUrl/")
.build()
val iframe = val iframeUrl = doc.selectFirst("iframe[src]")?.attr("abs:src")
client ?: error("Failed to extract iframe")
.newCall(
GET(iframeUrl, headers = iframeHeaders), val iframeHeaders = headers.newBuilder()
).execute() .add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8")
.asJsoup() .add("Host", iframeUrl.toHttpUrl().host)
.add("Referer", "$baseUrl/")
.build()
val iframe = client.newCall(GET(iframeUrl, headers = iframeHeaders)).execute().asJsoup()
val script = iframe.selectFirst("script:containsData(masterPlaylist)")!!.data().replace("\n", "\t") val script = iframe.selectFirst("script:containsData(masterPlaylist)")!!.data().replace("\n", "\t")
var playlistUrl = PLAYLIST_URL_REGEX.find(script)!!.groupValues[1] val playlistUrl = PLAYLIST_URL_REGEX.find(script)!!.groupValues[1]
val filename = playlistUrl.substringAfterLast("/")
if (!filename.endsWith(".m3u8")) {
playlistUrl = playlistUrl.replace(filename, filename + ".m3u8")
}
val expires = EXPIRES_REGEX.find(script)!!.groupValues[1]
val token = TOKEN_REGEX.find(script)!!.groupValues[1] val token = TOKEN_REGEX.find(script)!!.groupValues[1]
val expires = EXPIRES_REGEX.find(script)!!.groupValues[1]
// Get subtitles val masterPlUrl = "$playlistUrl&token=$token&expires=$expires&b=1"
val masterPlUrl = "$playlistUrl?token=$token&expires=$expires&n=1"
val masterPl =
client
.newCall(GET(masterPlUrl))
.execute()
.body
.string()
val subList =
SUBTITLES_REGEX.findAll(masterPl)
.map {
Track(it.groupValues[2], it.groupValues[1])
}.toList()
TOKEN_QUALITY_REGEX.findAll(script).forEach { match ->
val quality = match.groupValues[1]
val videoUrl = val masterPl = client.newCall(GET(masterPlUrl)).execute().body.string()
buildString { val subList = SUBTITLES_REGEX.findAll(masterPl).map {
append(playlistUrl) Track(it.groupValues[2], it.groupValues[1])
append("?type=video&rendition=") }.toList()
append(quality) QUALITY_REGEX.findAll(masterPl).forEach { match ->
append("&token=") val quality = "${match.groupValues[1]}p"
append(match.groupValues[2]) val videoUrl = match.groupValues[2]
append("&expires=$expires") videoSet.add(Video(videoUrl, quality, videoUrl, subtitleTracks = subList))
append("&n=1")
}
videoList.add(Video(videoUrl, quality, videoUrl, subtitleTracks = subList))
} }
require(videoSet.isNotEmpty()) { "Failed to fetch videos" }
require(videoList.isNotEmpty()) { "Failed to fetch videos" } return videoSet.toList().sortedBy { it.quality }
return videoList.sort()
} }
override fun videoListRequest(episode: SEpisode): Request = throw Exception("Not used") override fun videoListRequest(episode: SEpisode): Request = throw Exception("Not used")
@ -359,10 +327,10 @@ class StreamingCommunity : ConfigurableAnimeSource, AnimeHttpSource() {
private val PLAYLIST_URL_REGEX = Regex("""url: ?'(.*?)'""") private val PLAYLIST_URL_REGEX = Regex("""url: ?'(.*?)'""")
private val EXPIRES_REGEX = Regex("""'expires': ?'(\d+)'""") private val EXPIRES_REGEX = Regex("""'expires': ?'(\d+)'""")
private val TOKEN_REGEX = Regex("""'token': ?'([\w-]+)'""") private val TOKEN_REGEX = Regex("""'token': ?'([\w-]+)'""")
private val TOKEN_QUALITY_REGEX = Regex("""'token(\d+p?)': ?'([\w-]+)'""") private val QUALITY_REGEX = Regex("""RESOLUTION=.*?x(.*).*?\n(.*)""")
private val SUBTITLES_REGEX = Regex("""#EXT-X-MEDIA:TYPE=SUBTITLES.*?NAME="(.*?)".*?URI="(.*?)"""") private val SUBTITLES_REGEX = Regex("""#EXT-X-MEDIA:TYPE=SUBTITLES.*?NAME="(.*?)".*?URI="(.*?)"""")
private const val PREF_QUALITY_KEY = "preferred_quality" private const val PREF_QUALITY_KEY = "preferred_quality"
private const val PREF_QUALITY_DEFAULT = "720" private const val PREF_QUALITY_DEFAULT = "1080"
} }
// ============================== Settings ============================== // ============================== Settings ==============================