feat(manhwa18cc): add search functionality (#9745)

This commit is contained in:
Dzulkarnain Mohamed 2021-11-08 20:21:21 +08:00 committed by GitHub
parent 6c8a44f56a
commit 2f0e065d10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -4,9 +4,11 @@ import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.Page
import okhttp3.Request
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
class Manhwa18CcFactory : SourceFactory {
override fun createSources(): List<Source> = listOf(
@ -32,6 +34,7 @@ abstract class Manhwa18Cc(
override fun popularMangaSelector() = "div.manga-item"
override val popularMangaUrlSelector = "div.data > h3 > a"
override fun popularMangaNextPageSelector() = "ul.pagination > li > a"
override fun popularMangaRequest(page: Int): Request {
return GET("$baseUrl/webtoons/$page?orderby=trending")
@ -41,6 +44,21 @@ abstract class Manhwa18Cc(
return GET("$baseUrl/webtoons/$page?orderby=latest")
}
override fun searchMangaSelector() = popularMangaSelector()
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
// After searching and go back to popular page, it always sent empty query thus display
// "No results found" message. So this fix redirect to popular page.
if (query.isBlank())
return popularMangaRequest(1)
return GET("$baseUrl/search?q=$query&page=$page")
}
override val mangaSubString = "webtoon"
override fun chapterListSelector() = "li.wleft"

View File

@ -15,7 +15,7 @@ class MadaraGenerator : ThemeSourceGenerator {
override val sources = listOf(
MultiLang("Leviatan Scans", "https://leviatanscans.com", listOf("en", "es"), className = "LeviatanScansFactory", overrideVersionCode = 9),
MultiLang("MangaForFree.net", "https://mangaforfree.net", listOf("en", "ko", "all"), isNsfw = true, className = "MangaForFreeFactory", pkgName = "mangaforfree", overrideVersionCode = 1),
MultiLang("Manhwa18.cc", "https://manhwa18.cc", listOf("en", "ko", "all"), isNsfw = true, className = "Manhwa18CcFactory", pkgName = "manhwa18cc"),
MultiLang("Manhwa18.cc", "https://manhwa18.cc", listOf("en", "ko", "all"), isNsfw = true, className = "Manhwa18CcFactory", pkgName = "manhwa18cc", overrideVersionCode = 1),
MultiLang("Reaper Scans", "https://reaperscans.com", listOf("en", "pt-BR"), className = "ReaperScansFactory", pkgName = "reaperscans", overrideVersionCode = 2),
SingleLang("1st Kiss Manga.love", "https://1stkissmanga.love", "en", className = "FirstKissMangaLove"),
SingleLang("1st Kiss", "https://1stkissmanga.io", "en", className = "FirstKissManga", pkgName = "firstkissmanga", overrideVersionCode = 6),