WP Comics - fix xoxocomics chapters (#3528)

This commit is contained in:
Mike 2020-06-13 23:56:21 -04:00 committed by GitHub
parent ee7d3bba17
commit 1b1bd56c95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: WP-Comics'
pkgNameSuffix = 'all.wpcomics'
extClass = '.WPComicsFactory'
extVersionCode = 7
extVersionCode = 8
libVersion = '1.2'
}

View File

@ -8,10 +8,13 @@ import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.asJsoup
import java.text.SimpleDateFormat
import java.util.Locale
import okhttp3.HttpUrl
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
class WPComicsFactory : SourceFactory {
@ -64,6 +67,21 @@ private class XoxoComics : WPComics("XOXO Comics", "https://xoxocomics.com", "en
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return GET("$baseUrl/search?keyword=$query&page=$page", headers)
}
override fun chapterListParse(response: Response): List<SChapter> {
val chapters = mutableListOf<SChapter>()
// recursively add chapters from paginated chapter list
fun parseChapters(document: Document) {
document.select(chapterListSelector()).map { chapters.add(chapterFromElement(it)) }
document.select("ul.pagination a[rel=next]").firstOrNull()?.let { a ->
parseChapters(client.newCall(GET(a.attr("abs:href"), headers)).execute().asJsoup())
}
}
parseChapters(response.asJsoup())
return chapters
}
override fun pageListRequest(chapter: SChapter): Request = GET(baseUrl + "${chapter.url}/all")
}