committed by
GitHub
parent
4082065eac
commit
be441f9cd0
@ -5,9 +5,13 @@ ext {
|
||||
extName = 'Onepace'
|
||||
pkgNameSuffix = 'all.onepace'
|
||||
extClass = '.OnepaceFactory'
|
||||
extVersionCode = 7
|
||||
extVersionCode = 8
|
||||
libVersion = '13'
|
||||
containsNsfw = false
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly libs.bundles.coroutines
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
@ -129,20 +129,10 @@ open class Onepace(override val lang: String, override val name: String) : Confi
|
||||
override fun episodeFromElement(element: Element) = throw Exception("not used")
|
||||
|
||||
override fun videoListParse(response: Response): List<Video> {
|
||||
// This is a shit but work
|
||||
val realUrl = "https:" + response.request.url.toString().substringAfter("%23")
|
||||
val hostUrl = realUrl.substringBefore("/v/")
|
||||
val document = client.newCall(GET(realUrl)).execute().asJsoup()
|
||||
// ZippyShare Scraper
|
||||
val jscript = document.selectFirst("script:containsData(asdasd)").data()
|
||||
val a = jscript.substringAfter("var a = ").substringBefore(";").toInt()
|
||||
val firstB = jscript.substringAfter(".substr(").substringBefore(",").toInt()
|
||||
val b = jscript.substringAfter(".substr($firstB, ").substringBefore(")").toInt() - firstB
|
||||
|
||||
val videoId = realUrl.substringAfter("/v/").substringBefore("/file")
|
||||
val videoName = jscript.substringAfter("+\"").substringBefore("\";")
|
||||
val videoUrl = "$hostUrl/d/$videoId/${(Math.pow(a.toDouble(),b.toDouble()).toInt() + b)}$videoName"
|
||||
|
||||
val videoUrlD = ZippyExtractor().getVideoUrl(realUrl, json)
|
||||
val videoUrl = hostUrl + videoUrlD
|
||||
return listOf(Video(videoUrl, "ZippyShare", videoUrl))
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,28 @@
|
||||
package eu.kanade.tachiyomi.animeextension.all.onepace
|
||||
|
||||
import app.cash.quickjs.QuickJs
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import kotlinx.serialization.json.jsonPrimitive
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
class ZippyExtractor {
|
||||
fun getVideoUrl(url: String, json: Json): String {
|
||||
val document = Jsoup.connect(url).get()
|
||||
val jscript = document.selectFirst("script:containsData(dlbutton)").data()
|
||||
.replace("document.getElementById('dlbutton').href", "a")
|
||||
.replace("document.getElementById('fimage').href", "b")
|
||||
.replace("document.getElementById('fimage')", "false")
|
||||
val quickjs = QuickJs.create()
|
||||
val objectA = quickjs.evaluate(objectScript(jscript)).toString()
|
||||
quickjs.close()
|
||||
return json.decodeFromString<JsonObject>(objectA)["a"]!!.jsonPrimitive.content
|
||||
}
|
||||
|
||||
private fun objectScript(script: String) = """
|
||||
$script;
|
||||
let return_object = {a:a};
|
||||
JSON.stringify(return_object);
|
||||
"""
|
||||
}
|
Reference in New Issue
Block a user