Fix LectorManga and TuMangaOnline (#15268)
* Fix LectorManga and TuMangaOnline * Miskey * Obtain newUrl in pageListParse
This commit is contained in:
parent
82224c14f4
commit
87f34dd479
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'LectorManga'
|
||||
pkgNameSuffix = 'es.lectormanga'
|
||||
extClass = '.LectorManga'
|
||||
extVersionCode = 25
|
||||
extVersionCode = 26
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
|
|||
|
||||
override fun popularMangaRequest(page: Int) = GET("$baseUrl/library?order_item=likes_count&order_dir=desc&type=&filter_by=title&page=$page", headers)
|
||||
|
||||
override fun popularMangaNextPageSelector() = ".pagination .page-item:not(.disabled) a[rel='next']"
|
||||
override fun popularMangaNextPageSelector() = "a[rel='next']"
|
||||
|
||||
override fun popularMangaSelector() = ".col-6 .card"
|
||||
|
||||
|
@ -247,25 +247,26 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
|
|||
}
|
||||
|
||||
override fun pageListRequest(chapter: SChapter): Request {
|
||||
val currentUrl = client.newCall(GET(chapter.url, headers)).execute().asJsoup().body().baseUri()
|
||||
return GET(chapter.url, headers)
|
||||
}
|
||||
|
||||
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
|
||||
val currentUrl = document.body().baseUri()
|
||||
|
||||
// Get /cascade instead of /paginate to get all pages at once
|
||||
val newUrl = if (getPageMethodPref() == PAGE_METHOD_PREF_CASCADE && currentUrl.contains(PAGE_METHOD_PREF_PAGINATED)) {
|
||||
currentUrl.substringBefore(PAGE_METHOD_PREF_PAGINATED) + PAGE_METHOD_PREF_CASCADE
|
||||
} else if (getPageMethodPref() == PAGE_METHOD_PREF_PAGINATED && currentUrl.contains(PAGE_METHOD_PREF_CASCADE)) {
|
||||
currentUrl.substringBefore(PAGE_METHOD_PREF_CASCADE) + PAGE_METHOD_PREF_PAGINATED
|
||||
} else currentUrl
|
||||
|
||||
return GET(newUrl, headers)
|
||||
}
|
||||
val doc = client.newCall(GET(newUrl, headers)).execute().asJsoup()
|
||||
|
||||
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
|
||||
if (getPageMethodPref() == PAGE_METHOD_PREF_CASCADE) {
|
||||
document.select("div.viewer-image-container img").forEach {
|
||||
doc.select("div.viewer-image-container img").forEach {
|
||||
add(
|
||||
Page(
|
||||
size,
|
||||
document.baseUri(),
|
||||
doc.baseUri(),
|
||||
it.let {
|
||||
if (it.hasAttr("data-src")) it.attr("abs:data-src")
|
||||
else it.attr("abs:src")
|
||||
|
@ -274,7 +275,7 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
|
|||
)
|
||||
}
|
||||
} else {
|
||||
val body = document.select("script:containsData(var dirPath)").first().data()
|
||||
val body = doc.select("script:containsData(var dirPath)").first().data()
|
||||
val path = body.substringAfter("var dirPath = '").substringBefore("'")
|
||||
|
||||
body.substringAfter("var images = JSON.parse('[")
|
||||
|
@ -282,7 +283,7 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
|
|||
.replace("\"", "")
|
||||
.split(",")
|
||||
.forEach {
|
||||
add(Page(size, document.baseUri(), path + it))
|
||||
add(Page(size, doc.baseUri(), path + it))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'TuMangaOnline'
|
||||
pkgNameSuffix = 'es.tumangaonline'
|
||||
extClass = '.TuMangaOnline'
|
||||
extVersionCode = 40
|
||||
extVersionCode = 41
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
|
|||
|
||||
override fun popularMangaRequest(page: Int) = GET("$baseUrl/library?order_item=likes_count&order_dir=desc&filter_by=title$getSFWUrlPart&_pg=1&page=$page", headers)
|
||||
|
||||
override fun popularMangaNextPageSelector() = "a.page-link"
|
||||
override fun popularMangaNextPageSelector() = "a[rel='next']"
|
||||
|
||||
override fun popularMangaSelector() = "div.element"
|
||||
|
||||
|
@ -214,18 +214,21 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
|
|||
private fun parseChapterDate(date: String): Long = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).parse(date)?.time
|
||||
?: 0
|
||||
override fun pageListRequest(chapter: SChapter): Request {
|
||||
val currentUrl = client.newCall(GET(chapter.url, headers)).execute().asJsoup().body().baseUri()
|
||||
// Get /cascade instead of /paginate to get all pages at once
|
||||
return GET(chapter.url, headers)
|
||||
}
|
||||
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
|
||||
val currentUrl = document.body().baseUri()
|
||||
|
||||
val newUrl = if (getPageMethodPref() == "cascade" && currentUrl.contains("paginated")) {
|
||||
currentUrl.substringBefore("paginated") + "cascade"
|
||||
} else if (getPageMethodPref() == "paginated" && currentUrl.contains("cascade")) {
|
||||
currentUrl.substringBefore("cascade") + "paginated"
|
||||
} else currentUrl
|
||||
return GET(newUrl, headers)
|
||||
}
|
||||
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
|
||||
|
||||
val doc = client.newCall(GET(newUrl, headers)).execute().asJsoup()
|
||||
|
||||
if (getPageMethodPref() == "cascade") {
|
||||
document.select("div.viewer-container img").forEach {
|
||||
doc.select("div.viewer-container img").forEach {
|
||||
add(
|
||||
Page(
|
||||
size,
|
||||
|
@ -238,8 +241,8 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
|
|||
)
|
||||
}
|
||||
} else {
|
||||
val pageList = document.select("#viewer-pages-select").first().select("option").map { it.attr("value").toInt() }
|
||||
val url = document.baseUri()
|
||||
val pageList = doc.select("#viewer-pages-select").first().select("option").map { it.attr("value").toInt() }
|
||||
val url = doc.baseUri()
|
||||
pageList.forEach {
|
||||
add(Page(it, "$url/$it"))
|
||||
}
|
||||
|
@ -249,7 +252,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
|
|||
override fun imageRequest(page: Page) = GET(page.imageUrl!!, headers)
|
||||
|
||||
override fun imageUrlParse(document: Document): String {
|
||||
return document.select("div.viewer-container > div.viewer-image-container > img.viewer-image").attr("src")
|
||||
return document.select("div.viewer-container > div.img-container > img.viewer-image").attr("src")
|
||||
}
|
||||
|
||||
private fun searchMangaByIdRequest(id: String) = GET("$baseUrl/$PREFIX_LIBRARY/$id", headers)
|
||||
|
|
Loading…
Reference in New Issue