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 {
|
ext {
|
||||||
extName = 'WNACG'
|
extName = 'WNACG'
|
||||||
extClass = '.wnacg'
|
extClass = '.wnacg'
|
||||||
extVersionCode = 19
|
extVersionCode = 20
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import okhttp3.Response
|
|||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import kotlin.random.Random
|
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(
|
fun getPreferencesInternal(
|
||||||
context: Context,
|
context: Context,
|
||||||
|
|||||||
@ -54,10 +54,14 @@ class wnacg : ParsedHttpSource(), ConfigurableSource {
|
|||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
if (query.isBlank()) {
|
if (query.isBlank()) {
|
||||||
filters.forEach { filter ->
|
filters.forEach { filter ->
|
||||||
if (filter is CategoryFilter) {
|
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 GET("$baseUrl/" + filter.toUriPart().format(page), headers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return popularMangaRequest(page)
|
return popularMangaRequest(page)
|
||||||
}
|
}
|
||||||
val builder = "$baseUrl/search/index.php".toHttpUrl().newBuilder()
|
val builder = "$baseUrl/search/index.php".toHttpUrl().newBuilder()
|
||||||
@ -98,18 +102,17 @@ class wnacg : ParsedHttpSource(), ConfigurableSource {
|
|||||||
return Observable.just(listOf(chapter))
|
return Observable.just(listOf(chapter))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mangaDetailsParse(document: Document): SManga {
|
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
|
||||||
val manga = SManga.create()
|
title = document.selectFirst("h2")!!.text()
|
||||||
manga.title = document.selectFirst("h2")?.text() ?: "Unknown"
|
artist = document.selectFirst("div.uwuinfo p")?.text()
|
||||||
manga.artist = document.selectFirst("div.uwuinfo p")?.text() ?: "Unknown"
|
author = document.selectFirst("div.uwuinfo p")?.text()
|
||||||
manga.author = document.selectFirst("div.uwuinfo p")?.text() ?: "Unknown"
|
genre = document.select("a.tagshow").eachText().joinToString(", ").ifEmpty { null }
|
||||||
manga.thumbnail_url =
|
thumbnail_url =
|
||||||
"http:" + document.selectFirst("div.uwthumb img")!!.attr("src")
|
"http:" + document.selectFirst("div.uwthumb img")!!.attr("src")
|
||||||
manga.description =
|
description =
|
||||||
document.selectFirst("div.asTBcell p")?.html()?.replace("<br>", "\n")
|
document.selectFirst("div.asTBcell p")?.html()?.replace("<br>", "\n")
|
||||||
|
|
||||||
manga.status = SManga.COMPLETED
|
status = SManga.COMPLETED
|
||||||
return manga
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListRequest(chapter: SChapter) =
|
override fun pageListRequest(chapter: SChapter) =
|
||||||
@ -134,24 +137,41 @@ class wnacg : ParsedHttpSource(), ConfigurableSource {
|
|||||||
// >>> Filters >>>
|
// >>> Filters >>>
|
||||||
|
|
||||||
override fun getFilterList() = FilterList(
|
override fun getFilterList() = FilterList(
|
||||||
Filter.Header("注意:分类不支持搜索"),
|
Filter.Header("注意:分类和标签均不支持搜索"),
|
||||||
CategoryFilter(),
|
CategoryFilter(),
|
||||||
|
Filter.Separator(),
|
||||||
|
Filter.Header("注意:仅支持 1 个标签,不支持分类"),
|
||||||
|
TagFilter(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private class TagFilter : Filter.Text(name = "标签")
|
||||||
private class CategoryFilter : UriPartFilter(
|
private class CategoryFilter : UriPartFilter(
|
||||||
"分类",
|
"分类",
|
||||||
arrayOf(
|
arrayOf(
|
||||||
|
Pair("", ""),
|
||||||
Pair("更新", "albums-index-page-%d.html"),
|
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-1.html"),
|
||||||
Pair("同人志-日语", "albums-index-page-%d-cate-12.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("同人志-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("单行本-汉化", "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-13.html"),
|
||||||
|
Pair("杂志&短篇-汉语", "albums-index-page-%d-cate-7.html"),
|
||||||
Pair("杂志&短篇-汉语", "albums-index-page-%d-cate-10.html"),
|
Pair("杂志&短篇-汉语", "albums-index-page-%d-cate-10.html"),
|
||||||
Pair("杂志&短篇-日语", "albums-index-page-%d-cate-14.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-20.html"),
|
||||||
Pair("韩漫-生肉", "albums-index-page-%d-cate-21.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