From 97472230c3adbecfbf67b9ed22532cb65a597d29 Mon Sep 17 00:00:00 2001 From: AbdullahM0hamed <25087116+AbdullahM0hamed@users.noreply.github.com> Date: Wed, 15 Jul 2020 11:13:52 +0100 Subject: [PATCH] Add ComicLatest (#3790) * Add ComicLatest * Minor edit * Update build.gradle Co-authored-by: snakedoc83 --- src/all/wpcomics/build.gradle | 2 +- .../extension/all/wpcomics/WPComicsFactory.kt | 32 ++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/all/wpcomics/build.gradle b/src/all/wpcomics/build.gradle index bd8235dab..6f6f01027 100644 --- a/src/all/wpcomics/build.gradle +++ b/src/all/wpcomics/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'WP-Comics' pkgNameSuffix = 'all.wpcomics' extClass = '.WPComicsFactory' - extVersionCode = 10 + extVersionCode = 11 libVersion = '1.2' } diff --git a/src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComicsFactory.kt b/src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComicsFactory.kt index 05d49a6ce..070c8e452 100644 --- a/src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComicsFactory.kt +++ b/src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComicsFactory.kt @@ -24,7 +24,8 @@ class WPComicsFactory : SourceFactory { XoxoComics(), NhatTruyen(), NetTruyen(), - TruyenChon() + TruyenChon(), + ComicLatest() ) } @@ -106,3 +107,32 @@ private class TruyenChon : WPComics("TruyenChon", "http://truyenchon.com", "vi", ) } } + +private class ComicLatest : WPComics("ComicLatest", "https://comiclatest.com", "en", SimpleDateFormat("MM/dd/yyyy", Locale.US), null) { + //Hot only has one page + override val popularPath = "popular-comics" + + override fun popularMangaFromElement(element: Element) = SManga.create().apply { + element.select("h3 a").let { + title = it.text() + setUrlWithoutDomain(it.attr("href")) + } + thumbnail_url = element.select("img").attr("data-original") + } + + override fun chapterListParse(response: Response): List { + val chapters = mutableListOf() + + 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) = GET("$baseUrl${chapter.url}/all", headers) +}