TMO Update (#2012)

TMO Update
This commit is contained in:
happywillow0 2020-01-08 20:52:34 -05:00 committed by arkon
parent 701cb74b2f
commit cb3405e19e
2 changed files with 19 additions and 4 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: TuMangaOnline' appName = 'Tachiyomi: TuMangaOnline'
pkgNameSuffix = 'es.tumangaonline' pkgNameSuffix = 'es.tumangaonline'
extClass = '.TuMangaOnline' extClass = '.TuMangaOnline'
extVersionCode = 15 extVersionCode = 16
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -291,13 +291,28 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
} }
override fun pageListParse(response: Response): List<Page> = mutableListOf<Page>().apply { override fun pageListParse(response: Response): List<Page> = mutableListOf<Page>().apply {
val chapterID = response.request().url().toString().substringAfter("viewer/").substringBefore("/cascade")
val body = response.asJsoup() val body = response.asJsoup()
body.select("div#viewer-container > div.viewer-image-container > img.viewer-image")?.forEach { //alternative lookup img.viewer-image:eq(1)
add(Page(size, "", it.attr("src"))) body.select("div#viewer-container > div.viewer-image-container > img.viewer-image[src*=$chapterID]:not([style=display:none;])")?.forEach {
add(Page(size, "", getImage(it)))
} }
} }
private fun getImage(element: Element): String {
var url =
when {
element.attr("data-src").endsWith(".jpg") || element.attr("data-src").endsWith(".png") || element.attr("data-src").endsWith(".jpeg") -> element.attr("data-src")
element.attr("src").endsWith(".jpg") || element.attr("src").endsWith(".png") || element.attr("src").endsWith(".jpeg") -> element.attr("src")
else -> throw Exception("Extension needs update, post issue to GitHub") //element.attr("data-lazy-src")
}
if (url.startsWith("//")) {
url = "http:$url"
}
return url
}
override fun pageListParse(document: Document) = throw UnsupportedOperationException("Not used") override fun pageListParse(document: Document) = throw UnsupportedOperationException("Not used")
override fun imageUrlRequest(page: Page) = GET(page.url, headers) override fun imageUrlRequest(page: Page) = GET(page.url, headers)