Madara - add Night Comic, other updates (#1855)
Madara - add Night Comic, other updates
This commit is contained in:
parent
6b6ad793ac
commit
8a84c691e4
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: Madara (multiple sources)'
|
appName = 'Tachiyomi: Madara (multiple sources)'
|
||||||
pkgNameSuffix = "all.madara"
|
pkgNameSuffix = "all.madara"
|
||||||
extClass = '.MadaraFactory'
|
extClass = '.MadaraFactory'
|
||||||
extVersionCode = 33
|
extVersionCode = 34
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,7 @@ abstract class Madara(
|
||||||
Tag("on-hold", "On Hold")
|
Tag("on-hold", "On Hold")
|
||||||
)
|
)
|
||||||
|
|
||||||
open class UriPartFilter(displayName: String, val vals: Array<Pair<String, String>>) :
|
open class UriPartFilter(displayName: String, private val vals: Array<Pair<String, String>>) :
|
||||||
Filter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) {
|
Filter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) {
|
||||||
fun toUriPart() = vals[state].second
|
fun toUriPart() = vals[state].second
|
||||||
}
|
}
|
||||||
|
@ -386,28 +386,41 @@ abstract class Madara(
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun parseChapterDate(date: String): Long? {
|
open fun parseChapterDate(date: String): Long? {
|
||||||
val lcDate = date.toLowerCase()
|
return when {
|
||||||
if (lcDate.endsWith(" ago"))
|
date.endsWith(" ago", ignoreCase = true) -> {
|
||||||
return parseRelativeDate(lcDate)
|
parseRelativeDate(date)
|
||||||
|
}
|
||||||
//Handle 'yesterday' and 'today', using midnight
|
//Handle 'yesterday' and 'today', using midnight
|
||||||
if (lcDate.startsWith("year"))
|
date.startsWith("year", ignoreCase = true) -> {
|
||||||
return Calendar.getInstance().apply {
|
Calendar.getInstance().apply {
|
||||||
add(Calendar.DAY_OF_MONTH, -1) //yesterday
|
add(Calendar.DAY_OF_MONTH, -1) //yesterday
|
||||||
set(Calendar.HOUR_OF_DAY, 0)
|
set(Calendar.HOUR_OF_DAY, 0)
|
||||||
set(Calendar.MINUTE, 0)
|
set(Calendar.MINUTE, 0)
|
||||||
set(Calendar.SECOND, 0)
|
set(Calendar.SECOND, 0)
|
||||||
set(Calendar.MILLISECOND, 0)
|
set(Calendar.MILLISECOND, 0)
|
||||||
}.timeInMillis
|
}.timeInMillis
|
||||||
else if (lcDate.startsWith("today"))
|
}
|
||||||
return Calendar.getInstance().apply {
|
date.startsWith("today", ignoreCase = true) -> {
|
||||||
set(Calendar.HOUR_OF_DAY, 0)
|
Calendar.getInstance().apply {
|
||||||
set(Calendar.MINUTE, 0)
|
set(Calendar.HOUR_OF_DAY, 0)
|
||||||
set(Calendar.SECOND, 0)
|
set(Calendar.MINUTE, 0)
|
||||||
set(Calendar.MILLISECOND, 0)
|
set(Calendar.SECOND, 0)
|
||||||
}.timeInMillis
|
set(Calendar.MILLISECOND, 0)
|
||||||
|
}.timeInMillis
|
||||||
return dateFormat.parseOrNull(date)?.time
|
}
|
||||||
|
date.contains(Regex("""\d(st|nd|rd|th)""")) -> {
|
||||||
|
// Clean date (e.g. 5th December 2019 to 5 December 2019) before parsing it
|
||||||
|
date.split(" ").map {
|
||||||
|
if (it.contains(Regex("""\d\D\D"""))) {
|
||||||
|
it.replace(Regex("""\D"""), "")
|
||||||
|
} else {
|
||||||
|
it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.let { dateFormat.parseOrNull(it.joinToString(" "))?.time }
|
||||||
|
}
|
||||||
|
else -> dateFormat.parseOrNull(date)?.time
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parses dates in this form:
|
// Parses dates in this form:
|
||||||
|
|
|
@ -60,51 +60,57 @@ class MadaraFactory : SourceFactory {
|
||||||
DoujinHentai(),
|
DoujinHentai(),
|
||||||
Azora(),
|
Azora(),
|
||||||
HunterFansub(),
|
HunterFansub(),
|
||||||
MangaArabTeam()
|
MangaArabTeam(),
|
||||||
|
NightComic()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Mangasushi : Madara("Mangasushi", "https://mangasushi.net", "en")
|
class Mangasushi : Madara("Mangasushi", "https://mangasushi.net", "en")
|
||||||
|
|
||||||
class NinjaScans : Madara("NinjaScans", "https://ninjascans.com", "en")
|
class NinjaScans : Madara("NinjaScans", "https://ninjascans.com", "en")
|
||||||
|
|
||||||
class ReadManhua : Madara("ReadManhua", "https://readmanhua.net", "en",
|
class ReadManhua : Madara("ReadManhua", "https://readmanhua.net", "en",
|
||||||
dateFormat = SimpleDateFormat("dd MMM yy", Locale.US))
|
dateFormat = SimpleDateFormat("dd MMM yy", Locale.US))
|
||||||
|
|
||||||
class ZeroScans : Madara("ZeroScans", "https://zeroscans.com", "en")
|
class ZeroScans : Madara("ZeroScans", "https://zeroscans.com", "en")
|
||||||
|
|
||||||
class IsekaiScanCom : Madara("IsekaiScan.com", "https://isekaiscan.com/", "en")
|
class IsekaiScanCom : Madara("IsekaiScan.com", "https://isekaiscan.com/", "en")
|
||||||
|
|
||||||
class HappyTeaScans : Madara("Happy Tea Scans", "https://happyteascans.com/", "en")
|
class HappyTeaScans : Madara("Happy Tea Scans", "https://happyteascans.com/", "en")
|
||||||
|
|
||||||
class JustForFun : Madara("Just For Fun", "https://just-for-fun.ru/", "ru",
|
class JustForFun : Madara("Just For Fun", "https://just-for-fun.ru/", "ru",
|
||||||
dateFormat = SimpleDateFormat("dd/MM/yy", Locale.US))
|
dateFormat = SimpleDateFormat("yy.MM.dd", Locale.US))
|
||||||
|
|
||||||
class AoCTranslations : Madara("Agent of Change Translations", "https://aoc.moe/", "en") {
|
class AoCTranslations : Madara("Agent of Change Translations", "https://aoc.moe", "en") {
|
||||||
|
override fun headersBuilder(): Headers.Builder = super.headersBuilder().add("Referer", baseUrl)
|
||||||
|
override fun popularMangaSelector() = "div.page-item-detail.manga:has(span.chapter)"
|
||||||
|
override fun chapterListSelector() = "li.wp-manga-chapter:has(a)"
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val chapters = mutableListOf<SChapter>()
|
return response.asJsoup().let { document ->
|
||||||
val document = response.asJsoup()
|
document.select(chapterListSelector()).let { normalChapters ->
|
||||||
|
if (normalChapters.isNotEmpty()) {
|
||||||
// For when it's a normal chapter list
|
normalChapters.map { chapterFromElement(it) }
|
||||||
if (document.select(chapterListSelector()).hasText()) {
|
} else {
|
||||||
document.select(chapterListSelector())
|
// For their "fancy" volume/chapter lists
|
||||||
.map { chapters.add(chapterFromElement(it)) }
|
document.select("div.wpb_wrapper:contains(volume) a")
|
||||||
} else {
|
.filter { it.attr("href").contains(baseUrl) && !it.attr("href").contains("imgur") }
|
||||||
// For their "fancy" volume/chapter lists
|
.map { volumeChapter ->
|
||||||
document.select("div.wpb_wrapper:contains(volume) a")
|
SChapter.create().apply {
|
||||||
.filter { it.attr("href").contains(baseUrl) && !it.attr("href").contains("imgur") }
|
volumeChapter.attr("href").let { url ->
|
||||||
.map { it ->
|
name = if (url.contains("volume")) {
|
||||||
val chapter = SChapter.create()
|
val volume = url.substringAfter("volume-").substringBefore("/")
|
||||||
if (it.attr("href").contains("volume")) {
|
val volChap = url.substringAfter("volume-$volume/").substringBefore("/").replace("-", " ").capitalize()
|
||||||
val volume = it.attr("href").substringAfter("volume-").substringBefore("/")
|
"Volume $volume - $volChap"
|
||||||
val volChap = it.attr("href").substringAfter("volume-$volume/").substringBefore("/").replace("-", " ").capitalize()
|
} else {
|
||||||
chapter.name = "Volume $volume - $volChap"
|
url.substringBefore("/p").substringAfterLast("/").replace("-", " ").capitalize()
|
||||||
} else {
|
}
|
||||||
chapter.name = it.attr("href").substringBefore("/p").substringAfterLast("/").replace("-", " ").capitalize()
|
setUrlWithoutDomain(url.substringBefore("?") + "?style=list")
|
||||||
}
|
}
|
||||||
it.attr("href").let {
|
}
|
||||||
chapter.setUrlWithoutDomain(it.substringBefore("?") + if (!it.endsWith("?style=list")) "?style=list" else "")
|
}
|
||||||
chapters.add(chapter)
|
}.reversed()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return chapters.reversed()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,8 +126,8 @@ class TritiniaScans : Madara("Tritinia Scans", "http://ghajik.ml/", "en",
|
||||||
override fun popularMangaNextPageSelector(): String? = null
|
override fun popularMangaNextPageSelector(): String? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
class TsubakiNoScan : Madara("Tsubaki No Scan", "https://tsubakinoscan.com/",
|
class TsubakiNoScan : Madara("Tsubaki No Scan", "https://tsubakinoscan.com/","fr",
|
||||||
"fr", dateFormat = SimpleDateFormat("dd/MM/yy", Locale.US))
|
dateFormat = SimpleDateFormat("dd/MM/yy", Locale.US))
|
||||||
|
|
||||||
class YokaiJump : Madara("Yokai Jump", "https://yokaijump.fr/", "fr",
|
class YokaiJump : Madara("Yokai Jump", "https://yokaijump.fr/", "fr",
|
||||||
dateFormat = SimpleDateFormat("dd/MM/yy", Locale.US))
|
dateFormat = SimpleDateFormat("dd/MM/yy", Locale.US))
|
||||||
|
@ -136,7 +142,8 @@ class MangazukiClubJP : Madara("Mangazuki.club", "https://mangazuki.club/", "ja"
|
||||||
|
|
||||||
class MangazukiClubKO : Madara("Mangazuki.club", "https://mangazuki.club/", "ko")
|
class MangazukiClubKO : Madara("Mangazuki.club", "https://mangazuki.club/", "ko")
|
||||||
|
|
||||||
class FirstKissManga : Madara("1st Kiss", "https://1stkissmanga.com/", "en") {
|
class FirstKissManga : Madara("1st Kiss", "https://1stkissmanga.com/", "en",
|
||||||
|
dateFormat = SimpleDateFormat("dd MMM yyyy", Locale.US)) {
|
||||||
override val pageListParseSelector = "div.reading-content img"
|
override val pageListParseSelector = "div.reading-content img"
|
||||||
private val cdnUrl = "cdn.1stkissmanga.com"
|
private val cdnUrl = "cdn.1stkissmanga.com"
|
||||||
override fun imageRequest(page: Page): Request {
|
override fun imageRequest(page: Page): Request {
|
||||||
|
@ -177,7 +184,25 @@ class YoManga : Madara("Yo Manga", "https://yomanga.info/", "en")
|
||||||
|
|
||||||
class ManyToon : Madara("ManyToon", "https://manytoon.com/", "en")
|
class ManyToon : Madara("ManyToon", "https://manytoon.com/", "en")
|
||||||
|
|
||||||
class ChibiManga : Madara("Chibi Manga", "http://www.cmreader.info/", "en")
|
class ChibiManga : Madara("Chibi Manga", "http://www.cmreader.info/", "en",
|
||||||
|
dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.US)) {
|
||||||
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
|
response.asJsoup().let { documet ->
|
||||||
|
documet.select("li.parent.has-child").let { volumes ->
|
||||||
|
return if (volumes.isNullOrEmpty()) {
|
||||||
|
documet.select(chapterListSelector()).map { chapterFromElement(it) }
|
||||||
|
} else {
|
||||||
|
val chapters = mutableListOf<SChapter>()
|
||||||
|
volumes.reversed().forEach { v ->
|
||||||
|
val vName = v.select("a[href^=javascript]").text()
|
||||||
|
v.select(chapterListSelector()).map { chapters.add(chapterFromElement(it).apply { name = "$vName - $name" }) }
|
||||||
|
}
|
||||||
|
chapters
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class ZinManga : Madara("Zin Translator", "https://zinmanga.com/", "en") {
|
class ZinManga : Madara("Zin Translator", "https://zinmanga.com/", "en") {
|
||||||
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
|
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
|
||||||
|
@ -360,3 +385,5 @@ class HunterFansub : Madara("Hunter Fansub", "https://hunterfansub.com", "es") {
|
||||||
}
|
}
|
||||||
|
|
||||||
class MangaArabTeam : Madara("مانجا عرب تيم Manga Arab Team", "https://mangaarabteam.com", "ar")
|
class MangaArabTeam : Madara("مانجا عرب تيم Manga Arab Team", "https://mangaarabteam.com", "ar")
|
||||||
|
|
||||||
|
class NightComic : Madara("Night Comic", "http://www.nightcomic.com", "en")
|
||||||
|
|
Loading…
Reference in New Issue