update mint/readmanga (#137)

* update mint/read manga to external source to match most up to date of internal tachiyomi app

* fixed incorrect package

* updated version code

* reverted extVersionSuffix

* updated to latest LibVersion
updated extVersion

* fixed suffix since doesn't need to increment since lib did.
This commit is contained in:
Carlos 2017-12-09 10:09:20 -05:00 committed by inorichi
parent f90e8fef3c
commit 72a6ca9712
4 changed files with 39 additions and 52 deletions

View File

@ -5,9 +5,9 @@ ext {
appName = 'Tachiyomi: Mintmanga' appName = 'Tachiyomi: Mintmanga'
pkgNameSuffix = "ru.mintmanga" pkgNameSuffix = "ru.mintmanga"
extClass = '.Mintmanga' extClass = '.Mintmanga'
extVersionCode = 2 extVersionCode = 3
extVersionSuffix = 2 extVersionSuffix = 0
libVersion = '1.0' libVersion = '1.2'
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -23,13 +23,11 @@ class Mintmanga : ParsedHttpSource() {
override val supportsLatest = true override val supportsLatest = true
override fun popularMangaRequest(page: Int): Request { override fun popularMangaRequest(page: Int): Request =
return GET("$baseUrl/list?sortType=rate&offset=${70 * (page - 1)}&max=70", headers) GET("$baseUrl/list?sortType=rate&offset=${70 * (page - 1)}&max=70", headers)
}
override fun latestUpdatesRequest(page: Int): Request { override fun latestUpdatesRequest(page: Int): Request =
return GET("$baseUrl/list?sortType=updated&offset=${70 * (page - 1)}&max=70", headers) GET("$baseUrl/list?sortType=updated&offset=${70 * (page - 1)}&max=70", headers)
}
override fun popularMangaSelector() = "div.desc" override fun popularMangaSelector() = "div.desc"
@ -44,24 +42,21 @@ class Mintmanga : ParsedHttpSource() {
return manga return manga
} }
override fun latestUpdatesFromElement(element: Element): SManga { override fun latestUpdatesFromElement(element: Element): SManga =
return popularMangaFromElement(element) popularMangaFromElement(element)
}
override fun popularMangaNextPageSelector() = "a.nextLink" override fun popularMangaNextPageSelector() = "a.nextLink"
override fun latestUpdatesNextPageSelector() = "a.nextLink" override fun latestUpdatesNextPageSelector() = "a.nextLink"
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val genres = filters.filterIsInstance<Genre>().map { it.id + arrayOf("=", "=in", "=ex")[it.state] }.joinToString("&") val genres = filters.filterIsInstance<Genre>().joinToString("&") { it.id + arrayOf("=", "=in", "=ex")[it.state] }
return GET("$baseUrl/search?q=$query&$genres", headers) return GET("$baseUrl/search/advanced?q=$query&$genres", headers)
} }
override fun searchMangaSelector() = popularMangaSelector() override fun searchMangaSelector() = popularMangaSelector()
override fun searchMangaFromElement(element: Element): SManga { override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element)
return popularMangaFromElement(element)
}
// max 200 results // max 200 results
override fun searchMangaNextPageSelector() = null override fun searchMangaNextPageSelector() = null
@ -78,13 +73,11 @@ class Mintmanga : ParsedHttpSource() {
return manga return manga
} }
private fun parseStatus(element: String): Int { private fun parseStatus(element: String): Int = when {
when { element.contains("<h3>Запрещена публикация произведения по копирайту</h3>") -> SManga.LICENSED
element.contains("<h3>Запрещена публикация произведения по копирайту</h3>") -> return SManga.LICENSED element.contains("<h1 class=\"names\"> Сингл") || element.contains("<b>Перевод:</b> завершен") -> SManga.COMPLETED
element.contains("<h1 class=\"names\"> Сингл") || element.contains("<b>Перевод:</b> завершен") -> return SManga.COMPLETED element.contains("<b>Перевод:</b> продолжается") -> SManga.ONGOING
element.contains("<b>Перевод:</b> продолжается") -> return SManga.ONGOING else -> SManga.UNKNOWN
else -> return SManga.UNKNOWN
}
} }
override fun chapterListSelector() = "div.chapters-link tbody tr" override fun chapterListSelector() = "div.chapters-link tbody tr"
@ -125,7 +118,7 @@ class Mintmanga : ParsedHttpSource() {
val endIndex = html.indexOf("], 0, false);", beginIndex) val endIndex = html.indexOf("], 0, false);", beginIndex)
val trimmedHtml = html.substring(beginIndex, endIndex) val trimmedHtml = html.substring(beginIndex, endIndex)
val p = Pattern.compile("'.+?','.+?',\".+?\"") val p = Pattern.compile("'.*?','.*?',\".*?\"")
val m = p.matcher(trimmedHtml) val m = p.matcher(trimmedHtml)
val pages = mutableListOf<Page>() val pages = mutableListOf<Page>()
@ -149,7 +142,7 @@ class Mintmanga : ParsedHttpSource() {
/* [...document.querySelectorAll("tr.advanced_option:nth-child(1) > td:nth-child(3) span.js-link")].map((el,i) => { /* [...document.querySelectorAll("tr.advanced_option:nth-child(1) > td:nth-child(3) span.js-link")].map((el,i) => {
* const onClick=el.getAttribute('onclick');const id=onClick.substr(31,onClick.length-33); * const onClick=el.getAttribute('onclick');const id=onClick.substr(31,onClick.length-33);
* return `Genre("${el.textContent.trim()}", "${id}")` }).join(',\n') * return `Genre("${el.textContent.trim()}", "${id}")` }).join(',\n')
* on http://mintmanga.com/search * on http://mintmanga.com/search/advanced
*/ */
override fun getFilterList() = FilterList( override fun getFilterList() = FilterList(
Genre("арт", "el_2220"), Genre("арт", "el_2220"),
@ -171,6 +164,7 @@ class Mintmanga : ParsedHttpSource() {
Genre("меха", "el_1318"), Genre("меха", "el_1318"),
Genre("мистика", "el_1324"), Genre("мистика", "el_1324"),
Genre("научная фантастика", "el_1325"), Genre("научная фантастика", "el_1325"),
Genre("омегаверс", "el_5676"),
Genre("повседневность", "el_1327"), Genre("повседневность", "el_1327"),
Genre("постапокалиптика", "el_1342"), Genre("постапокалиптика", "el_1342"),
Genre("приключения", "el_1322"), Genre("приключения", "el_1322"),

View File

@ -5,9 +5,9 @@ ext {
appName = 'Tachiyomi: Readmanga' appName = 'Tachiyomi: Readmanga'
pkgNameSuffix = "ru.readmanga" pkgNameSuffix = "ru.readmanga"
extClass = '.Readmanga' extClass = '.Readmanga'
extVersionCode = 2 extVersionCode = 3
extVersionSuffix = 2 extVersionSuffix = 0
libVersion = '1.0' libVersion = '1.2'
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -27,13 +27,11 @@ class Readmanga : ParsedHttpSource() {
override fun latestUpdatesSelector() = "div.desc" override fun latestUpdatesSelector() = "div.desc"
override fun popularMangaRequest(page: Int): Request { override fun popularMangaRequest(page: Int): Request =
return GET("$baseUrl/list?sortType=rate&offset=${70 * (page - 1)}&max=70", headers) GET("$baseUrl/list?sortType=rate&offset=${70 * (page - 1)}&max=70", headers)
}
override fun latestUpdatesRequest(page: Int): Request { override fun latestUpdatesRequest(page: Int): Request =
return GET("$baseUrl/list?sortType=updated&offset=${70 * (page - 1)}&max=70", headers) GET("$baseUrl/list?sortType=updated&offset=${70 * (page - 1)}&max=70", headers)
}
override fun popularMangaFromElement(element: Element): SManga { override fun popularMangaFromElement(element: Element): SManga {
val manga = SManga.create() val manga = SManga.create()
@ -44,24 +42,21 @@ class Readmanga : ParsedHttpSource() {
return manga return manga
} }
override fun latestUpdatesFromElement(element: Element): SManga { override fun latestUpdatesFromElement(element: Element): SManga =
return popularMangaFromElement(element) popularMangaFromElement(element)
}
override fun popularMangaNextPageSelector() = "a.nextLink" override fun popularMangaNextPageSelector() = "a.nextLink"
override fun latestUpdatesNextPageSelector() = "a.nextLink" override fun latestUpdatesNextPageSelector() = "a.nextLink"
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val genres = filters.filterIsInstance<Genre>().map { it.id + arrayOf("=", "=in", "=ex")[it.state] }.joinToString("&") val genres = filters.filterIsInstance<Genre>().joinToString("&") { it.id + arrayOf("=", "=in", "=ex")[it.state] }
return GET("$baseUrl/search?q=$query&$genres", headers) return GET("$baseUrl/search/advanced?q=$query&$genres", headers)
} }
override fun searchMangaSelector() = popularMangaSelector() override fun searchMangaSelector() = popularMangaSelector()
override fun searchMangaFromElement(element: Element): SManga { override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element)
return popularMangaFromElement(element)
}
// max 200 results // max 200 results
override fun searchMangaNextPageSelector() = null override fun searchMangaNextPageSelector() = null
@ -78,13 +73,11 @@ class Readmanga : ParsedHttpSource() {
return manga return manga
} }
private fun parseStatus(element: String): Int { private fun parseStatus(element: String): Int = when {
when { element.contains("<h3>Запрещена публикация произведения по копирайту</h3>") -> SManga.LICENSED
element.contains("<h3>Запрещена публикация произведения по копирайту</h3>") -> return SManga.LICENSED element.contains("<h1 class=\"names\"> Сингл") || element.contains("<b>Перевод:</b> завершен") -> SManga.COMPLETED
element.contains("<h1 class=\"names\"> Сингл") || element.contains("<b>Перевод:</b> завершен") -> return SManga.COMPLETED element.contains("<b>Перевод:</b> продолжается") -> SManga.ONGOING
element.contains("<b>Перевод:</b> продолжается") -> return SManga.ONGOING else -> SManga.UNKNOWN
else -> return SManga.UNKNOWN
}
} }
override fun chapterListSelector() = "div.chapters-link tbody tr" override fun chapterListSelector() = "div.chapters-link tbody tr"
@ -125,7 +118,7 @@ class Readmanga : ParsedHttpSource() {
val endIndex = html.indexOf("], 0, false);", beginIndex) val endIndex = html.indexOf("], 0, false);", beginIndex)
val trimmedHtml = html.substring(beginIndex, endIndex) val trimmedHtml = html.substring(beginIndex, endIndex)
val p = Pattern.compile("'.+?','.+?',\".+?\"") val p = Pattern.compile("'.*?','.*?',\".*?\"")
val m = p.matcher(trimmedHtml) val m = p.matcher(trimmedHtml)
val pages = mutableListOf<Page>() val pages = mutableListOf<Page>()
@ -149,7 +142,7 @@ class Readmanga : ParsedHttpSource() {
/* [...document.querySelectorAll("tr.advanced_option:nth-child(1) > td:nth-child(3) span.js-link")].map((el,i) => { /* [...document.querySelectorAll("tr.advanced_option:nth-child(1) > td:nth-child(3) span.js-link")].map((el,i) => {
* const onClick=el.getAttribute('onclick');const id=onClick.substr(31,onClick.length-33); * const onClick=el.getAttribute('onclick');const id=onClick.substr(31,onClick.length-33);
* return `Genre("${el.textContent.trim()}", "${id}")` }).join(',\n') * return `Genre("${el.textContent.trim()}", "${id}")` }).join(',\n')
* on http://readmanga.me/search * on http://readmanga.me/search/advanced
*/ */
override fun getFilterList() = FilterList( override fun getFilterList() = FilterList(
Genre("арт", "el_5685"), Genre("арт", "el_5685"),