Skip to content

Commit

Permalink
update arnovel
Browse files Browse the repository at this point in the history
  • Loading branch information
kazemcodes committed Apr 23, 2024
1 parent 2fe9c12 commit 6ca19f9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
40 changes: 37 additions & 3 deletions sources/multisrc/madara/arnovel/src/ireader/arnovel/ArNovel.kt
Original file line number Diff line number Diff line change
@@ -1,18 +1,52 @@
package ireader.arnovel


import io.ktor.client.request.post
import io.ktor.client.statement.bodyAsText
import ireader.core.log.Log
import ireader.madara.Madara
import ireader.core.source.Dependencies
import ireader.madara.Path
import ireader.core.source.asJsoup
import ireader.core.source.findInstance
import ireader.core.source.model.ChapterInfo
import ireader.core.source.model.Command
import ireader.core.source.model.MangaInfo
import ireader.core.source.model.Page
import ireader.core.source.model.Text
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import tachiyomix.annotations.Extension

@Extension
abstract class ArNovel(val deps: Dependencies) : Madara(
deps,
key = "https://arnovel.me",
key = "https://ar-novel.com",
sourceName = "arnovel",
sourceId = 65,
language = "ar",
){
override suspend fun getChapterList(
manga: MangaInfo,
commands: List<Command<*>>
): List<ChapterInfo> {
commands.findInstance<Command.Chapter.Fetch>()?.let {
return chaptersParse(Jsoup.parse(it.html)).reversed()
}
val html = client.post(
"${manga.key}ajax/chapters/"
).bodyAsText()
val chapters =
chaptersParse(
html.asJsoup(),
)
return chapters.reversed()
}

override fun chapterFromElement(element: Element): ChapterInfo {
val link = baseUrl + element.select("a").attr("href").substringAfter(baseUrl)
val name = element.select("a").text()
val dateUploaded = element.select("i").text()

)
return ChapterInfo(name = name, key = link, dateUpload = parseChapterDate(dateUploaded))
}
}
2 changes: 1 addition & 1 deletion sources/multisrc/madara/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ listOf(
),
Extension(
name = "ArNovel",
versionCode = 1,
versionCode = 2,
libVersion = "1",
lang = "ar",
description = "",
Expand Down
2 changes: 1 addition & 1 deletion sources/multisrc/madara/main/src/ireader/madara/Madara.kt
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ abstract class Madara(
return document.select("li.wp-manga-chapter").map { chapterFromElement(it) }
}

fun chapterFromElement(element: Element): ChapterInfo {
open fun chapterFromElement(element: Element): ChapterInfo {
val link = baseUrl + element.select("a").attr("href").substringAfter(baseUrl)
val name = element.select("a").text()
val dateUploaded = element.select("i").text()
Expand Down

0 comments on commit 6ca19f9

Please sign in to comment.