otakudesu: update zippy parser (#199)

This commit is contained in:
Luft21
2021-12-19 20:19:28 +07:00
committed by GitHub
parent bace3dafeb
commit b69b0780a9
2 changed files with 7 additions and 9 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'OtakuDesu'
pkgNameSuffix = 'id.otakudesu'
extClass = '.OtakuDesu'
extVersionCode = 7
extVersionCode = 8
libVersion = '12'
}

View File

@ -210,17 +210,15 @@ class OtakuDesu : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
return this
}
override fun videoFromElement(element: Element): Video {
override fun videoFromElement(element: Element): Video {
val res = client.newCall(GET(element.attr("href"))).execute().asJsoup()
val scr = res.select("script:containsData(dlbutton)").html()
var url = element.attr("href").substringBefore("/v/")
val firstString = scr.substringAfter(" = \"").substringBefore("\" + ")
val num1 = scr.substringAfter("+ (").substringBefore(" % ").toInt()
val num2 = scr.substringAfter(" % ").substringBefore(" + ").toInt()
val num4 = scr.substringAfter(" % ").substringBefore(") + ").substringAfter(" % ").toInt()
val lastString = scr.substringAfter(") + \"").substringBefore("\";")
val num = (num1 % num2) + (num1 % num4)
url += firstString + num.toString() + lastString
val firstString = scr.substringAfter(" = \"").substringBefore("\"+(")
val num = scr.substringAfter("n = ").substringBefore("%2;").toInt()
val lastString = scr.substringAfter("3)+\"").substringBefore("\";")
val nums = (num % 2) + (num % 3) + num
url += firstString + nums.toString() + lastString
val quality = with(url) {
when {
contains("1080p") -> "1080p"