LXHentai: Update domain and selectors (#5702)

Update domain and selectors
This commit is contained in:
Chopper 2024-10-25 18:47:37 -03:00 committed by Draff
parent 647126a841
commit 7ce559d436
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
3 changed files with 9 additions and 14 deletions

View File

@ -14,7 +14,7 @@
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data <data
android:host="lxmanga.click" android:host="lxmanga.online"
android:pathPattern="/truyen/..*" android:pathPattern="/truyen/..*"
android:scheme="https" /> android:scheme="https" />
</intent-filter> </intent-filter>

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'LXHentai' extName = 'LXHentai'
extClass = '.LxHentai' extClass = '.LxHentai'
extVersionCode = 8 extVersionCode = 9
isNsfw = true isNsfw = true
} }

View File

@ -30,7 +30,7 @@ class LxHentai : ParsedHttpSource(), ConfigurableSource {
override val name = "LXHentai" override val name = "LXHentai"
private val defaultBaseUrl = "https://lxmanga.click" private val defaultBaseUrl = "https://lxmanga.online"
override val baseUrl by lazy { getPrefBaseUrl() } override val baseUrl by lazy { getPrefBaseUrl() }
@ -118,11 +118,7 @@ class LxHentai : ParsedHttpSource(), ConfigurableSource {
override fun searchMangaFromElement(element: Element) = SManga.create().apply { override fun searchMangaFromElement(element: Element) = SManga.create().apply {
setUrlWithoutDomain(element.select("div.p-2.truncate a").first()!!.attr("href")) setUrlWithoutDomain(element.select("div.p-2.truncate a").first()!!.attr("href"))
title = element.select("div.p-2.truncate a").first()!!.text() title = element.select("div.p-2.truncate a").first()!!.text()
thumbnail_url = element.select("div.cover") thumbnail_url = element.selectFirst("div.cover")?.absUrl("data-bg")
.first()!!
.attr("style")
.substringAfter("url('")
.substringBefore("')")
} }
override fun searchMangaNextPageSelector() = "li:contains(Cuối)" override fun searchMangaNextPageSelector() = "li:contains(Cuối)"
@ -151,11 +147,9 @@ class LxHentai : ParsedHttpSource(), ConfigurableSource {
} }
}.trim() }.trim()
thumbnail_url = document.select(".cover") thumbnail_url = document.selectFirst(".cover")?.attr("style")?.let {
.first()!! IMAGE_REGEX.find(it)?.groups?.get("img")?.value
.attr("style") }
.substringAfter("url('")
.substringBefore("')")
val statusString = document.select("div.grow div.mt-2:contains(Tình trạng) a").first()!!.text() val statusString = document.select("div.grow div.mt-2:contains(Tình trạng) a").first()!!.text()
status = when (statusString) { status = when (statusString) {
@ -167,7 +161,7 @@ class LxHentai : ParsedHttpSource(), ConfigurableSource {
setUrlWithoutDomain(document.location()) setUrlWithoutDomain(document.location())
} }
override fun chapterListSelector(): String = "ul.overflow-y-auto.overflow-x-hidden a" override fun chapterListSelector(): String = "ul.overflow-y-auto.overflow-x-hidden > a"
override fun chapterFromElement(element: Element) = SChapter.create().apply { override fun chapterFromElement(element: Element) = SChapter.create().apply {
setUrlWithoutDomain(element.attr("href")) setUrlWithoutDomain(element.attr("href"))
@ -340,6 +334,7 @@ class LxHentai : ParsedHttpSource(), ConfigurableSource {
const val PREFIX_ID_SEARCH = "id:" const val PREFIX_ID_SEARCH = "id:"
val CHAPTER_NUMBER_REGEX = Regex("""[+\-]?([0-9]*[.])?[0-9]+""", RegexOption.IGNORE_CASE) val CHAPTER_NUMBER_REGEX = Regex("""[+\-]?([0-9]*[.])?[0-9]+""", RegexOption.IGNORE_CASE)
val IMAGE_REGEX = """url\('(?<img>[^']+)""".toRegex()
private const val DEFAULT_BASE_URL_PREF = "defaultBaseUrl" private const val DEFAULT_BASE_URL_PREF = "defaultBaseUrl"
private const val RESTART_APP = "Khởi chạy lại ứng dụng để áp dụng thay đổi." private const val RESTART_APP = "Khởi chạy lại ứng dụng để áp dụng thay đổi."