HentaiMimi: fix pages for titles with comma, order filters alphabetically (#6898)

* Fix pages when title contains comma

* Sort filters for easier search

* Bump version

* Remove extra new line at the end of the generated file
This commit is contained in:
scb261 2021-05-08 16:28:27 +03:00 committed by GitHub
parent deec443983
commit 6be3b361fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1372 additions and 1372 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'HentaiMimi' extName = 'HentaiMimi'
pkgNameSuffix = 'en.hentaimimi' pkgNameSuffix = 'en.hentaimimi'
extClass = '.HentaiMimi' extClass = '.HentaiMimi'
extVersionCode = 1 extVersionCode = 2
libVersion = '1.2' libVersion = '1.2'
containsNsfw = true containsNsfw = true
} }

View File

@ -34,13 +34,13 @@ class FilterOptGen {
types.forEach { types.forEach {
try { try {
val document = getDocument("https://hentaimimi.com/search") val document = getDocument("https://hentaimimi.com/search")
val ids = parseIds(document!!, it) val ids = parseIds(document!!, it).sortedBy { id -> id.first }
buffer.append("fun $it() = listOf(\n") buffer.append("fun $it() = listOf(\n")
for (id in ids) { for (id in ids) {
when (it) { when (it) {
"tags" -> buffer.append(" HentaiMimi.TriStateFilterOption(\"${id.first}\",\"${id.second}\"),\n") "tags" -> buffer.append(" HentaiMimi.TriStateFilterOption(\"${id.first}\", \"${id.second}\"),\n")
else -> buffer.append(" HentaiMimi.CheckboxFilterOption(\"${id.first}\",\"${id.second}\"),\n") else -> buffer.append(" HentaiMimi.CheckboxFilterOption(\"${id.first}\", \"${id.second}\"),\n")
} }
} }
buffer.append(")\n\n") buffer.append(")\n\n")
@ -49,6 +49,7 @@ class FilterOptGen {
println("error generating source $it ${e.printStackTrace()}") println("error generating source $it ${e.printStackTrace()}")
} }
} }
buffer.setLength(buffer.length - 1)
println("Post-run types: ${number - 1}") println("Post-run types: ${number - 1}")
val writer = PrintWriter(relativePath) val writer = PrintWriter(relativePath)
writer.write(buffer.toString()) writer.write(buffer.toString())

View File

@ -144,7 +144,7 @@ class HentaiMimi : ParsedHttpSource() {
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
val pages = mutableListOf<Page>() val pages = mutableListOf<Page>()
document.select("body main script").html().substringAfter("[").substringBefore("]").split(",").forEachIndexed { index, it -> document.select("body main script").html().substringAfter("[").substringBefore("]").split("\",\"").forEachIndexed { index, it ->
val url = "$baseUrl/${it.replace("\\", "").replace("\"", "")}" val url = "$baseUrl/${it.replace("\\", "").replace("\"", "")}"
pages.add(Page(index, url, url)) pages.add(Page(index, url, url))
} }