parent
49228e0114
commit
fbcabbc15a
|
@ -5,8 +5,13 @@ ext {
|
||||||
appName = 'Tachiyomi: Mangahasu'
|
appName = 'Tachiyomi: Mangahasu'
|
||||||
pkgNameSuffix = 'en.mangahasu'
|
pkgNameSuffix = 'en.mangahasu'
|
||||||
extClass = '.Mangahasu'
|
extClass = '.Mangahasu'
|
||||||
extVersionCode = 5
|
extVersionCode = 6
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly 'com.google.code.gson:gson:2.8.5'
|
||||||
|
compileOnly 'com.github.salomonbrys.kotson:kotson:2.5.0'
|
||||||
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package eu.kanade.tachiyomi.extension.en.mangahasu
|
package eu.kanade.tachiyomi.extension.en.mangahasu
|
||||||
|
|
||||||
|
import android.util.Base64
|
||||||
|
import com.github.salomonbrys.kotson.*
|
||||||
|
import com.google.gson.JsonParser
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
|
@ -112,12 +115,31 @@ class Mangahasu: ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
val pages = mutableListOf<Page>()
|
|
||||||
var i = 0
|
//Grab All Pages from site
|
||||||
document.select("div.img img").forEach { element ->
|
//Some images are place holders on new chapters.
|
||||||
i++
|
|
||||||
pages.add(Page(i, "", element.attr("src")))
|
val pages = mutableListOf<Page>().apply {
|
||||||
|
document.select("div.img img").forEach {
|
||||||
|
val pageNumber = it.attr("class").substringAfter("page").toInt()
|
||||||
|
add(Page(pageNumber,"",it.attr("src")))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Some images are not yet loaded onto Mangahasu's image server.
|
||||||
|
//Decode temporary URLs and replace placeholder images.
|
||||||
|
|
||||||
|
val lstDUrls = document.select("script:containsData(lstDUrls)").html().substringAfter("lstDUrls").substringAfter("\"").substringBefore("\"")
|
||||||
|
if (lstDUrls != "W10="){ //Base64 = [] or empty file
|
||||||
|
val decoded = String(Base64.decode(lstDUrls,Base64.DEFAULT))
|
||||||
|
val json = JsonParser().parse(decoded).array
|
||||||
|
json.forEach {
|
||||||
|
val pageNumber = it["page"].int
|
||||||
|
pages.removeAll { page -> page.index == pageNumber }
|
||||||
|
pages.add(Page(pageNumber,"",it["url"].string))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pages.sortBy { page -> page.index }
|
||||||
return pages
|
return pages
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue