Skip to content

Commit

Permalink
fix(multisrc/animestream): Make getHosterUrl function less error-pron…
Browse files Browse the repository at this point in the history
…e + small fix to id/minioppai (#2439)
  • Loading branch information
Claudemirovsky authored Oct 30, 2023
1 parent e318970 commit a9d4136
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MiniOppaiExtractor(private val client: OkHttpClient) {
return scriptData.getItems("sources", baseUrl) { videoUrl, quality ->
val videoQuality = "MiniOppai - $quality"
Video(videoUrl, videoQuality, videoUrl, headers, subtitleTracks = subs)
}
}.filterNot { it.url.contains("/uploads/unavailable.mp4") }
}

// time to over-engineer things for no reason at all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,17 @@ abstract class AnimeStream(
client.newCall(GET(encodedData, headers)).execute().use { it.asJsoup() }
}

return doc.selectFirst("iframe[src~=.]")?.attr("abs:src")
?: doc.selectFirst("meta[content~=.][itemprop=embedUrl]")!!.attr("abs:content")
return doc.selectFirst("iframe[src~=.]")?.safeUrl()
?: doc.selectFirst("meta[content~=.][itemprop=embedUrl]")!!.safeUrl("content")
}

private fun Element.safeUrl(attribute: String = "src"): String {
val value = attr(attribute)
return when {
value.startsWith("http") -> value
value.startsWith("//") -> "https:$value"
else -> absUrl(attribute).ifEmpty { value }
}
}

protected open fun getVideoList(url: String, name: String): List<Video> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AnimeStreamGenerator : ThemeSourceGenerator {
SingleLang("Hstream", "https://hstream.moe", "en", isNsfw = true, overrideVersionCode = 3),
SingleLang("LMAnime", "https://lmanime.com", "all", isNsfw = false, overrideVersionCode = 4),
SingleLang("LuciferDonghua", "https://luciferdonghua.in", "en", isNsfw = false, overrideVersionCode = 2),
SingleLang("MiniOppai", "https://minioppai.org", "id", isNsfw = true, overrideVersionCode = 2),
SingleLang("MiniOppai", "https://minioppai.org", "id", isNsfw = true, overrideVersionCode = 3),
SingleLang("RineCloud", "https://rine.cloud", "pt-BR", isNsfw = false, overrideVersionCode = 3),
SingleLang("TRAnimeCI", "https://tranimeci.com", "tr", isNsfw = false),
)
Expand Down

0 comments on commit a9d4136

Please sign in to comment.