fix(pt/goanimes): Fix video extraction (#3079)
This commit is contained in:
parent
8bedaa3063
commit
419d9a7a64
@ -3,7 +3,7 @@ ext {
|
|||||||
extClass = '.GoAnimes'
|
extClass = '.GoAnimes'
|
||||||
themePkg = 'dooplay'
|
themePkg = 'dooplay'
|
||||||
baseUrl = 'https://goanimes.net'
|
baseUrl = 'https://goanimes.net'
|
||||||
overrideVersionCode = 11
|
overrideVersionCode = 12
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,6 @@ class GoAnimes : DooPlay(
|
|||||||
.replace("SD", "480p")
|
.replace("SD", "480p")
|
||||||
val url = getPlayerUrl(player)
|
val url = getPlayerUrl(player)
|
||||||
return when {
|
return when {
|
||||||
"player5.goanimes.net" in url -> goanimesExtractor.videosFromUrl(url, name)
|
|
||||||
"https://gojopoolt" in url -> {
|
"https://gojopoolt" in url -> {
|
||||||
val headers = headers.newBuilder()
|
val headers = headers.newBuilder()
|
||||||
.set("referer", url)
|
.set("referer", url)
|
||||||
@ -129,7 +128,7 @@ class GoAnimes : DooPlay(
|
|||||||
listOf("/bloggerjwplayer", "/m3u8", "/multivideo").any { it in url } -> {
|
listOf("/bloggerjwplayer", "/m3u8", "/multivideo").any { it in url } -> {
|
||||||
val script = client.newCall(GET(url)).await()
|
val script = client.newCall(GET(url)).await()
|
||||||
.body.string()
|
.body.string()
|
||||||
.let(JsDecoder::decodeScript)
|
.let { JsDecoder.decodeScript(it, true).ifBlank { JsDecoder.decodeScript(it, false).ifBlank { it } } }
|
||||||
when {
|
when {
|
||||||
"/bloggerjwplayer" in url ->
|
"/bloggerjwplayer" in url ->
|
||||||
BloggerJWPlayerExtractor.videosFromScript(script)
|
BloggerJWPlayerExtractor.videosFromScript(script)
|
||||||
@ -145,7 +144,7 @@ class GoAnimes : DooPlay(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
"www.blogger.com" in url -> bloggerExtractor.videosFromUrl(url, headers)
|
"www.blogger.com" in url -> bloggerExtractor.videosFromUrl(url, headers)
|
||||||
else -> emptyList<Video>()
|
else -> goanimesExtractor.videosFromUrl(url, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,16 @@ class GoAnimesExtractor(private val client: OkHttpClient, private val headers: H
|
|||||||
fun videosFromUrl(url: String, name: String): List<Video> {
|
fun videosFromUrl(url: String, name: String): List<Video> {
|
||||||
val body = client.newCall(GET(url, headers)).execute()
|
val body = client.newCall(GET(url, headers)).execute()
|
||||||
.body.string()
|
.body.string()
|
||||||
|
|
||||||
|
val decodedBody = JsUnpacker.unpackAndCombine(body)
|
||||||
|
?: JsDecoder.decodeScript(body, false).takeIf(String::isNotEmpty)
|
||||||
|
?: JsDecoder.decodeScript(body, true).takeIf(String::isNotEmpty)
|
||||||
|
?: body
|
||||||
|
|
||||||
|
val partialName = name.split('-').first().trim()
|
||||||
|
val resolution = name.split('-').last().trim()
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
"better-go.fun/player.php" in url || "/profix/player.php" in url ->
|
|
||||||
PlaylistExtractor.videosFromScript(body, name.split('-').first().trim())
|
|
||||||
"/proxy/v.php" in url -> {
|
"/proxy/v.php" in url -> {
|
||||||
val playlistUrl = JsUnpacker.unpackAndCombine(body)
|
val playlistUrl = JsUnpacker.unpackAndCombine(body)
|
||||||
?.substringAfterLast("player(\\'", "")
|
?.substringAfterLast("player(\\'", "")
|
||||||
@ -25,7 +32,11 @@ class GoAnimesExtractor(private val client: OkHttpClient, private val headers: H
|
|||||||
?.takeIf(String::isNotEmpty)
|
?.takeIf(String::isNotEmpty)
|
||||||
?: return emptyList()
|
?: return emptyList()
|
||||||
|
|
||||||
playlistUtils.extractFromHls(playlistUrl, url, videoNameGen = { "$name - $it" })
|
playlistUtils.extractFromHls(
|
||||||
|
playlistUrl,
|
||||||
|
url,
|
||||||
|
videoNameGen = { "$partialName - ${it.replace("Video", resolution)}" },
|
||||||
|
)
|
||||||
}
|
}
|
||||||
"/proxy/api3/" in url -> {
|
"/proxy/api3/" in url -> {
|
||||||
val playlistUrl = body.substringAfter("sources:", "")
|
val playlistUrl = body.substringAfter("sources:", "")
|
||||||
@ -43,7 +54,24 @@ class GoAnimesExtractor(private val client: OkHttpClient, private val headers: H
|
|||||||
}
|
}
|
||||||
|
|
||||||
val referer = url.toHttpUrl().queryParameter("url") ?: url
|
val referer = url.toHttpUrl().queryParameter("url") ?: url
|
||||||
playlistUtils.extractFromHls(fixedUrl, referer, videoNameGen = { "$name - $it" })
|
playlistUtils.extractFromHls(
|
||||||
|
fixedUrl,
|
||||||
|
referer,
|
||||||
|
videoNameGen = { "$partialName - ${it.replace("Video", resolution)}" },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
"jwplayer" in decodedBody && "sources:" in decodedBody -> {
|
||||||
|
val videos = PlaylistExtractor.videosFromScript(decodedBody, partialName)
|
||||||
|
|
||||||
|
if ("label:" !in decodedBody && videos.size === 1) {
|
||||||
|
return playlistUtils.extractFromHls(
|
||||||
|
videos[0].url,
|
||||||
|
url,
|
||||||
|
videoNameGen = { "$partialName - ${it.replace("Video", resolution)}" },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
videos
|
||||||
}
|
}
|
||||||
else -> emptyList()
|
else -> emptyList()
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,19 @@ object PlaylistExtractor {
|
|||||||
val sources = script.substringAfter("sources: [").substringBefore("],")
|
val sources = script.substringAfter("sources: [").substringBefore("],")
|
||||||
|
|
||||||
return sources.split("{").drop(1).mapNotNull { source ->
|
return sources.split("{").drop(1).mapNotNull { source ->
|
||||||
val url = source.substringAfter("file:").substringAfter('"').substringBefore('"')
|
val url = source.substringAfter("file:")
|
||||||
.ifEmpty { return@mapNotNull null }
|
.substringAfter('"', "")
|
||||||
|
.substringBefore('"', "")
|
||||||
|
.takeIf(String::isNotEmpty)
|
||||||
|
?: source.substringAfter("file:")
|
||||||
|
.substringAfter("'", "")
|
||||||
|
.substringBefore("'", "")
|
||||||
|
.takeIf(String::isNotEmpty)
|
||||||
|
|
||||||
|
if (url.isNullOrBlank()) {
|
||||||
|
return@mapNotNull null
|
||||||
|
}
|
||||||
|
|
||||||
val label = source.substringAfter("label:").substringAfter('"').substringBefore('"')
|
val label = source.substringAfter("label:").substringAfter('"').substringBefore('"')
|
||||||
.replace("FHD", "1080p")
|
.replace("FHD", "1080p")
|
||||||
.replace("HD", "720p")
|
.replace("HD", "720p")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user