|
|
|
@ -98,106 +98,96 @@ internal abstract class MadaraParser(
|
|
|
|
@JvmField
|
|
|
|
@JvmField
|
|
|
|
protected val ongoing = scatterSetOf(
|
|
|
|
protected val ongoing = scatterSetOf(
|
|
|
|
"مستمرة",
|
|
|
|
"مستمرة",
|
|
|
|
"En curso",
|
|
|
|
"en curso",
|
|
|
|
"En Curso",
|
|
|
|
"ongoing",
|
|
|
|
"Ongoing",
|
|
|
|
"on going",
|
|
|
|
"OnGoing",
|
|
|
|
"ativo",
|
|
|
|
"On going",
|
|
|
|
"en cours",
|
|
|
|
"On Going",
|
|
|
|
"en cours \uD83D\uDFE2",
|
|
|
|
"Ativo",
|
|
|
|
"en cours de publication",
|
|
|
|
"En Cours",
|
|
|
|
"activo",
|
|
|
|
"En cours",
|
|
|
|
"đang tiến hành",
|
|
|
|
"En cours \uD83D\uDFE2",
|
|
|
|
|
|
|
|
"En cours de publication",
|
|
|
|
|
|
|
|
"Activo",
|
|
|
|
|
|
|
|
"Đang tiến hành",
|
|
|
|
|
|
|
|
"Em lançamento",
|
|
|
|
|
|
|
|
"em lançamento",
|
|
|
|
"em lançamento",
|
|
|
|
"Em Lançamento",
|
|
|
|
"онгоінг",
|
|
|
|
"Онгоінг",
|
|
|
|
"publishing",
|
|
|
|
"Publishing",
|
|
|
|
"devam ediyor",
|
|
|
|
"Devam Ediyor",
|
|
|
|
"em andamento",
|
|
|
|
"Em Andamento",
|
|
|
|
"in corso",
|
|
|
|
"Em andamento",
|
|
|
|
"güncel",
|
|
|
|
"In Corso",
|
|
|
|
"berjalan",
|
|
|
|
"Güncel",
|
|
|
|
"продолжается",
|
|
|
|
"Berjalan",
|
|
|
|
"updating",
|
|
|
|
"Продолжается",
|
|
|
|
"lançando",
|
|
|
|
"Updating",
|
|
|
|
"in arrivo",
|
|
|
|
"Lançando",
|
|
|
|
"emision",
|
|
|
|
"In Arrivo",
|
|
|
|
"en emision",
|
|
|
|
"Emision",
|
|
|
|
|
|
|
|
"En emision",
|
|
|
|
|
|
|
|
"مستمر",
|
|
|
|
"مستمر",
|
|
|
|
"Curso",
|
|
|
|
"curso",
|
|
|
|
"En marcha",
|
|
|
|
"en marcha",
|
|
|
|
"Publicandose",
|
|
|
|
"publicandose",
|
|
|
|
"Publicando",
|
|
|
|
"publicando",
|
|
|
|
"连载中",
|
|
|
|
"连载中",
|
|
|
|
"Devam ediyor",
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@JvmField
|
|
|
|
@JvmField
|
|
|
|
protected val finished = scatterSetOf(
|
|
|
|
protected val finished = scatterSetOf(
|
|
|
|
"Completed",
|
|
|
|
"completed",
|
|
|
|
"Complete",
|
|
|
|
"complete",
|
|
|
|
"Completo",
|
|
|
|
"completo",
|
|
|
|
"Complété",
|
|
|
|
"complété",
|
|
|
|
"Fini",
|
|
|
|
"fini",
|
|
|
|
"Achevé",
|
|
|
|
"achevé",
|
|
|
|
"Terminé",
|
|
|
|
"terminé",
|
|
|
|
"Terminé ⚫",
|
|
|
|
"terminé ⚫",
|
|
|
|
"Tamamlandı",
|
|
|
|
"tamamlandı",
|
|
|
|
"Đã hoàn thành",
|
|
|
|
"đã hoàn thành",
|
|
|
|
"Hoàn Thành",
|
|
|
|
"hoàn thành",
|
|
|
|
"مكتملة",
|
|
|
|
"مكتملة",
|
|
|
|
"Завершено",
|
|
|
|
"завершено",
|
|
|
|
"Завершен",
|
|
|
|
"завершен",
|
|
|
|
"Finished",
|
|
|
|
"finished",
|
|
|
|
"Finalizado",
|
|
|
|
"finalizado",
|
|
|
|
"Completata",
|
|
|
|
"completata",
|
|
|
|
"One-Shot",
|
|
|
|
"one-shot",
|
|
|
|
"Bitti",
|
|
|
|
"bitti",
|
|
|
|
"Tamat",
|
|
|
|
"tamat",
|
|
|
|
"Completado",
|
|
|
|
"completado",
|
|
|
|
"Concluído",
|
|
|
|
"concluído",
|
|
|
|
"Concluido",
|
|
|
|
"concluido",
|
|
|
|
"已完结",
|
|
|
|
"已完结",
|
|
|
|
"Bitmiş",
|
|
|
|
"bitmiş",
|
|
|
|
"End",
|
|
|
|
"end",
|
|
|
|
"منتهية",
|
|
|
|
"منتهية",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@JvmField
|
|
|
|
@JvmField
|
|
|
|
protected val abandoned = scatterSetOf(
|
|
|
|
protected val abandoned = scatterSetOf(
|
|
|
|
"Canceled",
|
|
|
|
"canceled",
|
|
|
|
"Cancelled",
|
|
|
|
"cancelled",
|
|
|
|
"Cancelado",
|
|
|
|
"cancelado",
|
|
|
|
"cancellato",
|
|
|
|
"cancellato",
|
|
|
|
"Cancelados",
|
|
|
|
"cancelados",
|
|
|
|
"Dropped",
|
|
|
|
"dropped",
|
|
|
|
"Discontinued",
|
|
|
|
"discontinued",
|
|
|
|
"abandonné",
|
|
|
|
"abandonné",
|
|
|
|
"Abandonné",
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@JvmField
|
|
|
|
@JvmField
|
|
|
|
protected val paused = scatterSetOf(
|
|
|
|
protected val paused = scatterSetOf(
|
|
|
|
"Hiatus",
|
|
|
|
"hiatus",
|
|
|
|
"On Hold",
|
|
|
|
"on hold",
|
|
|
|
"Pausado",
|
|
|
|
"pausado",
|
|
|
|
"En espera",
|
|
|
|
"en espera",
|
|
|
|
"En pause",
|
|
|
|
"en pause",
|
|
|
|
"En attente",
|
|
|
|
"en attente",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@JvmField
|
|
|
|
@JvmField
|
|
|
|
protected val upcoming = scatterSetOf(
|
|
|
|
protected val upcoming = scatterSetOf(
|
|
|
|
"Upcoming",
|
|
|
|
|
|
|
|
"upcoming",
|
|
|
|
"upcoming",
|
|
|
|
"لم تُنشَر بعد",
|
|
|
|
"لم تُنشَر بعد",
|
|
|
|
"Prochainement",
|
|
|
|
"prochainement",
|
|
|
|
"À venir",
|
|
|
|
"à venir",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// Change these values only if the site does not support manga listings via ajax
|
|
|
|
// Change these values only if the site does not support manga listings via ajax
|
|
|
|
@ -326,23 +316,19 @@ internal abstract class MadaraParser(
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
if (filter.tags.isNotEmpty()) {
|
|
|
|
if (filter.tags.isNotEmpty()) {
|
|
|
|
var nTag = 0
|
|
|
|
|
|
|
|
payload["vars[tax_query][0][taxonomy]"] = "wp-manga-genre"
|
|
|
|
payload["vars[tax_query][0][taxonomy]"] = "wp-manga-genre"
|
|
|
|
payload["vars[tax_query][0][field]"] = "slug"
|
|
|
|
payload["vars[tax_query][0][field]"] = "slug"
|
|
|
|
filter.tags.forEach {
|
|
|
|
filter.tags.forEachIndexed { i, it ->
|
|
|
|
payload["vars[tax_query][0][terms][$nTag]"] = it.key
|
|
|
|
payload["vars[tax_query][0][terms][$i]"] = it.key
|
|
|
|
nTag++
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
payload["vars[tax_query][0][operator]"] = "IN"
|
|
|
|
payload["vars[tax_query][0][operator]"] = "IN"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (filter.tagsExclude.isNotEmpty()) {
|
|
|
|
if (filter.tagsExclude.isNotEmpty()) {
|
|
|
|
var ntagsExclude = 0
|
|
|
|
|
|
|
|
payload["vars[tax_query][1][taxonomy]"] = "wp-manga-genre"
|
|
|
|
payload["vars[tax_query][1][taxonomy]"] = "wp-manga-genre"
|
|
|
|
payload["vars[tax_query][1][field]"] = "slug"
|
|
|
|
payload["vars[tax_query][1][field]"] = "slug"
|
|
|
|
filter.tagsExclude.forEach {
|
|
|
|
filter.tagsExclude.forEachIndexed { i, it ->
|
|
|
|
payload["vars[tax_query][1][terms][$ntagsExclude]"] = it.key
|
|
|
|
payload["vars[tax_query][1][terms][$i]"] = it.key
|
|
|
|
ntagsExclude++
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
payload["vars[tax_query][1][operator]"] = "NOT IN"
|
|
|
|
payload["vars[tax_query][1][operator]"] = "NOT IN"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -357,7 +343,7 @@ internal abstract class MadaraParser(
|
|
|
|
// Support author
|
|
|
|
// Support author
|
|
|
|
// filter.author.let {
|
|
|
|
// filter.author.let {
|
|
|
|
// payload["vars[tax_query][3][taxonomy]"] = "wp-manga-author"
|
|
|
|
// payload["vars[tax_query][3][taxonomy]"] = "wp-manga-author"
|
|
|
|
// payload["vars[tax_query][3][field]"] = "slug"
|
|
|
|
// payload["vars[tax_query][3][field]"] = "name"
|
|
|
|
// payload["vars[tax_query][3][terms][0]"] = filter.author
|
|
|
|
// payload["vars[tax_query][3][terms][0]"] = filter.author
|
|
|
|
// payload["vars[tax_query][3][operator]"] = "IN"
|
|
|
|
// payload["vars[tax_query][3][operator]"] = "IN"
|
|
|
|
//}
|
|
|
|
//}
|
|
|
|
@ -365,10 +351,10 @@ internal abstract class MadaraParser(
|
|
|
|
|
|
|
|
|
|
|
|
// Support artist
|
|
|
|
// Support artist
|
|
|
|
// filter.artist.let {
|
|
|
|
// filter.artist.let {
|
|
|
|
// payload["vars[tax_query][3][taxonomy]"] = "wp-manga-artist"
|
|
|
|
// payload["vars[tax_query][4][taxonomy]"] = "wp-manga-artist"
|
|
|
|
// payload["vars[tax_query][3][field]"] = "slug"
|
|
|
|
// payload["vars[tax_query][4][field]"] = "name"
|
|
|
|
// payload["vars[tax_query][3][terms][0]"] = filter.artist
|
|
|
|
// payload["vars[tax_query][4][terms][0]"] = filter.artist
|
|
|
|
// payload["vars[tax_query][3][operator]"] = "IN"
|
|
|
|
// payload["vars[tax_query][4][operator]"] = "IN"
|
|
|
|
//}
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
/// for add filter.year need to add || filter.year
|
|
|
|
/// for add filter.year need to add || filter.year
|
|
|
|
@ -379,21 +365,25 @@ internal abstract class MadaraParser(
|
|
|
|
when (filter.sortOrder) {
|
|
|
|
when (filter.sortOrder) {
|
|
|
|
SortOrder.POPULARITY -> {
|
|
|
|
SortOrder.POPULARITY -> {
|
|
|
|
payload["vars[meta_key]"] = "_wp_manga_views"
|
|
|
|
payload["vars[meta_key]"] = "_wp_manga_views"
|
|
|
|
|
|
|
|
payload["vars[orderby]"] = "meta_value_num"
|
|
|
|
payload["vars[order]"] = "desc"
|
|
|
|
payload["vars[order]"] = "desc"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SortOrder.POPULARITY_ASC -> {
|
|
|
|
SortOrder.POPULARITY_ASC -> {
|
|
|
|
payload["vars[meta_key]"] = "_wp_manga_views"
|
|
|
|
payload["vars[meta_key]"] = "_wp_manga_views"
|
|
|
|
|
|
|
|
payload["vars[orderby]"] = "meta_value_num"
|
|
|
|
payload["vars[order]"] = "asc"
|
|
|
|
payload["vars[order]"] = "asc"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SortOrder.UPDATED -> {
|
|
|
|
SortOrder.UPDATED -> {
|
|
|
|
payload["vars[meta_key]"] = "_latest_update"
|
|
|
|
payload["vars[meta_key]"] = "_latest_update"
|
|
|
|
|
|
|
|
payload["vars[orderby]"] = "meta_value_num"
|
|
|
|
payload["vars[order]"] = "desc"
|
|
|
|
payload["vars[order]"] = "desc"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SortOrder.UPDATED_ASC -> {
|
|
|
|
SortOrder.UPDATED_ASC -> {
|
|
|
|
payload["vars[meta_key]"] = "_latest_update"
|
|
|
|
payload["vars[meta_key]"] = "_latest_update"
|
|
|
|
|
|
|
|
payload["vars[orderby]"] = "meta_value_num"
|
|
|
|
payload["vars[order]"] = "asc"
|
|
|
|
payload["vars[order]"] = "asc"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -504,7 +494,7 @@ internal abstract class MadaraParser(
|
|
|
|
state = when (
|
|
|
|
state = when (
|
|
|
|
summary?.selectFirst(".mg_status")
|
|
|
|
summary?.selectFirst(".mg_status")
|
|
|
|
?.selectFirst(".summary-content")
|
|
|
|
?.selectFirst(".summary-content")
|
|
|
|
?.ownText()
|
|
|
|
?.ownText()?.lowercase()
|
|
|
|
.orEmpty()
|
|
|
|
.orEmpty()
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
in ongoing -> MangaState.ONGOING
|
|
|
|
in ongoing -> MangaState.ONGOING
|
|
|
|
@ -575,7 +565,7 @@ internal abstract class MadaraParser(
|
|
|
|
val stateDiv = doc.selectFirst(selectState)?.selectLast("div.summary-content")
|
|
|
|
val stateDiv = doc.selectFirst(selectState)?.selectLast("div.summary-content")
|
|
|
|
|
|
|
|
|
|
|
|
val state = stateDiv?.let {
|
|
|
|
val state = stateDiv?.let {
|
|
|
|
when (it.text()) {
|
|
|
|
when (it.text().lowercase()) {
|
|
|
|
in ongoing -> MangaState.ONGOING
|
|
|
|
in ongoing -> MangaState.ONGOING
|
|
|
|
in finished -> MangaState.FINISHED
|
|
|
|
in finished -> MangaState.FINISHED
|
|
|
|
in abandoned -> MangaState.ABANDONED
|
|
|
|
in abandoned -> MangaState.ABANDONED
|
|
|
|
@ -811,76 +801,30 @@ internal abstract class MadaraParser(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Parses dates in this form:
|
|
|
|
|
|
|
|
// 21 hours ago
|
|
|
|
|
|
|
|
private fun parseRelativeDate(date: String): Long {
|
|
|
|
private fun parseRelativeDate(date: String): Long {
|
|
|
|
val number = Regex("""(\d+)""").find(date)?.value?.toIntOrNull() ?: return 0
|
|
|
|
val number = Regex("""(\d+)""").find(date)?.value?.toIntOrNull() ?: return 0
|
|
|
|
val cal = Calendar.getInstance()
|
|
|
|
val cal = Calendar.getInstance()
|
|
|
|
|
|
|
|
|
|
|
|
return when {
|
|
|
|
return when {
|
|
|
|
WordSet(
|
|
|
|
|
|
|
|
"hari",
|
|
|
|
|
|
|
|
"gün",
|
|
|
|
|
|
|
|
"jour",
|
|
|
|
|
|
|
|
"día",
|
|
|
|
|
|
|
|
"dia",
|
|
|
|
|
|
|
|
"day",
|
|
|
|
|
|
|
|
"days",
|
|
|
|
|
|
|
|
"d",
|
|
|
|
|
|
|
|
"день",
|
|
|
|
|
|
|
|
).anyWordIn(date) -> cal.apply { add(Calendar.DAY_OF_MONTH, -number) }.timeInMillis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WordSet(
|
|
|
|
|
|
|
|
"jam",
|
|
|
|
|
|
|
|
"saat",
|
|
|
|
|
|
|
|
"heure",
|
|
|
|
|
|
|
|
"hora",
|
|
|
|
|
|
|
|
"horas",
|
|
|
|
|
|
|
|
"hour",
|
|
|
|
|
|
|
|
"hours",
|
|
|
|
|
|
|
|
"h",
|
|
|
|
|
|
|
|
"ساعات",
|
|
|
|
|
|
|
|
"ساعة",
|
|
|
|
|
|
|
|
).anyWordIn(date) -> cal.apply {
|
|
|
|
|
|
|
|
add(
|
|
|
|
|
|
|
|
Calendar.HOUR,
|
|
|
|
|
|
|
|
-number,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}.timeInMillis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WordSet(
|
|
|
|
WordSet("detik", "segundo", "second", "ثوان")
|
|
|
|
"menit",
|
|
|
|
.anyWordIn(date) -> cal.apply { add(Calendar.SECOND, -number) }.timeInMillis
|
|
|
|
"dakika",
|
|
|
|
|
|
|
|
"min",
|
|
|
|
|
|
|
|
"minute",
|
|
|
|
|
|
|
|
"minutes",
|
|
|
|
|
|
|
|
"minuto",
|
|
|
|
|
|
|
|
"mins",
|
|
|
|
|
|
|
|
"phút",
|
|
|
|
|
|
|
|
"минут",
|
|
|
|
|
|
|
|
"دقيقة",
|
|
|
|
|
|
|
|
).anyWordIn(date) -> cal.apply {
|
|
|
|
|
|
|
|
add(
|
|
|
|
|
|
|
|
Calendar.MINUTE,
|
|
|
|
|
|
|
|
-number,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}.timeInMillis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WordSet("detik", "segundo", "second", "ثوان").anyWordIn(date) -> cal.apply {
|
|
|
|
WordSet("menit", "dakika", "min", "minute", "minutes", "minuto", "mins", "phút", "минут", "دقيقة")
|
|
|
|
add(
|
|
|
|
.anyWordIn(date) -> cal.apply { add(Calendar.MINUTE, -number) }.timeInMillis
|
|
|
|
Calendar.SECOND,
|
|
|
|
|
|
|
|
-number,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}.timeInMillis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WordSet("month", "months", "أشهر", "mois").anyWordIn(date) -> cal.apply {
|
|
|
|
WordSet("jam", "saat", "heure", "hora", "horas", "hour", "hours", "h", "ساعات", "ساعة")
|
|
|
|
add(
|
|
|
|
.anyWordIn(date) -> cal.apply { add(Calendar.HOUR, -number) }.timeInMillis
|
|
|
|
Calendar.MONTH,
|
|
|
|
|
|
|
|
-number,
|
|
|
|
WordSet("hari", "gün", "jour", "día", "dia", "day", "days", "d", "день")
|
|
|
|
)
|
|
|
|
.anyWordIn(date) -> cal.apply { add(Calendar.DAY_OF_MONTH, -number) }.timeInMillis
|
|
|
|
}.timeInMillis
|
|
|
|
|
|
|
|
|
|
|
|
WordSet("month", "months", "أشهر", "mois")
|
|
|
|
|
|
|
|
.anyWordIn(date) -> cal.apply { add(Calendar.MONTH, -number) }.timeInMillis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WordSet("year")
|
|
|
|
|
|
|
|
.anyWordIn(date) -> cal.apply { add(Calendar.YEAR, -number) }.timeInMillis
|
|
|
|
|
|
|
|
|
|
|
|
WordSet("year").anyWordIn(date) -> cal.apply { add(Calendar.YEAR, -number) }.timeInMillis
|
|
|
|
|
|
|
|
else -> 0
|
|
|
|
else -> 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|