Update extensions due to sites update. (#846)

Update korean extensions due to sites update.
This commit is contained in:
DitFranXX 2019-02-25 20:38:49 +09:00 committed by Carlos
parent d424f590ee
commit 18407b4702
7 changed files with 96 additions and 80 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: JMana'
pkgNameSuffix = 'ko.jmana'
extClass = '.JMana'
extVersionCode = 2
extVersionCode = 3
libVersion = '1.2'
}

View File

@ -15,7 +15,7 @@ import org.jsoup.nodes.Element
**/
class JMana : ParsedHttpSource() {
override val name = "JMana"
override val baseUrl = "https://www.jmana2.com"
override val baseUrl = "https://jmana1.com"
override val lang: String = "ko"
// Latest updates currently returns duplicate manga as it separates manga into chapters
@ -29,7 +29,7 @@ class JMana : ParsedHttpSource() {
val titleElement = element.select(".titBox .price").first()
val manga = SManga.create()
manga.setUrlWithoutDomain(linkElement.attr("href"))
manga.setUrlWithoutDomain(linkElement.attr("href").replace(" ", "%20"))
manga.title = titleElement.text()
manga.thumbnail_url = baseUrl + element.select(".imgBox img").attr("src")
return manga
@ -38,7 +38,7 @@ class JMana : ParsedHttpSource() {
override fun popularMangaNextPageSelector() = "div.page > ul > li"
// Do not add page parameter if page is 1 to prevent tracking.
override fun popularMangaRequest(page: Int) = GET(baseUrl + if (page > 1) "/?page=${page - 1}" else "")
override fun popularMangaRequest(page: Int) = GET("$baseUrl/frame/?page=${page - 1}")
override fun popularMangaParse(response: Response): MangasPage {
val document = response.asJsoup()
@ -61,7 +61,7 @@ class JMana : ParsedHttpSource() {
override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
override fun searchMangaNextPageSelector() = popularMangaSelector()
override fun searchMangaParse(response: Response) = popularMangaParse(response)
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = GET("$baseUrl/?keyword=$query" + if (page > 1) "&page=${page - 1}" else "")
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = GET("$baseUrl/frame/?keyword=$query&page=${page - 1}")
override fun mangaDetailsParse(document: Document): SManga {
@ -84,7 +84,7 @@ class JMana : ParsedHttpSource() {
val rawName = linkElement.text()
val chapter = SChapter.create()
chapter.url = linkElement.attr("href")
chapter.url = linkElement.attr("href").replace("book/", "book_frame/")
chapter.chapter_number = parseChapterNumber(rawName)
chapter.name = rawName.trim()
return chapter
@ -117,7 +117,6 @@ class JMana : ParsedHttpSource() {
return pages
}
// Latest not supported
override fun latestUpdatesSelector() = throw UnsupportedOperationException("This method should not be called!")

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: MangaShow.Me'
pkgNameSuffix = 'ko.mangashowme'
extClass = '.MangaShowMe'
extVersionCode = 3
extVersionCode = 4
libVersion = '1.2'
}

View File

@ -8,48 +8,50 @@ import okhttp3.Request
// TODO: Completely Implement/Update Filters(Genre/Artist).
// private class TextField(name: String, val key: String) : Filter.Text(name)
private class TextField(name: String, val key: String) : Filter.Text(name)
private class SearchCheckBox(val id: Int, name: String) : Filter.CheckBox(name)
private class SearchFieldMatch : Filter.Select<String>("Search Match", arrayOf("Not Set", "AND", "OR"))
private class SearchTagMatch : Filter.Select<String>("Tag Match", arrayOf("AND", "OR"))
private class SearchGenresList(genres: List<SearchCheckBox>) : Filter.Group<SearchCheckBox>("Genres", genres)
private class SearchNamingList(naming: List<SearchCheckBox>) : Filter.Group<SearchCheckBox>("Naming", naming)
private class SearchStatusList(status: List<SearchCheckBox>) : Filter.Group<SearchCheckBox>("Status", status)
private class SearchNamingList : Filter.Select<String>("Naming", searchNaming())
private class SearchStatusList : Filter.Select<String>("Status", searchStatus())
private fun searchNaming() = listOf(
SearchCheckBox(0, ""),
SearchCheckBox(1, ""),
SearchCheckBox(2, ""),
SearchCheckBox(3, ""),
SearchCheckBox(4, ""),
SearchCheckBox(5, ""),
SearchCheckBox(6, ""),
SearchCheckBox(7, ""),
SearchCheckBox(8, ""),
SearchCheckBox(9, ""),
SearchCheckBox(10, ""),
SearchCheckBox(11, ""),
SearchCheckBox(12, ""),
SearchCheckBox(13, ""),
SearchCheckBox(14, ""),
SearchCheckBox(15, ""),
SearchCheckBox(16, ""),
SearchCheckBox(17, ""),
SearchCheckBox(18, ""),
SearchCheckBox(19, "A-Z"),
SearchCheckBox(20, "0-9")
private fun searchNaming() = arrayOf(
"Not Set",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"A-Z",
"0-9"
)
private fun searchStatus() = listOf(
SearchCheckBox(0, "미분류"),
SearchCheckBox(1, "주간"),
SearchCheckBox(2, "격주"),
SearchCheckBox(3, "월간"),
SearchCheckBox(4, "격월/비정기"),
SearchCheckBox(5, "단편"),
SearchCheckBox(6, "단행본"),
SearchCheckBox(7, "완결")
private fun searchStatus() = arrayOf(
"Not Set",
"미분류",
"주간",
"격주",
"월간",
"격월/비정기",
"단편",
"단행본",
"완결"
)
private fun searchGenres() = listOf(
@ -87,14 +89,14 @@ private fun searchGenres() = listOf(
)
fun getFilters() = FilterList(
SearchNamingList(searchNaming()),
SearchStatusList(searchStatus()),
SearchNamingList(),
SearchStatusList(),
SearchGenresList(searchGenres()),
Filter.Separator(),
SearchFieldMatch(),
SearchTagMatch()
//Filter.Separator(),
//TextField("Author/Artist (Accurate full name)", "author")
SearchTagMatch(),
Filter.Separator(),
TextField("Author/Artist (Exact Search)", "author")
)
fun searchComplexFilterMangaRequestBuilder(baseUrl: String, page: Int, query: String, filters: FilterList): Request {
@ -115,19 +117,30 @@ fun searchComplexFilterMangaRequestBuilder(baseUrl: String, page: Int, query: St
return GET(url.toString())
}
val nameFilter = mutableListOf<Int>()
val statusFilter = mutableListOf<Int>()
var nameFilter: Int? = null
var statusFilter: Int? = null
val genresFilter = mutableListOf<String>()
var matchFieldFilter = 0
var matchTagFilter = 1
var authorFilter: String? = null
filters.forEach { filter ->
when (filter) {
is SearchFieldMatch -> {
matchFieldFilter = filter.state
}
is TextField -> {
if (filter.key == "author" && !filter.state.isEmpty()) {
authorFilter = filter.state
}
}
}
}
if (!authorFilter.isNullOrEmpty()) {
return GET("$baseUrl/bbs/page.php?hid=manga_list&sfl=4&stx=$authorFilter&page=${page - 1}")
}
filters.forEach { filter ->
when (filter) {
@ -138,18 +151,14 @@ fun searchComplexFilterMangaRequestBuilder(baseUrl: String, page: Int, query: St
}
is SearchNamingList -> {
filter.state.forEach {
if (it.state) {
nameFilter.add(it.id)
}
if (filter.state > 0) {
nameFilter = filter.state - 1
}
}
is SearchStatusList -> {
filter.state.forEach {
if (it.state) {
statusFilter.add(it.id)
}
if (filter.state > 0) {
statusFilter = filter.state - 1
}
}
@ -160,14 +169,6 @@ fun searchComplexFilterMangaRequestBuilder(baseUrl: String, page: Int, query: St
}
}
}
// is TextField -> {
// if (type == 4 && filter.key == "author") {
// if (filter.key.length > 1) {
// return GET("$baseUrl/bbs/page.php?hid=manga_list&sfl=4&stx=${filter.state}")
// }
// }
// }
}
}
@ -176,14 +177,14 @@ fun searchComplexFilterMangaRequestBuilder(baseUrl: String, page: Int, query: St
return normalSearch(matchFieldFilter)
}
if (nameFilter.isEmpty() && statusFilter.isEmpty() && genresFilter.isEmpty()) {
if (nameFilter == null && statusFilter == null && genresFilter.isEmpty()) {
return GET("$baseUrl/bbs/page.php?hid=manga_list")
}
val url = HttpUrl.parse("$baseUrl/bbs/page.php?hid=manga_list")!!.newBuilder()
url.addQueryParameter("search_type", matchTagFilter.toString())
url.addQueryParameter("_1", nameFilter.joinToString(","))
url.addQueryParameter("_2", statusFilter.joinToString(","))
url.addQueryParameter("_1", nameFilter?.toString() ?: "")
url.addQueryParameter("_2", statusFilter?.toString() ?: "")
url.addQueryParameter("_3", genresFilter.joinToString(","))
if (page > 1) {
url.addQueryParameter("page", "${page - 1}")

View File

@ -134,7 +134,6 @@ class MangaShowMe : ParsedHttpSource() {
private fun parseStatus(status: String) = when (status.trim()) {
"주간", "격주", "월간", "격월/비정기", "단행본" -> SManga.ONGOING
"단편", "완결" -> SManga.COMPLETED
// "미분류", "" -> SManga.UNKNOWN
else -> SManga.UNKNOWN
}
@ -156,7 +155,7 @@ class MangaShowMe : ParsedHttpSource() {
val rawName = linkElement.select("div.title").last()
val chapter = SChapter.create()
chapter.url = linkElement.attr("href")
chapter.setUrlWithoutDomain(linkElement.attr("href"))
chapter.chapter_number = parseChapterNumber(rawName.text())
chapter.name = rawName.ownText().trim()
chapter.date_upload = parseChapterDate(element.select("div.addedAt").text().split(" ").first())
@ -199,7 +198,7 @@ class MangaShowMe : ParsedHttpSource() {
// They are using full url in every links.
// There's possibility to using another domain for serve manga(s). Like marumaru.
override fun pageListRequest(chapter: SChapter) = GET(chapter.url, headers)
//override fun pageListRequest(chapter: SChapter) = GET(chapter.url, headers)
override fun pageListParse(document: Document): List<Page> {
val pages = mutableListOf<Page>()

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: NewToki'
pkgNameSuffix = 'ko.newtoki'
extClass = '.NewToki'
extVersionCode = 3
extVersionCode = 4
libVersion = '1.2'
}

View File

@ -84,21 +84,38 @@ class NewToki : ParsedHttpSource() {
override fun mangaDetailsParse(document: Document): SManga {
val info = document.select("div.view-title > .view-content").first()
val authorText = info.select("span.label.btn-info").text()
val title = info.select("div.view-content > span[style] > b").text()
val genres = mutableListOf<String>()
info.select("span.label.label-success").forEach {
genres.add(it.text())
val title = document.select("div.view-content > span > b").text()
val descriptionElement = info.select("div.row div.view-content:not([style])")
val description = descriptionElement.map {
it.text().trim()
}
val manga = SManga.create()
manga.title = title
manga.author = authorText
manga.description = description.joinToString("\n")
descriptionElement.forEach {
val text = it.text()
when {
"작가" in text -> manga.author = it.getElementsByTag("a").text()
"분류" in text -> {
val genres = mutableListOf<String>()
it.getElementsByTag("a").forEach { item ->
genres.add(item.text())
}
manga.genre = genres.joinToString(", ")
manga.status = SManga.UNKNOWN
}
"발행구분" in text -> manga.status = parseStatus(it.getElementsByTag("a").text())
}
}
return manga
}
private fun parseStatus(status: String) = when (status.trim()) {
"주간", "격주", "월간", "격월/비정기", "단행본" -> SManga.ONGOING
"단편", "완결" -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
override fun chapterListSelector() = "div.serial-list > ul.list-body > li.list-item"
override fun chapterFromElement(element: Element): SChapter {