mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Implement genre filter for Readmanga
This commit is contained in:
parent
d58c517a6c
commit
2a5edf4547
1 changed files with 56 additions and 3 deletions
|
@ -24,7 +24,8 @@ class Readmanga(context: Context, override val id: Int) : ParsedOnlineSource(con
|
||||||
|
|
||||||
override fun popularMangaInitialUrl() = "$baseUrl/list?sortType=rate"
|
override fun popularMangaInitialUrl() = "$baseUrl/list?sortType=rate"
|
||||||
|
|
||||||
override fun searchMangaInitialUrl(query: String, filters: List<Filter>) = "$baseUrl/search?q=$query"
|
override fun searchMangaInitialUrl(query: String, filters: List<Filter>) =
|
||||||
|
"$baseUrl/search?q=$query&${filters.map { it.id + "=in" }.joinToString("&")}"
|
||||||
|
|
||||||
override fun popularMangaSelector() = "div.desc"
|
override fun popularMangaSelector() = "div.desc"
|
||||||
|
|
||||||
|
@ -40,10 +41,14 @@ class Readmanga(context: Context, override val id: Int) : ParsedOnlineSource(con
|
||||||
override fun searchMangaSelector() = popularMangaSelector()
|
override fun searchMangaSelector() = popularMangaSelector()
|
||||||
|
|
||||||
override fun searchMangaFromElement(element: Element, manga: Manga) {
|
override fun searchMangaFromElement(element: Element, manga: Manga) {
|
||||||
popularMangaFromElement(element, manga)
|
element.select("h3 > a").first().let {
|
||||||
|
manga.setUrlWithoutDomain(it.attr("href"))
|
||||||
|
manga.title = it.attr("title")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
|
// max 200 results
|
||||||
|
override fun searchMangaNextPageSelector() = null
|
||||||
|
|
||||||
override fun mangaDetailsParse(document: Document, manga: Manga) {
|
override fun mangaDetailsParse(document: Document, manga: Manga) {
|
||||||
val infoElement = document.select("div.leftContent").first()
|
val infoElement = document.select("div.leftContent").first()
|
||||||
|
@ -99,4 +104,52 @@ class Readmanga(context: Context, override val id: Int) : ParsedOnlineSource(con
|
||||||
override fun pageListParse(document: Document, pages: MutableList<Page>) { }
|
override fun pageListParse(document: Document, pages: MutableList<Page>) { }
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document) = ""
|
override fun imageUrlParse(document: Document) = ""
|
||||||
|
|
||||||
|
/* [...document.querySelectorAll("tr.advanced_option:nth-child(1) > td:nth-child(3) span.js-link")].map((el,i) => {
|
||||||
|
* const onClick=el.getAttribute('onclick');const id=onClick.substr(31,onClick.length-33);
|
||||||
|
* return `Filter("${id}", "${el.textContent.trim()}")` }).join(',\n')
|
||||||
|
* on http://readmanga.me/search
|
||||||
|
*/
|
||||||
|
override fun getFilterList(): List<Filter> = listOf(
|
||||||
|
Filter("el_5685", "арт"),
|
||||||
|
Filter("el_2155", "боевик"),
|
||||||
|
Filter("el_2143", "боевые искусства"),
|
||||||
|
Filter("el_2148", "вампиры"),
|
||||||
|
Filter("el_2142", "гарем"),
|
||||||
|
Filter("el_2156", "гендерная интрига"),
|
||||||
|
Filter("el_2146", "героическое фэнтези"),
|
||||||
|
Filter("el_2152", "детектив"),
|
||||||
|
Filter("el_2158", "дзёсэй"),
|
||||||
|
Filter("el_2141", "додзинси"),
|
||||||
|
Filter("el_2118", "драма"),
|
||||||
|
Filter("el_2154", "игра"),
|
||||||
|
Filter("el_2119", "история"),
|
||||||
|
Filter("el_2137", "кодомо"),
|
||||||
|
Filter("el_2136", "комедия"),
|
||||||
|
Filter("el_2147", "махо-сёдзё"),
|
||||||
|
Filter("el_2126", "меха"),
|
||||||
|
Filter("el_2132", "мистика"),
|
||||||
|
Filter("el_2133", "научная фантастика"),
|
||||||
|
Filter("el_2135", "повседневность"),
|
||||||
|
Filter("el_2151", "постапокалиптика"),
|
||||||
|
Filter("el_2130", "приключения"),
|
||||||
|
Filter("el_2144", "психология"),
|
||||||
|
Filter("el_2121", "романтика"),
|
||||||
|
Filter("el_2124", "самурайский боевик"),
|
||||||
|
Filter("el_2159", "сверхъестественное"),
|
||||||
|
Filter("el_2122", "сёдзё"),
|
||||||
|
Filter("el_2128", "сёдзё-ай"),
|
||||||
|
Filter("el_2134", "сёнэн"),
|
||||||
|
Filter("el_2139", "сёнэн-ай"),
|
||||||
|
Filter("el_2129", "спорт"),
|
||||||
|
Filter("el_2138", "сэйнэн"),
|
||||||
|
Filter("el_2153", "трагедия"),
|
||||||
|
Filter("el_2150", "триллер"),
|
||||||
|
Filter("el_2125", "ужасы"),
|
||||||
|
Filter("el_2140", "фантастика"),
|
||||||
|
Filter("el_2131", "фэнтези"),
|
||||||
|
Filter("el_2127", "школа"),
|
||||||
|
Filter("el_2149", "этти"),
|
||||||
|
Filter("el_2123", "юри")
|
||||||
|
)
|
||||||
}
|
}
|
Loading…
Reference in a new issue