[Sora] small fix for matching

This commit is contained in:
hexated 2022-12-29 10:34:20 +07:00
parent c92fa214f5
commit 57ebef9198

View file

@ -1120,7 +1120,7 @@ object SoraExtractor : SoraStream() {
subtitleCallback: (SubtitleFile) -> Unit, subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val url = if(season == null) { val url = if (season == null) {
"$uhdmoviesAPI/download-${title.fixTitle()}-$year" "$uhdmoviesAPI/download-${title.fixTitle()}-$year"
} else { } else {
val url = "$uhdmoviesAPI/?s=$title" val url = "$uhdmoviesAPI/?s=$title"
@ -1494,7 +1494,8 @@ object SoraExtractor : SoraStream() {
} }
episodeId?.apmap { (id, type) -> episodeId?.apmap { (id, type) ->
val json = app.get("$consumetCrunchyrollAPI/watch?episodeId=${id ?: return@apmap null}&format=srt") val json =
app.get("$consumetCrunchyrollAPI/watch?episodeId=${id ?: return@apmap null}&format=srt")
.parsedSafe<ConsumetSourcesResponse>() .parsedSafe<ConsumetSourcesResponse>()
json?.sources?.map source@{ source -> json?.sources?.map source@{ source ->
@ -1564,11 +1565,18 @@ object SoraExtractor : SoraStream() {
subtitleCallback: (SubtitleFile) -> Unit, subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val doc = app.get("$moviezAddAPI/?s=$title").document val fixTitle = title?.replace(":", "")
val doc = app.get("$moviezAddAPI/?s=$fixTitle").document
// TODO find better way
val matchMedia = doc.select("article.mh-loop-item").map { val matchMedia = doc.select("article.mh-loop-item").map {
it.select("a").attr("href") to it.select("a").text() it.select("a").attr("href") to it.select("a").text()
}.find { it.second.contains("$title", true) && it.first.contains("$year") } }.find {
(it.second.contains("$fixTitle", true) || it.second.contains(
"$title",
true
)) && it.first.contains("$year")
}
val detailLink = val detailLink =
app.get(matchMedia?.first ?: return).document.selectFirst("a#jake1")?.attr("href") app.get(matchMedia?.first ?: return).document.selectFirst("a#jake1")?.attr("href")
@ -1591,7 +1599,8 @@ object SoraExtractor : SoraStream() {
).document.selectFirst("a[rel=nofollow]")?.attr("href") ).document.selectFirst("a[rel=nofollow]")?.attr("href")
// val videoUrl = extractRebrandly(shortLink ?: return@apmapIndexed null ) // val videoUrl = extractRebrandly(shortLink ?: return@apmapIndexed null )
val quality = Regex("([0-9]{3,4})p").find(name)?.groupValues?.getOrNull(1)?.toIntOrNull() val quality =
Regex("([0-9]{3,4})p").find(name)?.groupValues?.getOrNull(1)?.toIntOrNull()
val qualityName = name.replace("${quality}p", "").trim() val qualityName = name.replace("${quality}p", "").trim()
callback.invoke( callback.invoke(