MangaThemesia: AsuraScansEn search and ManhwaFreak dates (#18158)
* ManhwaFreak: Fix relative date * AsuraScans: Add dropped status and fix search * AsuraScans: override series and author selector
This commit is contained in:
parent
30ca9fbfbc
commit
1c8211937f
|
@ -15,6 +15,7 @@ import kotlinx.serialization.decodeFromString
|
||||||
import kotlinx.serialization.encodeToString
|
import kotlinx.serialization.encodeToString
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
@ -41,6 +42,8 @@ class AsuraScansEn : MangaThemesia(
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
override val seriesDescriptionSelector = "div.desc p, div.entry-content p, div[itemprop=description]:not(:has(p))"
|
override val seriesDescriptionSelector = "div.desc p, div.entry-content p, div[itemprop=description]:not(:has(p))"
|
||||||
|
override val seriesArtistSelector = ".fmed b:contains(artist)+span, .infox span:contains(artist)"
|
||||||
|
override val seriesAuthorSelector = ".fmed b:contains(author)+span, .infox span:contains(author)"
|
||||||
|
|
||||||
override val pageSelector = "div.rdminimal > img, div.rdminimal > p > img, div.rdminimal > a > img, div.rdminimal > p > a > img, " +
|
override val pageSelector = "div.rdminimal > img, div.rdminimal > p > img, div.rdminimal > a > img, div.rdminimal > p > a > img, " +
|
||||||
"div.rdminimal > noscript > img, div.rdminimal > p > noscript > img, div.rdminimal > a > noscript > img, div.rdminimal > p > a > noscript > img"
|
"div.rdminimal > noscript > img, div.rdminimal > p > noscript > img, div.rdminimal > a > noscript > img, div.rdminimal > p > a > noscript > img"
|
||||||
|
@ -58,6 +61,22 @@ class AsuraScansEn : MangaThemesia(
|
||||||
return super.fetchSearchManga(page, query, filters).tempUrlToPermIfNeeded()
|
return super.fetchSearchManga(page, query, filters).tempUrlToPermIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
|
val request = super.searchMangaRequest(page, query, filters)
|
||||||
|
if (query.isBlank()) return request
|
||||||
|
|
||||||
|
val url = request.url.newBuilder()
|
||||||
|
.addPathSegment("page/$page/")
|
||||||
|
.removeAllQueryParameters("page")
|
||||||
|
.removeAllQueryParameters("title")
|
||||||
|
.addQueryParameter("s", query)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
return request.newBuilder()
|
||||||
|
.url(url)
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
// Temp Url for manga/chapter
|
// Temp Url for manga/chapter
|
||||||
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
||||||
val newManga = manga.titleToUrlFrag()
|
val newManga = manga.titleToUrlFrag()
|
||||||
|
|
|
@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import java.util.Calendar
|
||||||
|
|
||||||
class ManhwaFreak : MangaThemesia("Manhwa Freak", "https://manhwa-freak.com", "en") {
|
class ManhwaFreak : MangaThemesia("Manhwa Freak", "https://manhwa-freak.com", "en") {
|
||||||
|
|
||||||
|
@ -51,9 +52,34 @@ class ManhwaFreak : MangaThemesia("Manhwa Freak", "https://manhwa-freak.com", "e
|
||||||
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
||||||
val urlElements = element.select("a")
|
val urlElements = element.select("a")
|
||||||
setUrlWithoutDomain(urlElements.attr("href"))
|
setUrlWithoutDomain(urlElements.attr("href"))
|
||||||
name = element.select(".chapter-info p:nth-child(1)").text().ifBlank { urlElements.first()!!.text() }
|
val chapterElements = element.select(".chapter-info")
|
||||||
date_upload = element.selectFirst(".chapter-info p:nth-child(2)")?.text().parseChapterDate()
|
name = chapterElements.select("p:nth-child(1)").text().ifBlank { urlElements.first()!!.text() }
|
||||||
|
date_upload = getChapterDate(chapterElements.first())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFilterList() = FilterList()
|
override fun getFilterList() = FilterList()
|
||||||
|
|
||||||
|
private fun getChapterDate(element: Element?): Long {
|
||||||
|
element ?: return 0
|
||||||
|
val chapterDate = element.select("p:nth-child(2)").text()
|
||||||
|
|
||||||
|
return when {
|
||||||
|
element.select("p.new").isNotEmpty() -> getToday()
|
||||||
|
chapterDate.contains(Regex("day(s)* ago$")) -> {
|
||||||
|
val number = Regex("""(\d+)""").find(chapterDate)?.value?.toIntOrNull() ?: return 0
|
||||||
|
Calendar.getInstance().apply { add(Calendar.DAY_OF_MONTH, -number) }.timeInMillis
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> chapterDate.parseChapterDate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getToday(): Long {
|
||||||
|
return Calendar.getInstance().apply {
|
||||||
|
set(Calendar.HOUR_OF_DAY, 0)
|
||||||
|
set(Calendar.MINUTE, 0)
|
||||||
|
set(Calendar.SECOND, 0)
|
||||||
|
set(Calendar.MILLISECOND, 0)
|
||||||
|
}.timeInMillis
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ import rx.Observable
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.lang.IllegalArgumentException
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
@ -215,6 +214,7 @@ abstract class MangaThemesia(
|
||||||
listOf("ongoing", "publishing").any { this.contains(it, ignoreCase = true) } -> SManga.ONGOING
|
listOf("ongoing", "publishing").any { this.contains(it, ignoreCase = true) } -> SManga.ONGOING
|
||||||
this.contains("hiatus", ignoreCase = true) -> SManga.ON_HIATUS
|
this.contains("hiatus", ignoreCase = true) -> SManga.ON_HIATUS
|
||||||
this.contains("completed", ignoreCase = true) -> SManga.COMPLETED
|
this.contains("completed", ignoreCase = true) -> SManga.COMPLETED
|
||||||
|
listOf("dropped", "cancelled").any { this.contains(it, ignoreCase = true) } -> SManga.CANCELLED
|
||||||
else -> SManga.UNKNOWN
|
else -> SManga.UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
|
||||||
override val baseVersionCode: Int = 26
|
override val baseVersionCode: Int = 26
|
||||||
|
|
||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
MultiLang("Asura Scans", "https://asuracomics.gg", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 27),
|
MultiLang("Asura Scans", "https://asuracomics.gg", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 28),
|
||||||
MultiLang("Flame Scans", "https://flamescans.org", listOf("en"), className = "FlameScansFactory", pkgName = "flamescans", overrideVersionCode = 4),
|
MultiLang("Flame Scans", "https://flamescans.org", listOf("en"), className = "FlameScansFactory", pkgName = "flamescans", overrideVersionCode = 4),
|
||||||
MultiLang("Miau Scan", "https://miauscans.com", listOf("es", "pt-BR"), overrideVersionCode = 1),
|
MultiLang("Miau Scan", "https://miauscans.com", listOf("es", "pt-BR"), overrideVersionCode = 1),
|
||||||
SingleLang("Animated Glitched Scans", "https://anigliscans.xyz", "en", overrideVersionCode = 1),
|
SingleLang("Animated Glitched Scans", "https://anigliscans.xyz", "en", overrideVersionCode = 1),
|
||||||
|
@ -82,7 +82,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
|
||||||
SingleLang("MangaSwat", "https://swatmanga.co", "ar", overrideVersionCode = 13),
|
SingleLang("MangaSwat", "https://swatmanga.co", "ar", overrideVersionCode = 13),
|
||||||
SingleLang("MangKomik", "https://mangkomik.net", "id", overrideVersionCode = 1),
|
SingleLang("MangKomik", "https://mangkomik.net", "id", overrideVersionCode = 1),
|
||||||
SingleLang("Mangás Chan", "https://mangaschan.net", "pt-BR", className = "MangasChan", overrideVersionCode = 1),
|
SingleLang("Mangás Chan", "https://mangaschan.net", "pt-BR", className = "MangasChan", overrideVersionCode = 1),
|
||||||
SingleLang("Manhwa Freak", "https://manhwa-freak.com", "en", overrideVersionCode = 2),
|
SingleLang("Manhwa Freak", "https://manhwa-freak.com", "en", overrideVersionCode = 3),
|
||||||
SingleLang("ManhwaFreak", "https://manhwafreak.fr", "fr", className = "ManhwaFreakFR"),
|
SingleLang("ManhwaFreak", "https://manhwafreak.fr", "fr", className = "ManhwaFreakFR"),
|
||||||
SingleLang("ManhwaDesu", "https://manhwadesu.one", "id", isNsfw = true, overrideVersionCode = 4),
|
SingleLang("ManhwaDesu", "https://manhwadesu.one", "id", isNsfw = true, overrideVersionCode = 4),
|
||||||
SingleLang("ManhwaIndo", "https://manhwaindo.id", "id", isNsfw = true, overrideVersionCode = 3),
|
SingleLang("ManhwaIndo", "https://manhwaindo.id", "id", isNsfw = true, overrideVersionCode = 3),
|
||||||
|
|
Loading…
Reference in New Issue