Improve Dynasty Scans (#113)
This commit is contained in:
parent
1dbabe1707
commit
76f637f17b
@ -6,7 +6,7 @@ ext {
|
||||
extName = 'Dynasty'
|
||||
pkgNameSuffix = 'en.dynasty'
|
||||
extClass = '.DynastyFactory'
|
||||
extVersionCode = 21
|
||||
extVersionCode = 22
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
@ -12,7 +12,9 @@ class DynastyAnthologies : DynastyScans() {
|
||||
|
||||
override val searchPrefix = "anthologies"
|
||||
|
||||
override fun popularMangaInitialUrl() = "$baseUrl/anthologies?view=cover"
|
||||
override val categoryPrefix = "Anthology"
|
||||
|
||||
override fun popularMangaInitialUrl() = ""
|
||||
|
||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||
return GET("$baseUrl/search?q=$query&classes%5B%5D=Anthology&sort=&page=$page", headers)
|
||||
|
@ -13,9 +13,9 @@ import org.jsoup.nodes.Element
|
||||
class DynastyChapters : DynastyScans() {
|
||||
override val name = "Dynasty-Chapters"
|
||||
override val searchPrefix = "chapters"
|
||||
override val categoryPrefix = "Chapter"
|
||||
override fun popularMangaInitialUrl() = ""
|
||||
|
||||
private fun popularMangaInitialUrl(page: Int) = "$baseUrl/search?q=&classes%5B%5D=Chapter&page=$page=$&sort="
|
||||
private fun latestUpdatesInitialUrl(page: Int) = "$baseUrl/search?q=&classes%5B%5D=Chapter&page=$page=$&sort=created_at"
|
||||
|
||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||
@ -76,23 +76,15 @@ class DynastyChapters : DynastyScans() {
|
||||
return chapter
|
||||
}
|
||||
|
||||
override fun popularMangaRequest(page: Int): Request {
|
||||
return GET(popularMangaInitialUrl(page), headers)
|
||||
}
|
||||
|
||||
override fun latestUpdatesRequest(page: Int): Request {
|
||||
return GET(latestUpdatesInitialUrl(page), headers)
|
||||
}
|
||||
|
||||
override fun popularMangaNextPageSelector() = searchMangaNextPageSelector()
|
||||
override fun latestUpdatesNextPageSelector() = searchMangaNextPageSelector()
|
||||
|
||||
override fun popularMangaSelector() = searchMangaSelector()
|
||||
override fun latestUpdatesSelector() = searchMangaSelector()
|
||||
|
||||
override fun popularMangaFromElement(element: Element) = searchMangaFromElement(element)
|
||||
override fun latestUpdatesFromElement(element: Element) = searchMangaFromElement(element)
|
||||
|
||||
override fun popularMangaParse(response: Response) = searchMangaParse(response)
|
||||
override fun latestUpdatesParse(response: Response) = searchMangaParse(response)
|
||||
}
|
||||
|
@ -17,7 +17,8 @@ class DynastyDoujins : DynastyScans() {
|
||||
|
||||
override val searchPrefix = "doujins"
|
||||
|
||||
override fun popularMangaInitialUrl() = "$baseUrl/doujins?view=cover"
|
||||
override val categoryPrefix = "Doujin"
|
||||
override fun popularMangaInitialUrl() = ""
|
||||
|
||||
override fun popularMangaFromElement(element: Element): SManga {
|
||||
return super.popularMangaFromElement(element).apply {
|
||||
@ -51,7 +52,7 @@ class DynastyDoujins : DynastyScans() {
|
||||
override fun chapterListParse(response: Response): List<SChapter> {
|
||||
val document = response.asJsoup()
|
||||
|
||||
val chapters = document.select(chapterListSelector()).map { chapterFromElement(it) }.toMutableList()
|
||||
val chapters = try { document.select(chapterListSelector()).map { chapterFromElement(it) }.toMutableList() } catch (e: IndexOutOfBoundsException) { mutableListOf() }
|
||||
|
||||
document.select("a.thumbnail img").let { images ->
|
||||
if (images.isNotEmpty()) {
|
||||
|
@ -12,7 +12,9 @@ class DynastyIssues : DynastyScans() {
|
||||
|
||||
override val searchPrefix = "issues"
|
||||
|
||||
override fun popularMangaInitialUrl() = "$baseUrl/issues?view=cover"
|
||||
override val categoryPrefix = "Issue"
|
||||
|
||||
override fun popularMangaInitialUrl() = ""
|
||||
|
||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||
return GET("$baseUrl/search?q=$query&classes%5B%5D=Issue&sort=&page=$page", headers)
|
||||
|
@ -39,6 +39,8 @@ abstract class DynastyScans : ParsedHttpSource() {
|
||||
|
||||
open val searchPrefix = ""
|
||||
|
||||
open val categoryPrefix = ""
|
||||
|
||||
private var parent: List<Node> = ArrayList()
|
||||
|
||||
private var list = InternalList(ArrayList(), "")
|
||||
@ -49,11 +51,13 @@ abstract class DynastyScans : ParsedHttpSource() {
|
||||
|
||||
private val json: Json by injectLazy()
|
||||
|
||||
protected fun popularMangaInitialUrl(page: Int) = "$baseUrl/search?q=&classes%5B%5D=$categoryPrefix&page=$page=$&sort="
|
||||
|
||||
override fun popularMangaRequest(page: Int): Request {
|
||||
return GET(popularMangaInitialUrl(), headers)
|
||||
return GET(popularMangaInitialUrl(page), headers)
|
||||
}
|
||||
|
||||
override fun popularMangaSelector() = "ul.thumbnails > li.span2"
|
||||
override fun popularMangaSelector() = searchMangaSelector()
|
||||
|
||||
override fun popularMangaFromElement(element: Element): SManga {
|
||||
val manga = SManga.create()
|
||||
@ -62,12 +66,7 @@ abstract class DynastyScans : ParsedHttpSource() {
|
||||
return manga
|
||||
}
|
||||
|
||||
override fun popularMangaParse(response: Response): MangasPage {
|
||||
val mangas = response.asJsoup().select(popularMangaSelector()).map { element ->
|
||||
popularMangaFromElement(element)
|
||||
}
|
||||
return MangasPage(mangas, false)
|
||||
}
|
||||
override fun popularMangaParse(response: Response) = searchMangaParse(response)
|
||||
|
||||
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
||||
if (query.startsWith("manga:")) {
|
||||
@ -249,7 +248,7 @@ abstract class DynastyScans : ParsedHttpSource() {
|
||||
|
||||
data class Validate(val _isManga: Boolean, val _pos: Int)
|
||||
|
||||
override fun popularMangaNextPageSelector() = ""
|
||||
override fun popularMangaNextPageSelector() = searchMangaNextPageSelector()
|
||||
override fun latestUpdatesSelector() = ""
|
||||
override fun latestUpdatesNextPageSelector() = ""
|
||||
override fun imageUrlParse(document: Document): String = ""
|
||||
|
@ -14,7 +14,9 @@ class DynastySeries : DynastyScans() {
|
||||
|
||||
override val searchPrefix = "series"
|
||||
|
||||
override fun popularMangaInitialUrl() = "$baseUrl/series?view=cover"
|
||||
override val categoryPrefix = "Series"
|
||||
|
||||
override fun popularMangaInitialUrl() = ""
|
||||
|
||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||
return GET("$baseUrl/search?q=$query&classes%5B%5D=Series&sort=&page=$page", headers)
|
||||
|
Loading…
Reference in New Issue
Block a user