Fix issue with JavSub stream link

This commit is contained in:
Jace 2022-08-21 16:57:29 +08:00
parent 635e6b03a6
commit e11cdace4d

View file

@ -80,9 +80,9 @@ class JavSubProvider : MainAPI() {
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val url = "$mainUrl/?s=${query}" val url = "$mainUrl/?s=${query}"
val document = app.get(url).document.getElementsByTag("body") val document = app.get(url).document.getElementsByTag("body")
.select("main#main-content")?.select("article") .select("main#main-content").select("article")
return document?.mapNotNull { return document.mapNotNull {
if (it == null) { return@mapNotNull null } if (it == null) { return@mapNotNull null }
val innerA = it.selectFirst("div.blog-pic-wrap > a")?: return@mapNotNull null val innerA = it.selectFirst("div.blog-pic-wrap > a")?: return@mapNotNull null
val link = fixUrlNull(innerA.attr("href")) ?: return@mapNotNull null val link = fixUrlNull(innerA.attr("href")) ?: return@mapNotNull null
@ -100,7 +100,7 @@ class JavSubProvider : MainAPI() {
posterUrl = image, posterUrl = image,
year = year year = year
) )
}?.distinctBy { b -> b.url } ?: listOf() }.distinctBy { b -> b.url }
} }
override suspend fun load(url: String): LoadResponse { override suspend fun load(url: String): LoadResponse {
@ -139,7 +139,7 @@ class JavSubProvider : MainAPI() {
// JAV Info // JAV Info
tryParseJson<ResponseMovieDetails>(scriptJson)?.let { tryParseJson<ResponseMovieDetails>(scriptJson)?.let {
val contentUrl = it.contentUrl //val contentUrl = it.contentUrl
title = it.name ?: "" title = it.name ?: ""
poster = it.thumbnailUrl poster = it.thumbnailUrl
year = it.uploadDate?.take(4)?.toIntOrNull() year = it.uploadDate?.take(4)?.toIntOrNull()
@ -192,7 +192,7 @@ class JavSubProvider : MainAPI() {
?.groupValues?.get(0)?.let { iframe -> ?.groupValues?.get(0)?.let { iframe ->
innerText = iframe.trim().trim('"') innerText = iframe.trim().trim('"')
} }
Jsoup.parse(innerText)?.selectFirst("iframe")?.attr("src")?.let { server -> Jsoup.parse(innerText).selectFirst("iframe")?.attr("src")?.let { server ->
val serverLink = server.replace("\\", "").replace("\"", "") val serverLink = server.replace("\\", "").replace("\"", "")
val success = extractStreamLink(serverLink, subtitleCallback, callback) val success = extractStreamLink(serverLink, subtitleCallback, callback)
if (success) { if (success) {
@ -215,18 +215,16 @@ class JavSubProvider : MainAPI() {
if (link.isNotBlank()) { if (link.isNotBlank()) {
when { when {
link.contains("watch-jav") -> { link.contains("watch-jav") -> {
/* //TODO: Add extractor val editedLink = link.removePrefix("https://")
val extractor = FEmbed() val idx = editedLink.indexOf('/', 0) + 1
extractor.domainUrl = "embedsito.com" val finalLink = "https://embedsito.com/${editedLink.substring(idx)}"
extractor.getSafeUrl( //Log.i(this.name, "WatchJav link => $finalLink / $link")
url = link, return loadExtractor(
url = finalLink,
referer = mainUrl, referer = mainUrl,
subtitleCallback = subtitleCallback, subtitleCallback = subtitleCallback,
callback = callback callback = callback
) )
return true
*/
return false
} }
else -> { else -> {
return loadExtractor( return loadExtractor(