[Ru] Libmanga. Revert changes from 19->20 update (#4289)
This commit is contained in:
parent
ea2f70b414
commit
6a47455608
@ -5,7 +5,7 @@ ext {
|
|||||||
extName = 'MangaLib'
|
extName = 'MangaLib'
|
||||||
pkgNameSuffix = 'ru.libmanga'
|
pkgNameSuffix = 'ru.libmanga'
|
||||||
extClass = '.LibManga'
|
extClass = '.LibManga'
|
||||||
extVersionCode = 20
|
extVersionCode = 21
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import android.support.v7.preference.ListPreference
|
|||||||
import android.support.v7.preference.PreferenceScreen
|
import android.support.v7.preference.PreferenceScreen
|
||||||
import com.github.salomonbrys.kotson.array
|
import com.github.salomonbrys.kotson.array
|
||||||
import com.github.salomonbrys.kotson.get
|
import com.github.salomonbrys.kotson.get
|
||||||
|
import com.github.salomonbrys.kotson.int
|
||||||
import com.github.salomonbrys.kotson.nullArray
|
import com.github.salomonbrys.kotson.nullArray
|
||||||
import com.github.salomonbrys.kotson.nullString
|
import com.github.salomonbrys.kotson.nullString
|
||||||
import com.github.salomonbrys.kotson.obj
|
import com.github.salomonbrys.kotson.obj
|
||||||
@ -231,10 +232,22 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||||||
private fun chapterFromElement(element: Element): SChapter {
|
private fun chapterFromElement(element: Element): SChapter {
|
||||||
|
|
||||||
val chapter = SChapter.create()
|
val chapter = SChapter.create()
|
||||||
val id = element.attr("data-id")
|
|
||||||
val slug = element.baseUri().replace("$baseUrl/", "")
|
val chapterLink = element.select("div.chapter-item__name > a").first()
|
||||||
val url = "/download/$id?slug=$slug"
|
if (chapterLink != null) {
|
||||||
chapter.setUrlWithoutDomain(url)
|
chapter.setUrlWithoutDomain(chapterLink.attr("href"))
|
||||||
|
} else {
|
||||||
|
// Found multiple translate. Get first one for now
|
||||||
|
val volume = element.attr("data-volume")
|
||||||
|
val number = element.attr("data-number")
|
||||||
|
val teams = jsonParser.parse(element.attr("data-teams"))
|
||||||
|
val team = teams[0]["slug"].nullString
|
||||||
|
val baseUrl = "${element.baseUri()}/v$volume/c$number"
|
||||||
|
val url = if (team != null) "$baseUrl/$team" else baseUrl
|
||||||
|
|
||||||
|
chapter.setUrlWithoutDomain(url)
|
||||||
|
}
|
||||||
|
|
||||||
chapter.name = element.select("div.chapter-item__name").first().text()
|
chapter.name = element.select("div.chapter-item__name").first().text()
|
||||||
chapter.date_upload = SimpleDateFormat("dd.MM.yyyy", Locale.US)
|
chapter.date_upload = SimpleDateFormat("dd.MM.yyyy", Locale.US)
|
||||||
.parse(element.select("div.chapter-item__date").text()).time
|
.parse(element.select("div.chapter-item__date").text()).time
|
||||||
@ -249,18 +262,39 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun pageListParse(response: Response): List<Page> {
|
||||||
val body = response.body()!!.string()
|
val document = response.asJsoup()
|
||||||
val slug = response.request().url().queryParameter("slug")
|
val chapInfo = document
|
||||||
val json = jsonParser.parse(body)
|
.select("script:containsData(window.__info)")
|
||||||
val images = json["images"].array
|
.first()
|
||||||
val chapterslug = json["chapter"]["slug"].string
|
.html()
|
||||||
|
.trim()
|
||||||
|
.removePrefix("window.__info = ")
|
||||||
|
.split(";")
|
||||||
|
.first()
|
||||||
|
|
||||||
|
val chapInfoJson = jsonParser.parse(chapInfo).obj
|
||||||
|
val servers = chapInfoJson["servers"].asJsonObject
|
||||||
|
val defaultServer: String = chapInfoJson["img"]["server"].string
|
||||||
|
val imgUrl: String = chapInfoJson["img"]["url"].string
|
||||||
|
|
||||||
|
val serverToUse = if (this.server == null) defaultServer else this.server
|
||||||
|
val imageServerUrl: String = servers[serverToUse].string
|
||||||
|
|
||||||
|
// Get pages
|
||||||
|
val pagesArr = document
|
||||||
|
.select("script:containsData(window.__pg)")
|
||||||
|
.first()
|
||||||
|
.html()
|
||||||
|
.trim()
|
||||||
|
.removePrefix("window.__pg = ")
|
||||||
|
.removeSuffix(";")
|
||||||
|
|
||||||
|
val pagesJson = jsonParser.parse(pagesArr).array
|
||||||
val pages = mutableListOf<Page>()
|
val pages = mutableListOf<Page>()
|
||||||
images.forEachIndexed { index, page ->
|
|
||||||
val url = "${this.imageServerUrl()}/manga/$slug/chapters/$chapterslug/${page.string}"
|
|
||||||
pages.add(Page(index, "", url))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
pagesJson.forEach { page ->
|
||||||
|
pages.add(Page(page["p"].int, "", imageServerUrl + imgUrl + page["u"].string))
|
||||||
|
}
|
||||||
return pages
|
return pages
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user