DatGarScanlation: Update selectors (#15013)

* DatGarScanlation: Update selectors

* Add requested changes

* Lint
This commit is contained in:
seew3l 2023-01-18 17:18:14 -05:00 committed by GitHub
parent 2f44ac4b97
commit f74b23e3ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 2 deletions

View File

@ -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()
}
}

View File

@ -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")

View File

@ -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"),