From d58c517a6cd8853e99256164fceb54be6bae89e5 Mon Sep 17 00:00:00 2001 From: Taumer Date: Tue, 30 Aug 2016 14:22:55 +0300 Subject: [PATCH 1/2] Implement genre filter for Mintmanga --- .../data/source/online/russian/Mintmanga.kt | 56 ++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Mintmanga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Mintmanga.kt index ff73f608ff..e6e821bbd8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Mintmanga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Mintmanga.kt @@ -24,7 +24,8 @@ class Mintmanga(context: Context, override val id: Int) : ParsedOnlineSource(con override fun popularMangaInitialUrl() = "$baseUrl/list?sortType=rate" - override fun searchMangaInitialUrl(query: String, filters: List) = "$baseUrl/search?q=$query" + override fun searchMangaInitialUrl(query: String, filters: List) = + "$baseUrl/search?q=$query&${filters.map { it.id + "=in" }.joinToString("&")}" override fun popularMangaSelector() = "div.desc" @@ -43,7 +44,8 @@ class Mintmanga(context: Context, override val id: Int) : ParsedOnlineSource(con popularMangaFromElement(element, manga) } - override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() + // max 200 results + override fun searchMangaNextPageSelector() = null override fun mangaDetailsParse(document: Document, manga: Manga) { val infoElement = document.select("div.leftContent").first() @@ -99,4 +101,54 @@ class Mintmanga(context: Context, override val id: Int) : ParsedOnlineSource(con override fun pageListParse(document: Document, pages: MutableList) { } 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://mintmanga.com/search + */ + override fun getFilterList(): List = listOf( + Filter("el_2220", "арт"), + Filter("el_1353", "бара"), + Filter("el_1346", "боевик"), + Filter("el_1334", "боевые искусства"), + Filter("el_1339", "вампиры"), + Filter("el_1333", "гарем"), + Filter("el_1347", "гендерная интрига"), + Filter("el_1337", "героическое фэнтези"), + Filter("el_1343", "детектив"), + Filter("el_1349", "дзёсэй"), + Filter("el_1332", "додзинси"), + Filter("el_1310", "драма"), + Filter("el_5229", "игра"), + Filter("el_1311", "история"), + Filter("el_1351", "киберпанк"), + Filter("el_1328", "комедия"), + Filter("el_1318", "меха"), + Filter("el_1324", "мистика"), + Filter("el_1325", "научная фантастика"), + Filter("el_1327", "повседневность"), + Filter("el_1342", "постапокалиптика"), + Filter("el_1322", "приключения"), + Filter("el_1335", "психология"), + Filter("el_1313", "романтика"), + Filter("el_1316", "самурайский боевик"), + Filter("el_1350", "сверхъестественное"), + Filter("el_1314", "сёдзё"), + Filter("el_1320", "сёдзё-ай"), + Filter("el_1326", "сёнэн"), + Filter("el_1330", "сёнэн-ай"), + Filter("el_1321", "спорт"), + Filter("el_1329", "сэйнэн"), + Filter("el_1344", "трагедия"), + Filter("el_1341", "триллер"), + Filter("el_1317", "ужасы"), + Filter("el_1331", "фантастика"), + Filter("el_1323", "фэнтези"), + Filter("el_1319", "школа"), + Filter("el_1340", "эротика"), + Filter("el_1354", "этти"), + Filter("el_1315", "юри"), + Filter("el_1336", "яой") + ) } \ No newline at end of file From 2a5edf4547c10fc6bb9c3c019e71bcc0bf5d7cea Mon Sep 17 00:00:00 2001 From: Taumer Date: Tue, 30 Aug 2016 14:23:47 +0300 Subject: [PATCH 2/2] Implement genre filter for Readmanga --- .../data/source/online/russian/Readmanga.kt | 59 ++++++++++++++++++- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Readmanga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Readmanga.kt index b645db2d76..a874ba09f2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Readmanga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/source/online/russian/Readmanga.kt @@ -24,7 +24,8 @@ class Readmanga(context: Context, override val id: Int) : ParsedOnlineSource(con override fun popularMangaInitialUrl() = "$baseUrl/list?sortType=rate" - override fun searchMangaInitialUrl(query: String, filters: List) = "$baseUrl/search?q=$query" + override fun searchMangaInitialUrl(query: String, filters: List) = + "$baseUrl/search?q=$query&${filters.map { it.id + "=in" }.joinToString("&")}" 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 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) { 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) { } 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 = 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", "юри") + ) } \ No newline at end of file