TimelessLeaf - more page parsing (#3701)

This commit is contained in:
Mike 2020-07-06 02:50:18 -04:00 committed by GitHub
parent 877058c301
commit 72bf0609c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'TimelessLeaf'
pkgNameSuffix = 'en.timelessleaf'
extClass = '.TimelessLeaf'
extVersionCode = 1
extVersionCode = 2
libVersion = '1.2'
}

View File

@ -28,12 +28,10 @@ class TimelessLeaf : HttpSource() {
override val supportsLatest: Boolean = false
val mangasPageUrl = baseUrl + "/manga/"
// popular manga
override fun popularMangaRequest(page: Int): Request {
return GET(mangasPageUrl)
return GET("$baseUrl/manga/")
}
override fun popularMangaParse(response: Response): MangasPage {
@ -62,7 +60,7 @@ class TimelessLeaf : HttpSource() {
menuLinks.forEach { el ->
val title = el.text()
// ignore duplicates
if (titleList.filter { str -> str.startsWith(title, ignoreCase = true) }.isEmpty())
if (titleList.none { str -> str.startsWith(title, ignoreCase = true) })
add(Pair(title, el.attr("href")))
}
}.sortedBy { pair -> pair.first }
@ -107,9 +105,14 @@ class TimelessLeaf : HttpSource() {
// page list
override fun pageListParse(response: Response): List<Page> {
return response.asJsoup().select(".site-main article .gallery-item img").mapIndexed { index, el ->
Page(index, "", el.attr("abs:src"))
}
return response.asJsoup()
.let { document ->
document.select(".site-main article .gallery-item img")
.let { if (it.isNullOrEmpty()) document.select("div.entry-content img") else it }
}
.mapIndexed { index, el ->
Page(index, "", el.attr("abs:src"))
}
}
// search manga, implementing a local search