parent
5fda10228b
commit
ee91ca7c1f
|
@ -23,8 +23,4 @@ public class Duktape implements Closeable {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized <T> T get(final String name, final Class<T> type) {
|
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -5,13 +5,12 @@ ext {
|
||||||
appName = 'Tachiyomi: TuMangaOnline'
|
appName = 'Tachiyomi: TuMangaOnline'
|
||||||
pkgNameSuffix = 'es.tumangaonline'
|
pkgNameSuffix = 'es.tumangaonline'
|
||||||
extClass = '.TuMangaOnline'
|
extClass = '.TuMangaOnline'
|
||||||
extVersionCode = 5
|
extVersionCode = 6
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':lib-ratelimit')
|
implementation project(':lib-ratelimit')
|
||||||
compileOnly project(':duktape-stub')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -11,7 +11,6 @@ import org.jsoup.nodes.Element
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import com.squareup.duktape.Duktape
|
|
||||||
|
|
||||||
class TuMangaOnline : ParsedHttpSource() {
|
class TuMangaOnline : ParsedHttpSource() {
|
||||||
|
|
||||||
|
@ -207,46 +206,17 @@ class TuMangaOnline : ParsedHttpSource() {
|
||||||
return GET(url, headers)
|
return GET(url, headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun pageListParse(response: Response): List<Page> = mutableListOf<Page>().apply {
|
||||||
val pages = mutableListOf<Page>()
|
val body = response.asJsoup()
|
||||||
val body = response.body()!!.string()
|
|
||||||
var images = ""
|
|
||||||
val script = """
|
|
||||||
function chapterInit(data) {
|
|
||||||
pipe = "|";
|
|
||||||
idsR = /img_[^\.^;]+\.src\s*=\s*"([^"]+)/gm;
|
|
||||||
idData = ""
|
|
||||||
do {
|
|
||||||
m = idsR.exec(data);
|
|
||||||
if (m) {
|
|
||||||
idData = idData + pipe + m[1] ;
|
|
||||||
}
|
|
||||||
} while (m);
|
|
||||||
return idData;
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
Duktape.create().use {
|
body.select("div#viewer-container > div.viewer-image-container > img.viewer-image")?.forEach {
|
||||||
it.evaluate(script)
|
add(Page(size, "", it.attr("src")))
|
||||||
|
|
||||||
val chapterInit = it.get("chapterInit", JSIn::class.java)
|
|
||||||
images = chapterInit.call(true, body)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
images.split("|").forEachIndexed { index, element ->
|
|
||||||
if (element.isNotEmpty()) {
|
|
||||||
pages.add(Page(index, baseUrl, element))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pages
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(document: Document) = throw UnsupportedOperationException("Not used")
|
override fun pageListParse(document: Document) = throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
override fun imageUrlRequest(page: Page): Request {
|
override fun imageUrlRequest(page: Page) = GET(page.url, headers)
|
||||||
return GET(page.url, headers)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used")
|
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
|
@ -369,9 +339,4 @@ class TuMangaOnline : ParsedHttpSource() {
|
||||||
Filter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) {
|
Filter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) {
|
||||||
fun toUriPart() = vals[state].second
|
fun toUriPart() = vals[state].second
|
||||||
}
|
}
|
||||||
|
|
||||||
internal interface JSIn {
|
|
||||||
fun call(b: Boolean, data: String): String
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue