parent
97a8bb1ca7
commit
e9d473711d
@ -1,12 +1,49 @@
|
|||||||
package org.koitharu.kotatsu.parsers.site.madara.pt
|
package org.koitharu.kotatsu.parsers.site.madara.pt
|
||||||
|
|
||||||
|
import org.jsoup.nodes.Document
|
||||||
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||||
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||||
|
import org.koitharu.kotatsu.parsers.model.MangaChapter
|
||||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||||
import org.koitharu.kotatsu.parsers.site.madara.MadaraParser
|
import org.koitharu.kotatsu.parsers.site.madara.MadaraParser
|
||||||
|
import org.koitharu.kotatsu.parsers.util.*
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
|
||||||
@MangaSourceParser("NEOX_SCANS", "NeoxScans", "pt")
|
@MangaSourceParser("NEOX_SCANS", "NeoxScans", "pt")
|
||||||
internal class Neoxscans(context: MangaLoaderContext) :
|
internal open class Neoxscans(context: MangaLoaderContext) :
|
||||||
MadaraParser(context, MangaSource.NEOX_SCANS, "neoxscan.net", 18) {
|
MadaraParser(context, MangaSource.NEOX_SCANS, "neoxscan.net", 18) {
|
||||||
override val datePattern = "dd/MM/yyyy"
|
override val datePattern = "dd/MM/yyyy"
|
||||||
|
|
||||||
|
override suspend fun loadChapters(mangaUrl: String, document: Document): List<MangaChapter> {
|
||||||
|
val doc = if (postReq) {
|
||||||
|
val mangaId = document.select("div#manga-chapters-holder").attr("data-id")
|
||||||
|
val url = "https://$domain/wp-admin/admin-ajax.php"
|
||||||
|
val postdata = "action=manga_get_chapters&manga=$mangaId"
|
||||||
|
webClient.httpPost(url, postdata).parseHtml()
|
||||||
|
} else {
|
||||||
|
val url = mangaUrl.toAbsoluteUrl(domain).removeSuffix('/') + "/ajax/chapters/"
|
||||||
|
webClient.httpPost(url, emptyMap()).parseHtml()
|
||||||
|
}
|
||||||
|
val dateFormat = SimpleDateFormat(datePattern, sourceLocale)
|
||||||
|
return doc.select(selectChapter).mapChapters(reversed = true) { i, li ->
|
||||||
|
val a = li.selectFirst("a")
|
||||||
|
val href = a?.attrAsRelativeUrlOrNull("href") ?: li.parseFailed("Link is missing")
|
||||||
|
val link = href + stylePage
|
||||||
|
val dateText = li.selectFirst("a.c-new-tag")?.attr("title") ?: li.selectFirst(selectDate)?.text()
|
||||||
|
val name = li.selectFirst("a:contains(Cap)")?.text() ?: a.ownText()
|
||||||
|
MangaChapter(
|
||||||
|
id = generateUid(href),
|
||||||
|
url = link,
|
||||||
|
name = name,
|
||||||
|
number = i + 1,
|
||||||
|
branch = null,
|
||||||
|
uploadDate = parseChapterDate(
|
||||||
|
dateFormat,
|
||||||
|
dateText,
|
||||||
|
),
|
||||||
|
scanlator = null,
|
||||||
|
source = source,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,34 @@
|
|||||||
|
package org.koitharu.kotatsu.parsers.site.madtheme.en
|
||||||
|
|
||||||
|
import org.koitharu.kotatsu.parsers.MangaLoaderContext
|
||||||
|
import org.koitharu.kotatsu.parsers.MangaSourceParser
|
||||||
|
import org.koitharu.kotatsu.parsers.model.MangaChapter
|
||||||
|
import org.koitharu.kotatsu.parsers.model.MangaPage
|
||||||
|
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||||
|
import org.koitharu.kotatsu.parsers.site.madtheme.MadthemeParser
|
||||||
|
import org.koitharu.kotatsu.parsers.util.domain
|
||||||
|
import org.koitharu.kotatsu.parsers.util.generateUid
|
||||||
|
import org.koitharu.kotatsu.parsers.util.parseHtml
|
||||||
|
import org.koitharu.kotatsu.parsers.util.selectFirstOrThrow
|
||||||
|
import org.koitharu.kotatsu.parsers.util.toAbsoluteUrl
|
||||||
|
|
||||||
|
@MangaSourceParser("MANGAJINX", "MangaJinx", "en")
|
||||||
|
internal class MangaJinx(context: MangaLoaderContext) :
|
||||||
|
MadthemeParser(context, MangaSource.MANGAJINX, "mangajinx.com") {
|
||||||
|
override val listUrl = "search"
|
||||||
|
|
||||||
|
override suspend fun getPages(chapter: MangaChapter): List<MangaPage> {
|
||||||
|
val chapterUrl = chapter.url.toAbsoluteUrl(domain)
|
||||||
|
val docs = webClient.httpGet(chapterUrl).parseHtml()
|
||||||
|
val script = docs.selectFirstOrThrow("script:containsData(var chapImages)")
|
||||||
|
val images = script.data().substringAfter("= \"").substringBefore("\";").split(",")
|
||||||
|
return images.map {
|
||||||
|
MangaPage(
|
||||||
|
id = generateUid(it),
|
||||||
|
url = it,
|
||||||
|
preview = null,
|
||||||
|
source = source,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue