DatGarScanlation: Update selectors (#15013)
* DatGarScanlation: Update selectors * Add requested changes * Lint
This commit is contained in:
parent
2f44ac4b97
commit
f74b23e3ea
|
@ -0,0 +1,32 @@
|
|||
package eu.kanade.tachiyomi.extension.es.datgarscanlation
|
||||
|
||||
import eu.kanade.tachiyomi.multisrc.zeistmanga.ZeistManga
|
||||
import org.jsoup.nodes.Document
|
||||
|
||||
class DatGarScanlation : ZeistManga("DatGarScanlation", "https://datgarscanlation.blogspot.com", "es") {
|
||||
|
||||
private val altChapterFeedRegex = """label\s*=\s*'([^']+)'""".toRegex()
|
||||
private val altScriptSelector = "#latest > script"
|
||||
|
||||
override fun getChaptersUrl(doc: Document): String {
|
||||
var chapterRegex = chapterFeedRegex
|
||||
var script = doc.selectFirst(scriptSelector)
|
||||
|
||||
if (script == null) {
|
||||
script = doc.selectFirst(altScriptSelector)
|
||||
chapterRegex = altChapterFeedRegex
|
||||
}
|
||||
|
||||
val feed = chapterRegex
|
||||
.find(script.html())
|
||||
?.groupValues?.get(1)
|
||||
?: throw Exception("Failed to find chapter feed")
|
||||
|
||||
val url = apiUrl(feed)
|
||||
.addQueryParameter("start-index", "2") // Only get chapters
|
||||
.addQueryParameter("max-results", "999999") // Get all chapters
|
||||
.build()
|
||||
|
||||
return url.toString()
|
||||
}
|
||||
}
|
|
@ -42,6 +42,7 @@ abstract class ZeistManga(
|
|||
.addQueryParameter("start-index", "2") // Only get chapters
|
||||
.addQueryParameter("max-results", "999999") // Get all chapters
|
||||
.build()
|
||||
|
||||
return url.toString()
|
||||
}
|
||||
|
||||
|
@ -167,7 +168,7 @@ abstract class ZeistManga(
|
|||
|
||||
override fun searchMangaNextPageSelector(): String? = null
|
||||
|
||||
private fun apiUrl(feed: String = "Series"): HttpUrl.Builder {
|
||||
open fun apiUrl(feed: String = "Series"): HttpUrl.Builder {
|
||||
return "$baseUrl/feeds/posts/default/-/".toHttpUrl().newBuilder()
|
||||
.addPathSegment(feed)
|
||||
.addQueryParameter("alt", "json")
|
||||
|
|
|
@ -9,7 +9,7 @@ class ZeistMangaGenerator : ThemeSourceGenerator {
|
|||
|
||||
override val themeClass = "ZeistManga"
|
||||
|
||||
override val baseVersionCode: Int = 2
|
||||
override val baseVersionCode: Int = 3
|
||||
|
||||
override val sources = listOf(
|
||||
SingleLang("DatGarScanlation", "https://datgarscanlation.blogspot.com", "es"),
|
||||
|
|
Loading…
Reference in New Issue