Madokami: use relative chapter urls (#4362)

Use relative chapter urls
This commit is contained in:
Secozzi 2024-08-01 08:07:00 +00:00 committed by Draff
parent e8d27b655e
commit 20b9eff851
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 7 additions and 3 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Madokami' extName = 'Madokami'
extClass = '.Madokami' extClass = '.Madokami'
extVersionCode = 8 extVersionCode = 9
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -137,7 +137,8 @@ class Madokami : ConfigurableSource, ParsedHttpSource() {
override fun chapterFromElement(element: Element): SChapter { override fun chapterFromElement(element: Element): SChapter {
val el = element.parent()!!.parent()!! val el = element.parent()!!.parent()!!
val chapter = SChapter.create() val chapter = SChapter.create()
chapter.url = el.select("td:nth-child(6) a").attr("href") chapter.url = "/reader" + el.select("td:nth-child(6) a").attr("href")
.substringAfter("/reader")
chapter.name = el.select("td:nth-child(1) a").text() chapter.name = el.select("td:nth-child(1) a").text()
val date = el.select("td:nth-child(3)").text() val date = el.select("td:nth-child(3)").text()
if (date.endsWith("ago")) { if (date.endsWith("ago")) {
@ -162,7 +163,10 @@ class Madokami : ConfigurableSource, ParsedHttpSource() {
return chapter return chapter
} }
override fun pageListRequest(chapter: SChapter) = authenticate(GET(chapter.url, headers)) override fun pageListRequest(chapter: SChapter): Request {
require(chapter.url.startsWith("/")) { "Refresh chapter list" }
return authenticate(GET(baseUrl + chapter.url, headers))
}
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
val element = document.select("div#reader") val element = document.select("div#reader")