parent
921649ff76
commit
8737cc41f2
|
@ -3,7 +3,7 @@ ext {
|
||||||
extClass = '.MangasNoSekai'
|
extClass = '.MangasNoSekai'
|
||||||
themePkg = 'madara'
|
themePkg = 'madara'
|
||||||
baseUrl = 'https://mangasnosekai.com'
|
baseUrl = 'https://mangasnosekai.com'
|
||||||
overrideVersionCode = 6
|
overrideVersionCode = 7
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -188,26 +188,21 @@ class MangasNoSekai : Madara(
|
||||||
return POST("$baseUrl/wp-admin/admin-ajax.php", xhrHeaders, form)
|
return POST("$baseUrl/wp-admin/admin-ajax.php", xhrHeaders, form)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val altChapterListSelector = "div.wp-manga-chapter"
|
private val altChapterListSelector = "body > div > div"
|
||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
launchIO { countViews(document) }
|
launchIO { countViews(document) }
|
||||||
|
|
||||||
val mangaUrl = document.location().removeSuffix("/")
|
|
||||||
|
|
||||||
var xhrRequest = xhrChaptersRequest(mangaUrl)
|
|
||||||
var xhrResponse = client.newCall(xhrRequest).execute()
|
|
||||||
|
|
||||||
val chapterElements = xhrResponse.asJsoup().select(chapterListSelector())
|
|
||||||
if (chapterElements.isEmpty()) {
|
|
||||||
val mangaId = document.selectFirst("div.tab-summary > script:containsData(manga_id)")?.data()
|
val mangaId = document.selectFirst("div.tab-summary > script:containsData(manga_id)")?.data()
|
||||||
?.let { MANGA_ID_REGEX.find(it)?.groupValues?.get(1) }
|
?.let { MANGA_ID_REGEX.find(it)?.groupValues?.get(1) }
|
||||||
?: throw Exception("No se pudo obtener el id del manga")
|
?: throw Exception("No se pudo obtener el id del manga")
|
||||||
|
|
||||||
|
val chapterElements = mutableListOf<Element>()
|
||||||
var page = 1
|
var page = 1
|
||||||
do {
|
do {
|
||||||
xhrRequest = altChapterRequest(mangaId, page)
|
val xhrRequest = altChapterRequest(mangaId, page)
|
||||||
xhrResponse = client.newCall(xhrRequest).execute()
|
val xhrResponse = client.newCall(xhrRequest).execute()
|
||||||
val xhrDocument = xhrResponse.asJsoup()
|
val xhrDocument = xhrResponse.asJsoup()
|
||||||
chapterElements.addAll(xhrDocument.select(altChapterListSelector))
|
chapterElements.addAll(xhrDocument.select(altChapterListSelector))
|
||||||
page++
|
page++
|
||||||
|
@ -216,9 +211,6 @@ class MangasNoSekai : Madara(
|
||||||
return chapterElements.map(::altChapterFromElement)
|
return chapterElements.map(::altChapterFromElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
return chapterElements.map(::chapterFromElement)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun altChapterFromElement(element: Element) = SChapter.create().apply {
|
private fun altChapterFromElement(element: Element) = SChapter.create().apply {
|
||||||
setUrlWithoutDomain(element.selectFirst("a")!!.attr("abs:href"))
|
setUrlWithoutDomain(element.selectFirst("a")!!.attr("abs:href"))
|
||||||
name = element.select("div.text-sm").text()
|
name = element.select("div.text-sm").text()
|
||||||
|
|
Loading…
Reference in New Issue