WNACG | Added Tag Filter, Added Some New Category Options (#11478)
* Added Tag Filter, Added Some New Category Options * Removed unused imports * Applied AwkwardPeak7's Suggestions
This commit is contained in:
parent
3c22c12ad7
commit
afbb0796d9
@ -1,7 +1,7 @@
|
||||
ext {
|
||||
extName = 'WNACG'
|
||||
extClass = '.wnacg'
|
||||
extVersionCode = 19
|
||||
extVersionCode = 20
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import okhttp3.Response
|
||||
import java.io.IOException
|
||||
import kotlin.random.Random
|
||||
|
||||
private const val DEFAULT_LIST = "https://www.wn01.uk,https://www.wn05.cc,https://www.wn04.cc,https://www.wn03.cc"
|
||||
private const val DEFAULT_LIST = "https://www.wn05.ru,https://www.wn04.ru,https://www.wnacg05.cc"
|
||||
|
||||
fun getPreferencesInternal(
|
||||
context: Context,
|
||||
|
||||
@ -54,8 +54,12 @@ class wnacg : ParsedHttpSource(), ConfigurableSource {
|
||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||
if (query.isBlank()) {
|
||||
filters.forEach { filter ->
|
||||
if (filter is CategoryFilter) {
|
||||
return GET("$baseUrl/" + filter.toUriPart().format(page), headers)
|
||||
if (filter is TagFilter) {
|
||||
return GET("$baseUrl/" + "albums-index-page-%d-tag-${filter.state}".format(page), headers)
|
||||
} else if (filter is CategoryFilter) {
|
||||
if (filter.toUriPart().isNotBlank()) {
|
||||
return GET("$baseUrl/" + filter.toUriPart().format(page), headers)
|
||||
}
|
||||
}
|
||||
}
|
||||
return popularMangaRequest(page)
|
||||
@ -98,18 +102,17 @@ class wnacg : ParsedHttpSource(), ConfigurableSource {
|
||||
return Observable.just(listOf(chapter))
|
||||
}
|
||||
|
||||
override fun mangaDetailsParse(document: Document): SManga {
|
||||
val manga = SManga.create()
|
||||
manga.title = document.selectFirst("h2")?.text() ?: "Unknown"
|
||||
manga.artist = document.selectFirst("div.uwuinfo p")?.text() ?: "Unknown"
|
||||
manga.author = document.selectFirst("div.uwuinfo p")?.text() ?: "Unknown"
|
||||
manga.thumbnail_url =
|
||||
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
|
||||
title = document.selectFirst("h2")!!.text()
|
||||
artist = document.selectFirst("div.uwuinfo p")?.text()
|
||||
author = document.selectFirst("div.uwuinfo p")?.text()
|
||||
genre = document.select("a.tagshow").eachText().joinToString(", ").ifEmpty { null }
|
||||
thumbnail_url =
|
||||
"http:" + document.selectFirst("div.uwthumb img")!!.attr("src")
|
||||
manga.description =
|
||||
description =
|
||||
document.selectFirst("div.asTBcell p")?.html()?.replace("<br>", "\n")
|
||||
|
||||
manga.status = SManga.COMPLETED
|
||||
return manga
|
||||
status = SManga.COMPLETED
|
||||
}
|
||||
|
||||
override fun pageListRequest(chapter: SChapter) =
|
||||
@ -134,24 +137,41 @@ class wnacg : ParsedHttpSource(), ConfigurableSource {
|
||||
// >>> Filters >>>
|
||||
|
||||
override fun getFilterList() = FilterList(
|
||||
Filter.Header("注意:分类不支持搜索"),
|
||||
Filter.Header("注意:分类和标签均不支持搜索"),
|
||||
CategoryFilter(),
|
||||
Filter.Separator(),
|
||||
Filter.Header("注意:仅支持 1 个标签,不支持分类"),
|
||||
TagFilter(),
|
||||
)
|
||||
|
||||
private class TagFilter : Filter.Text(name = "标签")
|
||||
private class CategoryFilter : UriPartFilter(
|
||||
"分类",
|
||||
arrayOf(
|
||||
Pair("", ""),
|
||||
Pair("更新", "albums-index-page-%d.html"),
|
||||
Pair("同人志", "albums-index-page-%d-cate-5.html"),
|
||||
Pair("同人志-汉化", "albums-index-page-%d-cate-1.html"),
|
||||
Pair("同人志-日语", "albums-index-page-%d-cate-12.html"),
|
||||
Pair("同人志-English(英语)", "albums-index-cate-16.html"),
|
||||
Pair("同人志-CG书籍", "albums-index-page-%d-cate-2.html"),
|
||||
Pair("同人志-Cosplay", "albums-index-page-%d-cate-3.html"),
|
||||
Pair("写真&Cosplay", "albums-index-page-%d-cate-3.html"),
|
||||
Pair("单行本", "albums-index-page-%d-cate-6.html"),
|
||||
Pair("单行本-汉化", "albums-index-page-%d-cate-9.html"),
|
||||
Pair("单行本-English(英语)", "albums-index-page-%d-cate-17.html"),
|
||||
Pair("单行本-日语", "albums-index-page-%d-cate-13.html"),
|
||||
Pair("杂志&短篇-汉语", "albums-index-page-%d-cate-7.html"),
|
||||
Pair("杂志&短篇-汉语", "albums-index-page-%d-cate-10.html"),
|
||||
Pair("杂志&短篇-日语", "albums-index-page-%d-cate-14.html"),
|
||||
Pair("杂志&短篇-English(英语)", "albums-index-cate-18.html"),
|
||||
Pair("韩漫", "albums-index-page-%d-cate-19.html"),
|
||||
Pair("韩漫-汉化", "albums-index-page-%d-cate-20.html"),
|
||||
Pair("韩漫-生肉", "albums-index-page-%d-cate-21.html"),
|
||||
Pair("3D&漫画", "albums-index-page-%d-cate-22.html"),
|
||||
Pair("3D&漫画-汉语", "albums-index-page-%d-cate-23.html"),
|
||||
Pair("3D&漫画-其他", "albums-index-page-%d-cate-24.html"),
|
||||
Pair("AI图集", "albums-index-page-%d-cate-37.html"),
|
||||
Pair("未分類相冊", "albums-index-page-%d-cate-0.html"),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user