parent
33d1ccd2a7
commit
90f191bc00
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: WP-Comics'
|
appName = 'Tachiyomi: WP-Comics'
|
||||||
pkgNameSuffix = 'all.wpcomics'
|
pkgNameSuffix = 'all.wpcomics'
|
||||||
extClass = '.WPComicsFactory'
|
extClass = '.WPComicsFactory'
|
||||||
extVersionCode = 4
|
extVersionCode = 5
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,8 @@ abstract class WPComics(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val currentYear by lazy { Calendar.getInstance(Locale.US)[1].toString().takeLast(2) }
|
||||||
|
|
||||||
private fun String?.toDate(): Long {
|
private fun String?.toDate(): Long {
|
||||||
return try {
|
return try {
|
||||||
if (this?.contains("ago", ignoreCase = true) == true) {
|
if (this?.contains("ago", ignoreCase = true) == true) {
|
||||||
|
@ -126,7 +128,15 @@ abstract class WPComics(
|
||||||
|
|
||||||
calendar.timeInMillis
|
calendar.timeInMillis
|
||||||
} else {
|
} else {
|
||||||
dateFormat.parse(if (gmtOffset == null) this?.substringAfterLast(" ") else "$this $gmtOffset").time
|
(if (gmtOffset == null) this?.substringAfterLast(" ") else "$this $gmtOffset")?.let {
|
||||||
|
// timestamp has year
|
||||||
|
if (Regex("""\d+/\d+/\d\d""").find(it)?.value != null) {
|
||||||
|
dateFormat.parse(it).time
|
||||||
|
} else {
|
||||||
|
// MangaSum - timestamp sometimes doesn't have year (current year implied)
|
||||||
|
dateFormat.parse("$it/$currentYear").time
|
||||||
|
}
|
||||||
|
} ?: 0L
|
||||||
}
|
}
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
0L
|
0L
|
||||||
|
|
|
@ -20,28 +20,20 @@ class WPComicsFactory : SourceFactory {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ManhuaPlus : WPComics("Manhua Plus", "https://manhuaplus.com", "en")
|
private class ManhuaPlus : WPComics("Manhua Plus", "https://manhuaplus.com", "en") {
|
||||||
|
override val pageListSelector: String = "div.chapter-detail img, ${super.pageListSelector}"
|
||||||
|
}
|
||||||
|
|
||||||
private class ManhuaES : WPComics("Manhua ES", "https://manhuaes.com", "en", SimpleDateFormat("HH:mm - dd/MM/yyyy Z", Locale.US), "+0700") {
|
private class ManhuaES : WPComics("Manhua ES", "https://manhuaes.com", "en", SimpleDateFormat("HH:mm - dd/MM/yyyy Z", Locale.US), "+0700") {
|
||||||
override val popularPath = "category-comics/manga"
|
override val popularPath = "category-comics/manga"
|
||||||
|
|
||||||
override fun popularMangaFromElement(element: Element): SManga {
|
override fun popularMangaFromElement(element: Element): SManga {
|
||||||
return SManga.create().apply {
|
return SManga.create().apply {
|
||||||
element.select("div.overlay a").let {
|
element.select("div.overlay a:has(h2)").let {
|
||||||
title = it.attr("title")
|
|
||||||
setUrlWithoutDomain(it.attr("href"))
|
|
||||||
}
|
|
||||||
thumbnail_url = element.select("div.image img").attr("abs:src")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun latestUpdatesFromElement(element: Element): SManga {
|
|
||||||
return SManga.create().apply {
|
|
||||||
element.select("a.head").let {
|
|
||||||
title = it.text()
|
title = it.text()
|
||||||
setUrlWithoutDomain(it.attr("href"))
|
setUrlWithoutDomain(it.attr("href"))
|
||||||
}
|
}
|
||||||
thumbnail_url = element.select("img").attr("abs:src")
|
thumbnail_url = element.select("img").firstOrNull()?.attr("abs:src")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,10 +42,6 @@ private class ManhuaES : WPComics("Manhua ES", "https://manhuaes.com", "en", Sim
|
||||||
|
|
||||||
private class MangaSum : WPComics("MangaSum", "https://mangasum.com", "en", SimpleDateFormat("MM/dd/yy", Locale.US), null) {
|
private class MangaSum : WPComics("MangaSum", "https://mangasum.com", "en", SimpleDateFormat("MM/dd/yy", Locale.US), null) {
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = GET("$baseUrl/genres?keyword=$query&page=$page", headers)
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = GET("$baseUrl/genres?keyword=$query&page=$page", headers)
|
||||||
/**
|
|
||||||
* TODO - chapter dates come in 3 flavors: relative dates less than a month, time + month/day (current year is implied),
|
|
||||||
* and MM/dd/yy; see about getting all 3 working (currently at 2/3)
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class XoxoComics : WPComics("XOXO Comics", "https://xoxocomics.com", "en", SimpleDateFormat("MM/dd/yy", Locale.US), null) {
|
private class XoxoComics : WPComics("XOXO Comics", "https://xoxocomics.com", "en", SimpleDateFormat("MM/dd/yy", Locale.US), null) {
|
||||||
|
|
Loading…
Reference in New Issue