Madara: fix app crash and some sources fixes (#1398)

* Madara: fix crash

* fix NPE in ImperioDaBritannia

* mangalek use LoadMore

* update title selector
This commit is contained in:
AwkwardPeak7 2024-02-19 23:45:46 +05:00 committed by GitHub
parent f65ad169c4
commit cc5696dd7a
9 changed files with 10 additions and 12 deletions

View File

@ -2,7 +2,7 @@ plugins {
id("lib-multisrc")
}
baseVersionCode = 34
baseVersionCode = 35
dependencies {
api(project(":lib:cryptoaes"))

View File

@ -723,7 +723,7 @@ abstract class Madara(
}
// Manga Details Selector
open val mangaDetailsSelectorTitle = "div.post-title h3, div.post-title h1"
open val mangaDetailsSelectorTitle = "div.post-title h3, div.post-title h1, #manga-title > h1"
open val mangaDetailsSelectorAuthor = "div.author-content > a"
open val mangaDetailsSelectorArtist = "div.artist-content > a"
open val mangaDetailsSelectorStatus = "div.summary-content"
@ -989,8 +989,7 @@ abstract class Madara(
.substringAfter("var manga = ")
.substringBeforeLast(";")
val wpManga = runCatching { json.parseToJsonElement(wpMangaInfo).jsonObject }
.getOrNull() ?: return null
val wpManga = json.parseToJsonElement(wpMangaInfo).jsonObject
if (wpManga["enable_manga_view"]?.jsonPrimitive?.content == "1") {
val formBuilder = FormBody.Builder()
@ -1007,9 +1006,7 @@ abstract class Madara(
.set("Referer", document.location())
.build()
val ajaxUrl = wpManga["ajax_url"]!!.jsonPrimitive.content
return POST(ajaxUrl, newHeaders, formBody)
return POST("$baseUrl/wp-admin/admin-ajax.php", newHeaders, formBody)
}
return null
@ -1020,13 +1017,15 @@ abstract class Madara(
*
* @param document The response document with the wp-manga data
*/
protected open fun countViews(document: Document) {
protected fun countViews(document: Document) {
if (!sendViewCount) {
return
}
val request = countViewsRequest(document) ?: return
runCatching { client.newCall(request).execute().close() }
try {
val request = countViewsRequest(document) ?: return
client.newCall(request).execute().close()
} catch (_: Exception) { }
}
/**

View File

@ -31,7 +31,7 @@ class Mangalek :
ConfigurableSource {
override val fetchGenres = false
override val useLoadMoreRequest = LoadMoreStrategy.Always
override val chapterUrlSuffix = ""
private val defaultBaseUrl = "https://manga-lek.net"

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -19,6 +19,5 @@ class ImperioDaBritannia : Madara(
.build()
override val useNewChapterEndpoint = true
override val mangaDetailsSelectorTag = ""
}