[RU]MangaBook. Fix last page loading and change type CategoryList (#7674)
* [RU]MangaBook. Fix last page loading and change type CategoryList * thom number
This commit is contained in:
parent
f932e26e14
commit
f1d3a69dbd
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'MangaBook'
|
extName = 'MangaBook'
|
||||||
pkgNameSuffix = 'ru.mangabook'
|
pkgNameSuffix = 'ru.mangabook'
|
||||||
extClass = '.MangaBook'
|
extClass = '.MangaBook'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class MangaBook : ParsedHttpSource() {
|
||||||
|
|
||||||
// Popular
|
// Popular
|
||||||
override fun popularMangaRequest(page: Int): Request =
|
override fun popularMangaRequest(page: Int): Request =
|
||||||
GET("$baseUrl/filterList?page=$page&ftype[]=0&status[]=0&sortBy=rate", headers)
|
GET("$baseUrl/filterList?page=$page&ftype[]=0&status[]=0&sortBy=views", headers)
|
||||||
override fun popularMangaNextPageSelector() = "a.page-link[rel=next]"
|
override fun popularMangaNextPageSelector() = "a.page-link[rel=next]"
|
||||||
override fun popularMangaSelector() = "article.short .short-in"
|
override fun popularMangaSelector() = "article.short .short-in"
|
||||||
override fun popularMangaFromElement(element: Element): SManga {
|
override fun popularMangaFromElement(element: Element): SManga {
|
||||||
|
@ -57,16 +57,17 @@ class MangaBook : ParsedHttpSource() {
|
||||||
val url = if (query.isNotBlank()) {
|
val url = if (query.isNotBlank()) {
|
||||||
"$baseUrl/dosearch?&query=$query"
|
"$baseUrl/dosearch?&query=$query"
|
||||||
} else {
|
} else {
|
||||||
val url = "$baseUrl/filterList?page=$page&ftype[]=0&status[]=0&sortBy=rate".toHttpUrlOrNull()!!.newBuilder()
|
val url = "$baseUrl/filterList?page=$page&ftype[]=0&status[]=0".toHttpUrlOrNull()!!.newBuilder()
|
||||||
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
|
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
|
||||||
when (filter) {
|
when (filter) {
|
||||||
is OrderBy -> {
|
is OrderBy -> {
|
||||||
val ord = arrayOf("rate", "name", "views", "created_at")[filter.state]
|
val ord = arrayOf("views", "rate", "name", "created_at")[filter.state]
|
||||||
url.addQueryParameter("sortBy", "$ord")
|
url.addQueryParameter("sortBy", "$ord")
|
||||||
}
|
}
|
||||||
is CategoryList -> filter.state.forEach { category ->
|
is CategoryList -> {
|
||||||
if (category.state) {
|
if (filter.state > 0) {
|
||||||
url.addQueryParameter("cat", category.id)
|
val CatQ = getCategoryList()[filter.state].query
|
||||||
|
url.addQueryParameter("cat", CatQ)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is StatusList -> filter.state.forEach { status ->
|
is StatusList -> filter.state.forEach { status ->
|
||||||
|
@ -141,7 +142,7 @@ class MangaBook : ParsedHttpSource() {
|
||||||
override fun chapterListSelector(): String = ".chapters li:not(.volume )"
|
override fun chapterListSelector(): String = ".chapters li:not(.volume )"
|
||||||
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
|
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
|
||||||
val link = element.select("h5 a")
|
val link = element.select("h5 a")
|
||||||
name = link.text()
|
name = element.attr("class").substringAfter("volume-") + ". " + link.text()
|
||||||
chapter_number = name.substringAfter("Глава №").substringBefore(":").toFloat()
|
chapter_number = name.substringAfter("Глава №").substringBefore(":").toFloat()
|
||||||
setUrlWithoutDomain(link.attr("href") + "/1")
|
setUrlWithoutDomain(link.attr("href") + "/1")
|
||||||
date_upload = parseDate(element.select(".date-chapter-title-rtl").text().trim())
|
date_upload = parseDate(element.select(".date-chapter-title-rtl").text().trim())
|
||||||
|
@ -151,7 +152,7 @@ class MangaBook : ParsedHttpSource() {
|
||||||
}
|
}
|
||||||
// Pages
|
// Pages
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
return document.select(".reader-images img.img-responsive").mapIndexed { i, img ->
|
return document.select(".reader-images img.img-responsive:not(.scan-page)").mapIndexed { i, img ->
|
||||||
Page(i, "", img.attr("data-src").trim())
|
Page(i, "", img.attr("data-src").trim())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,17 +164,17 @@ class MangaBook : ParsedHttpSource() {
|
||||||
|
|
||||||
private class FormatList(formas: List<CheckFilter>) : Filter.Group<CheckFilter>("Тип", formas)
|
private class FormatList(formas: List<CheckFilter>) : Filter.Group<CheckFilter>("Тип", formas)
|
||||||
private class StatusList(statuses: List<CheckFilter>) : Filter.Group<CheckFilter>("Статус", statuses)
|
private class StatusList(statuses: List<CheckFilter>) : Filter.Group<CheckFilter>("Статус", statuses)
|
||||||
private class CategoryList(categories: List<CheckFilter>) : Filter.Group<CheckFilter>("Категории", categories)
|
|
||||||
override fun getFilterList() = FilterList(
|
override fun getFilterList() = FilterList(
|
||||||
OrderBy(),
|
OrderBy(),
|
||||||
CategoryList(getCategoryList()),
|
CategoryList(categoriesName),
|
||||||
StatusList(getStatusList()),
|
StatusList(getStatusList()),
|
||||||
FormatList(getFormatList())
|
FormatList(getFormatList())
|
||||||
)
|
)
|
||||||
|
|
||||||
private class OrderBy : Filter.Select<String>(
|
private class OrderBy : Filter.Select<String>(
|
||||||
"Сортировка",
|
"Сортировка",
|
||||||
arrayOf("По рейтингу", "По алфавиту", "По популярности", "По дате выхода")
|
arrayOf("По популярности", "По рейтингу", "По алфавиту", "По дате выхода")
|
||||||
)
|
)
|
||||||
private fun getFormatList() = listOf(
|
private fun getFormatList() = listOf(
|
||||||
CheckFilter("Манга", "1"),
|
CheckFilter("Манга", "1"),
|
||||||
|
@ -188,77 +189,84 @@ class MangaBook : ParsedHttpSource() {
|
||||||
CheckFilter("Изданное", "2")
|
CheckFilter("Изданное", "2")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private class CategoryList(categories: Array<String>) : Filter.Select<String>("Категории", categories)
|
||||||
|
private data class CatUnit(val name: String, val query: String)
|
||||||
|
private val categoriesName = getCategoryList().map {
|
||||||
|
it.name
|
||||||
|
}.toTypedArray()
|
||||||
|
|
||||||
private fun getCategoryList() = listOf(
|
private fun getCategoryList() = listOf(
|
||||||
CheckFilter("16+", "16+"),
|
CatUnit("Без категории", "not"),
|
||||||
CheckFilter("Арт", "art"),
|
CatUnit("16+", "16+"),
|
||||||
CheckFilter("Бара", "bara"),
|
CatUnit("Арт", "art"),
|
||||||
CheckFilter("Боевик", "action"),
|
CatUnit("Бара", "bara"),
|
||||||
CheckFilter("Боевые искусства", "combatskill"),
|
CatUnit("Боевик", "action"),
|
||||||
CheckFilter("В цвете", "vcvete"),
|
CatUnit("Боевые искусства", "combatskill"),
|
||||||
CheckFilter("Вампиры", "vampaires"),
|
CatUnit("В цвете", "vcvete"),
|
||||||
CheckFilter("Веб", "web"),
|
CatUnit("Вампиры", "vampaires"),
|
||||||
CheckFilter("Вестерн", "western"),
|
CatUnit("Веб", "web"),
|
||||||
CheckFilter("Гарем", "harem"),
|
CatUnit("Вестерн", "western"),
|
||||||
CheckFilter("Гендерная интрига", "genderintrigue"),
|
CatUnit("Гарем", "harem"),
|
||||||
CheckFilter("Героическое фэнтези", "heroic_fantasy"),
|
CatUnit("Гендерная интрига", "genderintrigue"),
|
||||||
CheckFilter("Детектив", "detective"),
|
CatUnit("Героическое фэнтези", "heroic_fantasy"),
|
||||||
CheckFilter("Дзёсэй", "josei"),
|
CatUnit("Детектив", "detective"),
|
||||||
CheckFilter("Додзинси", "doujinshi"),
|
CatUnit("Дзёсэй", "josei"),
|
||||||
CheckFilter("Драма", "drama"),
|
CatUnit("Додзинси", "doujinshi"),
|
||||||
CheckFilter("Ёнкома", "yonkoma"),
|
CatUnit("Драма", "drama"),
|
||||||
CheckFilter("Есси", "18+"),
|
CatUnit("Ёнкома", "yonkoma"),
|
||||||
CheckFilter("Зомби", "zombie"),
|
CatUnit("Есси", "18+"),
|
||||||
CheckFilter("Игра", "games"),
|
CatUnit("Зомби", "zombie"),
|
||||||
CheckFilter("Инцест", "incest"),
|
CatUnit("Игра", "games"),
|
||||||
CheckFilter("Исекай", "isekai"),
|
CatUnit("Инцест", "incest"),
|
||||||
CheckFilter("Искусство", "iskusstvo"),
|
CatUnit("Исекай", "isekai"),
|
||||||
CheckFilter("Исторический", "historical"),
|
CatUnit("Искусство", "iskusstvo"),
|
||||||
CheckFilter("Киберпанк", "cyberpunk"),
|
CatUnit("Исторический", "historical"),
|
||||||
CheckFilter("Кодомо", "kodomo"),
|
CatUnit("Киберпанк", "cyberpunk"),
|
||||||
CheckFilter("Комедия", "comedy"),
|
CatUnit("Кодомо", "kodomo"),
|
||||||
CheckFilter("Культовое", "iconic"),
|
CatUnit("Комедия", "comedy"),
|
||||||
CheckFilter("литРПГ", "litrpg"),
|
CatUnit("Культовое", "iconic"),
|
||||||
CheckFilter("Любовь", "love"),
|
CatUnit("литРПГ", "litrpg"),
|
||||||
CheckFilter("Махо-сёдзё", "maho-shojo"),
|
CatUnit("Любовь", "love"),
|
||||||
CheckFilter("Меха", "robots"),
|
CatUnit("Махо-сёдзё", "maho-shojo"),
|
||||||
CheckFilter("Мистика", "mystery"),
|
CatUnit("Меха", "robots"),
|
||||||
CheckFilter("Мужская беременность", "male-pregnancy"),
|
CatUnit("Мистика", "mystery"),
|
||||||
CheckFilter("Музыка", "music"),
|
CatUnit("Мужская беременность", "male-pregnancy"),
|
||||||
CheckFilter("Научная фантастика", "sciencefiction"),
|
CatUnit("Музыка", "music"),
|
||||||
CheckFilter("Новинки", "new"),
|
CatUnit("Научная фантастика", "sciencefiction"),
|
||||||
CheckFilter("Омегаверс", "omegavers"),
|
CatUnit("Новинки", "new"),
|
||||||
CheckFilter("Перерождение", "newlife"),
|
CatUnit("Омегаверс", "omegavers"),
|
||||||
CheckFilter("Повседневность", "humdrum"),
|
CatUnit("Перерождение", "newlife"),
|
||||||
CheckFilter("Постапокалиптика", "postapocalyptic"),
|
CatUnit("Повседневность", "humdrum"),
|
||||||
CheckFilter("Приключения", "adventure"),
|
CatUnit("Постапокалиптика", "postapocalyptic"),
|
||||||
CheckFilter("Психология", "psychology"),
|
CatUnit("Приключения", "adventure"),
|
||||||
CheckFilter("Романтика", "romance"),
|
CatUnit("Психология", "psychology"),
|
||||||
CheckFilter("Самураи", "samurai"),
|
CatUnit("Романтика", "romance"),
|
||||||
CheckFilter("Сборник", "compilation"),
|
CatUnit("Самураи", "samurai"),
|
||||||
CheckFilter("Сверхъестественное", "supernatural"),
|
CatUnit("Сборник", "compilation"),
|
||||||
CheckFilter("Сёдзё", "shojo"),
|
CatUnit("Сверхъестественное", "supernatural"),
|
||||||
CheckFilter("Сёдзё-ай", "maho-shojo"),
|
CatUnit("Сёдзё", "shojo"),
|
||||||
CheckFilter("Сёнэн", "senen"),
|
CatUnit("Сёдзё-ай", "maho-shojo"),
|
||||||
CheckFilter("Сёнэн-ай", "shonen-ai"),
|
CatUnit("Сёнэн", "senen"),
|
||||||
CheckFilter("Сетакон", "setakon"),
|
CatUnit("Сёнэн-ай", "shonen-ai"),
|
||||||
CheckFilter("Сингл", "singl"),
|
CatUnit("Сетакон", "setakon"),
|
||||||
CheckFilter("Сказка", "fable"),
|
CatUnit("Сингл", "singl"),
|
||||||
CheckFilter("Сорс", "bdsm"),
|
CatUnit("Сказка", "fable"),
|
||||||
CheckFilter("Спорт", "sport"),
|
CatUnit("Сорс", "bdsm"),
|
||||||
CheckFilter("Супергерои", "superheroes"),
|
CatUnit("Спорт", "sport"),
|
||||||
CheckFilter("Сэйнэн", "seinen"),
|
CatUnit("Супергерои", "superheroes"),
|
||||||
CheckFilter("Танцы", "dancing"),
|
CatUnit("Сэйнэн", "seinen"),
|
||||||
CheckFilter("Трагедия", "tragedy"),
|
CatUnit("Танцы", "dancing"),
|
||||||
CheckFilter("Триллер", "thriller"),
|
CatUnit("Трагедия", "tragedy"),
|
||||||
CheckFilter("Ужасы", "horror"),
|
CatUnit("Триллер", "thriller"),
|
||||||
CheckFilter("Фантастика", "fantastic"),
|
CatUnit("Ужасы", "horror"),
|
||||||
CheckFilter("Фурри", "furri"),
|
CatUnit("Фантастика", "fantastic"),
|
||||||
CheckFilter("Фэнтези", "fantasy"),
|
CatUnit("Фурри", "furri"),
|
||||||
CheckFilter("Школа", "school"),
|
CatUnit("Фэнтези", "fantasy"),
|
||||||
CheckFilter("Эротика", "erotica"),
|
CatUnit("Школа", "school"),
|
||||||
CheckFilter("Этти", "etty"),
|
CatUnit("Эротика", "erotica"),
|
||||||
CheckFilter("Юмор", "humor"),
|
CatUnit("Этти", "etty"),
|
||||||
CheckFilter("Юри", "yuri"),
|
CatUnit("Юмор", "humor"),
|
||||||
CheckFilter("Яой", "yaoi")
|
CatUnit("Юри", "yuri"),
|
||||||
|
CatUnit("Яой", "yaoi")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue