MangaOwl: Fix chapter url (#10461)
This commit is contained in:
parent
f6ba68974c
commit
89a9433851
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'MangaOwl'
|
extName = 'MangaOwl'
|
||||||
pkgNameSuffix = 'en.mangaowl'
|
pkgNameSuffix = 'en.mangaowl'
|
||||||
extClass = '.MangaOwl'
|
extClass = '.MangaOwl'
|
||||||
extVersionCode = 23
|
extVersionCode = 24
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.kanade.tachiyomi.extension.en.mangaowl
|
package eu.kanade.tachiyomi.extension.en.mangaowl
|
||||||
|
|
||||||
|
import android.util.Base64
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.model.Filter
|
import eu.kanade.tachiyomi.source.model.Filter
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
|
@ -147,18 +148,25 @@ class MangaOwl : ParsedHttpSource() {
|
||||||
// Only selects chapter elements with links, since sometimes chapter lists have unlinked chapters
|
// Only selects chapter elements with links, since sometimes chapter lists have unlinked chapters
|
||||||
override fun chapterListSelector() = "div.table-chapter-list ul li:has(a)"
|
override fun chapterListSelector() = "div.table-chapter-list ul li:has(a)"
|
||||||
|
|
||||||
override fun chapterFromElement(element: Element): SChapter {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val chapter = SChapter.create()
|
val document = response.asJsoup()
|
||||||
element.select("a").let {
|
val trRegex = "window\\['tr'] = '([^']*)';".toRegex(RegexOption.IGNORE_CASE)
|
||||||
// They replace some URLs with a different host getting a path of domain.com/reader/reader/, fix to make usable on baseUrl
|
val trElement = document.getElementsByTag("script").find { trRegex.find(it.data()) != null } ?: error("tr not found")
|
||||||
chapter.setUrlWithoutDomain(it.attr("data-href").replace("/reader/reader/", "/reader/"))
|
val tr = trRegex.find(trElement.data())!!.groups[1]!!.value
|
||||||
chapter.name = it.select("label").first().text()
|
val s = Base64.encodeToString(baseUrl.toByteArray(), Base64.NO_PADDING)
|
||||||
|
return document.select(chapterListSelector()).map { element ->
|
||||||
|
SChapter.create().apply {
|
||||||
|
element.select("a").let {
|
||||||
|
url = "${it.attr("data-href")}?tr=$tr&s=$s"
|
||||||
|
name = it.select("label").first().text()
|
||||||
|
}
|
||||||
|
date_upload = parseChapterDate(element.select("small:last-of-type").text())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
chapter.date_upload = parseChapterDate(element.select("small:last-of-type").text())
|
|
||||||
|
|
||||||
return chapter
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun chapterFromElement(element: Element): SChapter = throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val dateFormat by lazy {
|
val dateFormat by lazy {
|
||||||
SimpleDateFormat("MM/dd/yyyy", Locale.US)
|
SimpleDateFormat("MM/dd/yyyy", Locale.US)
|
||||||
|
@ -174,6 +182,7 @@ class MangaOwl : ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pages
|
// Pages
|
||||||
|
override fun pageListRequest(chapter: SChapter) = GET(chapter.url, headers) // url already complete
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
return document.select("div.item img.owl-lazy").mapIndexed { i, img ->
|
return document.select("div.item img.owl-lazy").mapIndexed { i, img ->
|
||||||
|
|
Loading…
Reference in New Issue